Agent Mode & Snapshots
Agent mode gives one chat conversation its own Linux workspace, kept across reloads and stopped when idle.
Cold start
| Step | Behaviour |
|---|---|
| Switch | The chat header sends a control frame; no model call is involved. |
| Provision | botagent creates one Incus container for the session. |
| Serialize | botagent/src/vm/lifecycle.rs queues provisioning per user, so a second turn waits for the same container. |
| Retry | botagent/src/vm/incus.rs retries transient Incus failures with exponential backoff. |
| Bound | The cold budget is 900 s (COLD_LAUNCH_WAIT_SECS), overridable with AGENT_VM_LAUNCH_WAIT_SECS. Past it the turn reports a retryable "still starting" reason, not a generic failure. |
The binding lives in the agent_sessions table, so a reload resumes the same
container instead of launching another one.
Snapshots
| Action | Endpoint |
|---|---|
| Create, with optional label | POST /api/agent/sessions/{id}/snapshots |
| List | GET /api/agent/sessions/{id}/snapshots |
| Restore | POST /api/agent/snapshots/{id}/restore |
Retention is capped per session with FIFO eviction. The same lifecycle backs Vibe dev/prod environment checkpoints.
Sandbox execution
POST /api/v1/sandbox/exec (botagent/src/lib.rs) runs short-lived Python, Node
or shell code in an ephemeral container.
| Limit | Behaviour |
|---|---|
| Network | Denied by default |
| Resources | Memory and CPU capped by the container |
| Authentication | JWT or an organization API key |
| Keys | Created, listed and revoked through /api/cloud/orgkeys; stored as SHA-256 hashes |
Control frame
- The switcher sends
{ "type": "agent_mode", "enabled": true|false }on the existing WebSocket. - The server answers with an
agent_mode_statusframe. - No LLM invocation takes part in the switch.
Artifacts and Drive
Files a turn leaves in output/ used to vanish when the conversation closed.
The publisher (botserver/src/core/bot/pipeline/output_publish/) now offers
them inside the turn and mirrors allowed files to the user's Drive.
| Rule | Behaviour |
|---|---|
| Destination | {bot}.gbdrive/conversations/{title}/ |
| Bound | At most 5 files, 25 MB per file and 50 MB per turn |
| Idempotence | An unchanged file is not read or uploaded again |
| Consent | The person is asked in the turn; a refusal leaves the files in the conversation |
| Ledger | A bounded LRU/TTL mirror prevents a republish after restart |
| Best effort | A Drive failure does not fail the turn; a warning is logged |
| Other channels | Get the durable Drive copy but no vmfile: link, which only the suite chat renders |
drive_save remains available for an explicit, on-demand publish, for example
into a folder the user named.
Related
- Workspace Tabs — tabs that each own a session.
- Consent System — how an in-turn ask is decided.
- Model Routing and Fallback — what answers a chat turn.