Instance Creation
State Machine
Agent instances follow a lifecycle state machine:IPC Protocol
Communication between the coordinator and agent processes uses Unix domain sockets with length-prefixed JSON messages.Message Types (Coordinator → Agent)
| Type | Description |
|---|---|
init | Initialize with config, state, workspace path |
message | Deliver user message for processing |
config_update | Runtime config change |
steer | Mid-turn guidance |
shutdown | Graceful shutdown signal |
Message Types (Agent → Coordinator)
| Type | Description |
|---|---|
stream_update | Streaming token/content update |
state_delta | State mutation delta (JSON Patch) |
log | Structured log entry |
tool_request | Request tool execution |
complete | Message processing complete |
Agent Configuration
Agents receive configuration at init time and can receive runtime updates:Scale-to-Zero
When an agent is idle beyond the configured timeout:- Coordinator calls
onIdleTimeout()— agent can returnfalseto defer - If allowed, coordinator calls
onShutdown() - State is checkpointed to SQLite
- SQLite is replicated to S3 via Litestream
- Chronicle FUSE filesystem is unmounted
- Agent process is terminated
- Instance directory is cleaned up (or preserved for fast restart)