A Session is a working instance of an agentic loop — a single conversation with an agent. Sessions are the primary execution context where user interactions, agent responses, tool calls, and events happen.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/everruns/everruns/llms.txt
Use this file to discover all available pages before exploring further.
Concept
Sessions are runtime instances configured by:- Harness (required, immutable) — Infrastructure and base behavior
- Agent (optional, switchable) — Domain-specific customization
- Session capabilities (optional) — Temporary capability additions
- Model override (optional) — Session-specific LLM model
- Virtual filesystem (
/workspace) - Key/value storage
- Encrypted secrets
- Event log (conversation history)
Sessions are long-lived — they don’t “complete” or “fail” in the traditional sense. They transition between states as turns execute.
Lifecycle
Status States
| Status | Description | Can Send Message? |
|---|---|---|
started | Session created, no turns executed yet | Yes |
active | A turn is currently running | No (409 error) |
idle | Turn completed, waiting for input | Yes |
waiting_for_tool_results | Waiting for client to submit tool results | Only tool results |
Creating a Session
harness_id
Optional: agent_id, title, capabilities, model_id
Session Creation Flow
Session Creation Flow
- Validate harness — Ensure harness exists and is active
- Validate agent — If provided, ensure agent exists and is active
- Resolve capabilities — Merge harness + agent + session capabilities
- Apply mounts — Populate session filesystem from capability mount points
- Inject secrets — Add user connection tokens (e.g.,
GITHUB_TOKEN) - Create event log — Initialize append-only event storage
- Emit session.created — First event in the log
- Return session — Status:
started
Switching Agents
Sessions can change agents during their lifetime:- System prompt
- Capabilities (additive to harness)
- Default model (if session doesn’t override)
Session Internals
Turns, Messages, and Events
Sessions contain an append-only event log that drives everything:Turn
One iteration of the agent loop: reason (call LLM) then act (execute tools).- Each turn belongs to a session
- Produces events:
turn.started,llm.generation,tool.completed,turn.completed - Lifecycle:
started→ reason → act →completedorfailed
crates/core/src/turn.rs for the full type definition.
Message
A conversation entry reconstructed from events (not stored separately).- Roles:
user,agent,tool_result - Content: array of
ContentPart(text, image, tool_call, tool_result) - Extended thinking: reasoning models can include extended thinking content
- Queries events from the session
- Filters by type (
input,llm.generation,tool.completed) - Reconstructs messages from event payloads
- Returns the message array
crates/core/src/message.rs for the Message and ContentPart types.
Event
Immutable, append-only record. The primary data store.- Types:
input,output,turn.*,atom.*,tool.*,llm.*,session.* - Atomic per-session sequence numbering
- Carries correlation context:
turn_id,input_message_id,exec_id - Cannot be updated or deleted
crates/core/src/events.rs for all event types.
Why events instead of messages? Events provide complete observability. You can reconstruct messages, debug execution, replay conversations, and build custom views — all from the same immutable log.
Virtual Filesystem
Each session has an isolated PostgreSQL-backed filesystem:- Root:
/workspace - Stored in
session_filestable - Accessible via
session_file_systemcapability tools - Shared between FileSystem and VirtualBash capabilities
- Supports readonly flag (for capability mounts)
crates/core/src/session_file.rs for the SessionFile type.
Key-Value Storage
Session-scoped storage with two tiers: Key/Value — Plain text storagesession_storage capability.
User Connections
External service accounts (GitHub, GitLab) linked to the user are auto-injected as secrets:GITHUB_TOKEN— GitHub OAuth tokenGITLAB_TOKEN— GitLab OAuth token
specs/user-connections.md for details.
Capability Features
Sessions expose a computedfeatures array based on active capabilities:
- Harness capabilities
- Agent capabilities (if agent assigned)
- Session capabilities
- Resolved dependencies
file_system→ Workspace tabsecrets,key_value→ Storage tabschedules→ Schedules tab
Turn Execution Flow
Reason Phase (ReasonAtom)
- Load messages from event log
- Build RuntimeAgent from harness + agent + session config
- Call LLM with system prompt + conversation history
- Emit
llm.generationevent with response - Parse tool calls (if any)
crates/core/src/atoms/reason.rs.
Act Phase (ActAtom)
- Execute tools in parallel (up to 10 concurrent)
- Emit
tool.startedandtool.completedevents - Handle errors with retries (tool-specific policies)
- Collect results for next reason phase
crates/core/src/atoms/act.rs.
Max Iterations
The reason-act loop repeats until:- LLM returns no tool calls (natural completion)
- Max iterations reached (default: 100)
- Error occurs
Advanced Features
Message Filters
Capabilities can contribute message filters to modify retrieval:- Time-based filtering — Load messages from specific time range
- Event type filtering — Filter by message role or event type
- Tool name filtering — Filter tool results by tool name
- Ephemeral injection — Add system reminders without persistence
crates/core/src/message_filter.rs for the MessageFilter types.
Infinity Context
Everruns supports unlimited conversation length via context management:- Message filtering to keep context under model limits
- Automatic summarization (future)
- Sliding window strategies (future)
specs/infinity-context.md for the full specification.
Scheduled Tasks
Sessions can create cron-based scheduled tasks via thesession_schedule capability:
specs/scheduled-tasks.md for details.
SQL Databases
Sessions can have isolated SQLite databases via thesession_sql_database capability:
specs/session-sqldb.md for details.
Performance Considerations
Event Log Growth
Long-running sessions accumulate many events:- Events are indexed by
session_idandsequence_number - Message reconstruction is efficient (no table scans)
- Consider archiving old sessions after inactivity
Filesystem Size
Virtual filesystems are stored in PostgreSQL:- Files stored as
BYTEA(binary data) - Practical limit: ~100 MB per session
- Large files should be stored externally (S3, etc.)
Concurrent Turns
Sessions process one turn at a time:- Sending a message while a turn is active returns
409 Conflict - Check
statusfield before sending messages - Use SSE to detect
turn.completedevents
Best Practices
Session Organization
- One session per conversation — Don’t reuse sessions for unrelated tasks
- Meaningful titles — Set titles to describe the session purpose
- Archive when done — Sessions never auto-delete, manually archive
Capability Selection
- Harness provides base — Most capabilities should come from the harness
- Agent adds specialization — Agent capabilities are domain-specific
- Session for experiments — Use session capabilities for temporary additions
Model Overrides
Next Steps
Events
Understand the event system and SSE streaming
Durable Execution
Learn about workflow orchestration
Create Session
API reference for creating sessions
Send Message
API reference for sending messages