Key Concepts
Ash has five core concepts. Understanding how they relate to each other will help you make sense of the rest of the documentation.
The Five Concepts
| Concept | What it is | Analogy |
|---|---|---|
| Agent | A folder containing CLAUDE.md (system prompt) and optional config files. Defines the behavior and permissions of an AI agent. | A Docker image -- the blueprint, not the running instance. |
| Session | A stateful conversation between a client and a deployed agent. Has a lifecycle (starting, active, paused, ended). Persisted in the database. | A container instance -- created from the image, has state, can be stopped and restarted. |
| Sandbox | An isolated child process that runs a single session. Restricted environment variables, resource limits (cgroups on Linux), and filesystem isolation (bubblewrap). | A jail cell -- the agent runs inside it and cannot access anything outside. |
| Bridge | A process inside each sandbox that connects to the Claude Agent SDK. Reads the agent's CLAUDE.md, receives commands from the server over a Unix socket, and streams responses back. | A translator -- it speaks the server's protocol on one side and the Claude SDK's API on the other. |
| Server | The Fastify HTTP server that exposes the REST API, manages the agent registry, routes sessions, and persists state to SQLite or Postgres. | The control tower -- it coordinates everything but does not do the AI work itself. |
How They Connect
The data flow for a single message:
- The client sends
POST /api/sessions/:id/messageswith a prompt. - The server looks up the session and its associated sandbox.
- The server sends a
querycommand to the bridge over the Unix socket. - The bridge calls the Claude Agent SDK's
query()function. - The SDK streams response messages back to the bridge.
- The bridge writes each message to the Unix socket.
- The server reads each message and writes it as an SSE frame to the HTTP response.
- The client receives the streamed response.
Agent Structure
An agent is a folder. The only required file is CLAUDE.md:
my-agent/
├── CLAUDE.md # System prompt (required)
├── .claude/
│ ├── settings.json # Tool permissions
│ └── skills/
│ └── search-and-summarize/
│ └── SKILL.md # Reusable skill definition
└── .mcp.json # MCP server connections
Minimal agent -- one file:
my-agent/
└── CLAUDE.md
Production agent -- skills, MCP tools, scoped permissions:
research-agent/
├── CLAUDE.md # "You are a research assistant..."