Introduction
What Brain is, and the four things that plug into it.
Brain runs agent sessions. It holds the conversation, decides what happens next, calls the model, hands out tool calls, and journals every step. That is the entire job.
Run it as a server your app talks to over HTTP, or embed the brain crate in a Rust service you
already own.
Brain is under early development. Contracts are replaced in place until the first stable release, and there is no upgrade path from earlier builds.
The four parts
Everything Brain does not do itself is one of four things you supply.
| Part | You supply | Brain does |
|---|---|---|
| Agent loop | The policy: given what just happened, what next | Runs it in a WebAssembly sandbox and carries out the decision |
| Model | A binding: provider, model name, key | Pins it for the life of the session and makes the call |
| Tool | A name, description, schema, and where it runs | Logs the call and sends it to the bound environment |
| Environment | Somewhere tool calls actually execute | Sets it up, attaches, calls, cancels, tears it down |
The packages we ship use the same interface you would. Nothing built in gets a shortcut.
Why it is split this way
Brain never runs tool code. That is the load-bearing decision. A tool call is a message to somewhere else — a sandbox VM, a browser tab, your backend, the user's laptop — so a crashing or hostile tool takes down its own environment, not the process holding your sessions.
The agent loop is sealed off for the same reason. It receives an observation and returns a decision. No network, no filesystem, no secrets, no clock. Brain performs every effect the loop asks for.
Where to go next
- Quickstart — a running server and a first session.
- Sessions — the log, turns, and how recovery works.
- API reference — generated from the session contract.