Harn
A pipeline-oriented language for AI agent orchestration. LLM calls, tool use, concurrency, retries, and replay are built into the runtime.
let response = llm_call(
"Explain quicksort in two sentences.",
"You are a computer science tutor."
)
log(response)
What Harn is
Harn is a small language built around one observation: when you write an AI agent, most of your code is coordination — calling a model, dispatching a tool, retrying, fanning out work, persisting state, recovering from a crash, replaying a trace for debugging. Harn gives those patterns one runtime and one syntax surface.
pipeline review(task) {
let files = ["src/main.rs", "src/lib.rs"]
let reviews = parallel each files { file ->
let content = read_file(file)
retry 3 {
llm_call("Review this code:\n${content}", "You are a code reviewer.")
}
}
for review in reviews {
log(review)
}
}
The orchestration logic is the code: which work fans out, which calls retry, where results join, and which effects pass through the harness.
Why it exists
LLM calls as primitives
llm_call, agent_loop, and workflow_execute are part of the language. Switch providers with a one-field change.
Concurrency with structure
parallel each, spawn/await, channels, and deadlines keep fan-out, joins,
and cancellation visible in the program.
Replay built in
Every agent loop produces a structured transcript that replays deterministically. Debug the run that happened, not your reconstruction of it.
Protocols out of the box
Native MCP, ACP, and A2A. Expose your pipeline as an agent backend, or call any MCP server with three lines.
Suspend and resume
Cooperatively pause a worker mid-loop, persist a snapshot, resume hours later with new input. Daemon agents are first-class.
Gradually typed
Annotations are optional. Add them where they help, leave them off where they don't. Structural shape types describe expected dict fields.
Three paths in
Build something
Start with Getting started for install + first program in five minutes. Then a code-review agent tutorial.
Understand the model
Read the Concepts section: how llm_call, agent_loop, workflow, and pipeline fit together, and when to reach for each.
Coming from elsewhere
If you're arriving from agent SDKs or orchestrators like LangGraph, Inngest, or Mastra, use the terminology reference to get up to speed.
Where to go next
- Tutorials — install, write your first program, then walk through worked examples.
- How-to guides — task-oriented recipes for the things you actually need to do.
- Reference — every builtin, option, and CLI flag.
- Explanation — architecture notes, protocol RFCs, ADRs.