Agent
Architecture
The states an agent moves through, and what survives sleep, crashes, and deploys.
States
An agent is idle until a prompt starts a run, and goes back to idle when the run ends or is cancelled. When the context fills up during a run, the agent compacts it and keeps going.
Sleep
An idle agent sleeps and frees its memory. The next action on its key wakes it: the agent reloads its session and reconnects to the same sandbox, so clients don’t do anything different. While the agent sleeps, its sandbox is suspended.
What survives
| Session | Sandbox | |
|---|---|---|
| Sleep | Every message so far. | Reconnected on wake. |
| Crash | Every message written before the crash. | Reconnected on wake. |
| Deploy | Every message so far. Old Actors get up to 30 minutes to finish before the agent wakes on the new code. See Versions. | Reconnected on wake. |
| Destroy | Deleted. | Deleted. |
A model chosen with setModel is restored too, if it’s still allowed. If the sandbox no longer exists when the agent wakes, a new one is created and the old files are lost.