How Agents Run on Levain
The six primitives behind every agent.
An agent is a program that reasons, plans, and acts. Running one reliably in production requires more than a prompt: it needs durable state, scheduling, isolation, and bounded execution. Levain provides six primitives that cover these concerns.
The primitives
| Primitive | What it gives you |
|---|---|
| Session | A durable log of everything the agent did. |
| Orchestration | Scheduling, retries, and cancellation you can rely on. |
| Harness | Step-by-step execution inside the bounds you set. |
| Sandbox | A clean environment for every run, isolated from every other. |
| Resources | The data the agent can reach. |
| Tools | The capabilities the agent can call. |
Every feature in the product maps back to one of these six. When you read the
API reference, the endpoints name them directly: a run is a single
trip through the harness inside a sandbox, logged to a session. When you inspect
a failed agent, you're reading its session. When you swap a data source, you're
updating a resource.
Why these six
Each primitive addresses a distinct class of problem agents run into:
- Unpredictable reasoning — the session records exactly what the agent considered.
- Transient infrastructure failures — orchestration retries idempotently.
- Runaway loops or cost — the harness enforces budgets and step limits.
- Escaped boundaries — the sandbox isolates the run from other runs and the host.
- Stale or wrong context — update the resource to point at fresh data.
- Missing capability — register a new tool.
The primitives are independent. You can change the data a tool reads without touching the agent's instructions, tighten the harness budget without redeploying, or change sandbox backends without modifying the agent.
What you control, what we handle
| You | Levain |
|---|---|
| The agent's goal and instructions. | Keeping the agent on-task, on-budget, and inside safe bounds. |
| The data the agent needs. | Making your data available to the agent on every run. |
| The capabilities the agent uses. | Giving the agent the capabilities it needs, reliably. |
| The model provider (your key, or ours). | Routing LLM traffic, tracking spend, and keeping costs honest. |
| When a run should start. | Running it when you ask, and keeping it running through breaks. |
Read the pages linked above in any order. The primitives are independent by design.