Brain
Build agents your way. Run their tools wherever the work lives.
Brain is an open-source agent runtime. You choose the agent loop, the model, the tools and where each one runs. Brain saves the session and gives your application one API to drive it.
Picture a support agent that looks up an order in your backend, checks a delivery page in a browser and updates a ticket. Each tool runs where it can reach what it needs.
Why Brain
- Own the agent's behavior
- Start with a ready-made loop, or write your own context management, model calls and tool sequencing. Official loops use the same public interfaces as yours.
- Run each tool where it belongs
- Your app's process, the user's browser tab, an HTTPS backend or a remote sandbox. Choose per tool when you create a session.
- Drive it from your app
- Send messages, stream progress, submit background work and collect results later through one session API. Host it yourself, or let Aex host it.
Try an order lookup
The quickstart gives an agent a function from your app and asks whether an order has shipped. It includes the server command, matching package versions, a complete program and the expected result.
You need Docker, Node.js 24 and an OpenAI API key, which is billed by OpenAI. Your app's functions run in your process, so keep it connected while the agent needs them.
Keep building
Project status
Brain 2.1 provides native Pi, Codex and OpenCode harnesses. Saved history survives a server restart when storage is intact. Interrupted work requires an explicit decision before it is resumed or retried, and history can't restore lost browser or sandbox files.
MIT licensed. Explore the API reference, architecture or contributor guide.