What is a session?
A session is a multi-turn conversation between a user and an agent. Each session:- Runs in its own isolated Firecracker microVM (see Isolation)
- Has a persistent
/workspacefilesystem (see Persistence) - Maintains conversation history (if your framework supports it)
- Can be resumed hours or days later with full context
Session lifecycle
Creation
A session is created when:
- You run
superserve run my-agent - You call
client.createSession()in the SDK - You send a message without a
sessionId(auto-creates one)
Active state
While the session is processing a message, it’s in the
active state. The microVM is running, the agent is executing tools, and you can’t send another message until it finishes.Idle state
After the agent finishes responding, the session goes If you don’t send another message within the idle timeout, the microVM is destroyed to save resources. The
idle. The microVM stays alive for a short period (default: a few minutes) to avoid cold starts if you send another message soon./workspace filesystem is persisted, so you can resume later.Resuming
When you resume an idle session:
- A fresh microVM is spawned (see Isolation)
- The
/workspacefilesystem is mounted from persistent storage - Conversation history is restored (if your framework persists it)
Completion or failure
A session ends when:Even
- You explicitly call
session.end()or runsuperserve sessions end <id> - The agent crashes or times out (status becomes
failed) - The session hits a configured limit (max turns, max duration)
completed or failed sessions are resumable. You get a fresh microVM with the same /workspace.Session status reference
| Status | Meaning | Can send messages? | Can resume? |
|---|---|---|---|
active | Processing a message right now | No | N/A |
idle | Waiting for the next message | Yes | Yes |
completed | Ended by user or agent | No | Yes (fresh VM, same workspace) |
failed | Crashed, timed out, or hit a limit | No | Yes (fresh VM, same workspace) |
Managing sessions
CLI
SDK
Idle timeout configuration
By default, sessions stay alive for 30 days after the last message. You can configure this per-session or per-run:Conversation memory
Superserve preserves the/workspace filesystem across turns and VM restarts. But conversation history (the messages exchanged between user and agent) depends on your framework:
Claude Agent SDK
Claude Agent SDK
Enable The SDK stores conversation history in memory. If the microVM restarts (e.g., after idle timeout), the history is lost unless you persist it to
continue_conversation to maintain memory across turns:/workspace.OpenAI Agents SDK
OpenAI Agents SDK
The SDK maintains conversation state in the
Runner object. Persist it to /workspace if you need it to survive restarts:LangChain / LangGraph
LangChain / LangGraph
Use LangChain’s memory components and persist to
/workspace:Custom / No framework
Custom / No framework
Persist conversation state yourself:
Session reuse patterns
Pattern 1: Single-turn sessions (stateless)
If you don’t need multi-turn context, create a new session for each message:- Stateless tasks (math, translation, single-shot code generation)
- Load testing (each request is isolated)
Pattern 2: Multi-turn sessions (stateful)
Reuse the same session for a conversation:- Code review workflows
- Research tasks that build on previous findings
- Debugging sessions
Pattern 3: Long-running sessions
Create a session and keep it alive for days or weeks:- Long-term projects
- Agents that accumulate knowledge over time
- Collaborative workflows where the agent is a persistent teammate
Performance and resource usage
Cold starts vs. warm sessions
Cold starts vs. warm sessions
- Cold start: Session was idle for longer than the timeout. A new microVM is spawned. Takes ~500ms-1s.
- Warm session: Session is still active or recently idle. The existing microVM handles the request. Takes ~10-50ms.
idleTimeout or send messages more frequently.Concurrent sessions
Concurrent sessions
Each session runs in its own microVM. You can have thousands of concurrent sessions for the same agent - they’re fully isolated.
Session cleanup
Session cleanup
Sessions that haven’t been used in
idleTimeout seconds have their microVMs destroyed automatically. The workspace persists until you delete the session.Periodically clean up old sessions to free storage:Isolation
How each session gets its own microVM
Persistence
How /workspace survives across sessions
SDK Reference
TypeScript client for managing sessions
CLI Reference
All
superserve sessions commands