Harn
Harn is a pipeline-oriented programming language for orchestrating AI agents. LLM calls, tool use, concurrency, and error recovery are built into the language – no libraries or SDKs needed.
let response = llm_call(
"Explain quicksort in two sentences.",
"You are a computer science tutor."
)
println(response)
Harn files can contain top-level code like the above (implicit pipeline), or organize logic into named pipelines for larger programs:
pipeline default(task) {
let files = ["src/main.rs", "src/lib.rs"]
let reviews = parallel each files { file ->
let content = read_file(file)
llm_call("Review this code:\n${content}", "You are a code reviewer.")
}
for review in reviews {
println(review)
}
}
Get started
The fastest way to start is the Getting Started guide: install Harn, write a program, and run it in under five minutes.
What’s in this guide
- Getting started – Install and run your first program
- Why Harn? – What problems Harn solves and how it compares
- Language basics – Syntax, types, control flow, functions, structs, enums
- Error handling – try/catch, Result type, the
?operator, retry - Modules and imports – Splitting code across files, standard library
- Concurrency – spawn/await, parallel, channels, mutexes, deadlines
- Language specification – Formal grammar and runtime semantics
- LLM calls and agent loops – Calling models, agent loops, tool use
- Transcript architecture – How Harn stores and replays agent conversations
- Workflow runtime – Workflow graphs, artifacts, run records, replay, evals
- Cookbook – Practical recipes and patterns
- Host boundary – How Harn integrates with host applications
- Bridge protocol – JSON-RPC contract for host bridges
- MCP and ACP integration – MCP client/server, ACP, and A2A protocols
- Harn portal – Local observability UI for runs and transcripts
- CLI reference – All CLI commands and flags
- Builtin functions – Complete reference for all built-in functions
- Editor integration – LSP, tree-sitter, and formatter support
- Testing – Running user tests and the conformance suite