Architecture
How Brain, Storage, Tools and Sandbox cooperate to run a session.
Brain separates session coordination from execution and storage. Each service owns its lifecycle and communicates through the API of the service it calls.
Follow a message
Your application supplies a session ID and sends a message. Brain checks access, asks Storage to record the input and queues it. Each session runs one turn at a time.
Brain asks Sandbox for the session’s Pi environment. Pi builds the context, calls the model and selects tools. An idle environment can be released while its saved session remains available.
When Pi requests a tool, Brain records the call and sends it to Tools. Tools checks the binding and arguments, then runs the uploaded module through Sandbox, calls a remote endpoint, or forwards it to a connected client. Brain records the result and gives it to Pi.
Brain streams the session’s events to clients. After a settled turn, Pi exports its state and Brain saves it with the matching transcript position. Recovery loads this state without calling the model or repeating tools.
Ownership
| Component | Owns |
|---|---|
| Brain | Session access, message ordering, turn admission, interruption and event accounting. |
| Storage | Transcripts, attachments, snapshots, session metadata, caching and external synchronization. |
| Tools | Tool bindings, authorization, dispatch and client executors. |
| Sandbox | Isolated environments, attached processes, resource limits and cleanup. |
| Pi | Model requests, context management and agent continuation. |
| Host platform | End-user identity, routing, session placement and ownership transfer. |
Native Modal, E2B, browser and resource integrations are tools with the same registration path as application tools.
Storage and recovery
Storage keeps recent data in memory, retains local disk copies and synchronizes externally. Metadata uses disk and external storage. Reads move through these tiers on a cache miss; a damaged object returns an error.
An accepted write has reached the local disk. A flush waits for the session’s referenced objects and metadata to reach external storage. The configured external backend determines which host failures that copy survives. See Operations for the Docker deployment’s storage boundary.
Recent transcript reads do not start Pi. Active sessions restore their saved working state when needed. After an interrupted turn, the application explicitly resumes the session.
Execution and errors
Each Pi session has its own container. Uploaded tools run in separate containers and receive their declared invocation, without the session’s model credentials. Sandbox enforces the configured resource limits before starting customer code.
Invalid input fails admission. A tool failure is returned as a tool result; a lost connection after dispatch can leave the outcome unknown. Brain never automatically repeats an action whose result was lost. A runtime or storage failure stops the affected turn and emits an error.
Telemetry follows requests across service calls. Domain components emit their own measurements through the public telemetry contract. Session identifiers belong in traces, while metrics use bounded dimensions.
The Brain intents records product intent and component ownership. The roadmap records qualification and remaining work.