Harn
Harn is a programming language and runtime for building AI agents. Model calls, tools, retries, concurrency, transcripts, and workflows are language and standard-library features, so programs need less orchestration glue.
fn main(harness: Harness) {
const response = harness.llm.call(
"Explain quicksort in two sentences.",
"You are a computer science tutor.",
{ provider: "mock" }
)
harness.stdio.println(response.text)
}
That runs with no API key: the mock provider is deterministic and offline.
Getting started installs Harn and runs it.
When Harn helps#
Harn helps when you want agent behavior to read like a program: which model runs, when a tool fires, how a failure is handled, and what the run records. You do not need experience with an agent framework. Familiarity with one programming language or with large language models (LLMs) will make some terms feel familiar, but it is not required.
For one model call, an existing SDK may be enough. Harn becomes more useful as your program gains tools, retries, multiple providers, concurrency, replay, or long-running work. Harn also includes a portal for inspecting persisted runs.
Building blocks#
Harn supports one model request, an agent loop, or a multi-stage workflow. Start with the smallest building block that fits the task:
| Need | Start with |
|---|---|
| One request and one response | harness.llm.call |
| A model that can use tools across turns | agent_loop |
| Named stages with joins and retries | workflow_execute |
Put any of these in fn main or a named
pipeline. Add a larger abstraction only when
the program needs it. The expressiveness spectrum
shows the same task as a model call, an agent loop, and a workflow.
Where to go next#
- Why Harn? explains the design with the same program in Python and Harn.
- Coming from elsewhere maps Harn terms to other agent tools and protocols.
- The feature matrix compares runtime guarantees across Harn, Inngest, Temporal, LangGraph, and Cursor Automations.
- The mental model shows how Harn's parts fit.
- Common tasks starts from a goal you want to complete.
Harn owns the reusable agent behavior: orchestration, model and tool calls, transcripts, replay and evaluation, worker lineage, and capability policy. Your application keeps its own interface, approval flow, file changes, and product data. In practice, you write the steps the agent should take. The Harn virtual machine (VM) handles provider adapters, retries, transcripts, and runtime policy. The host boundary explains the full split.
Harn at a glance#
- Paradigm
- Pipeline-oriented, imperative, with structured concurrency
- Typing
- Gradual and structural. Annotations are optional everywhere.
- Implemented in
- Rust, as a lexer, parser, type checker, and tree-walking VM
- Runs on
- macOS and Linux on Intel and ARM, Windows on x86-64. Platform support has the detail.
- File extensions
-
.harnfor programs..harn.promptfor prompt templates. - Speaks
- MCP, ACP, and A2A, natively
- License
- MIT or Apache-2.0, at your option
- Maturity
- Pre-1.0. Surface-level breaking changes are possible between minor and patch releases. See the changelog.