Session
What a Session is
A Session is an isolated workspace for user ↔ Agent interaction. Each Session is a complete tree containing:
- Conversation history (message stream)
- Inputs (uploaded files / retrieved knowledge snippets)
- Artifacts (generated documents / reports / code)
- Ledger (Orchestrator execution log: action / result / confidence)
- Active Skill list
- Collaborators (who can read, write, invoke tools)
Lifecycle
| State | Meaning |
|---|---|
| Create | Created manually or by Event Trigger |
| Active | Actively chatting |
| Compacted | Long dialogue intelligently compressed; essentials kept |
| Pruned | Inactive; old messages trimmed (data retained, not in context) |
| Archived | Archived; no further progression |
Ledger: the Session heartbeat log
The Ledger attaches to the Session and records each Round:
- action — next decision (tool / delegate / ask user)
- result — outcome of the step (incl. token cost)
- confidence — self-rated confidence (0–1)
- trace_id — link to Observability trace
Low confidence triggers automatic backtracking or human-in-the-loop instead of blindly continuing. See Agent dual loop.
Context compaction
Long chats hit model context ceilings (32K / 128K, etc.). Compaction turns verbose dialogue into structured summaries while keeping core facts / decisions / open items:
Pressure levels (token budget)
| Level | Meaning | Behavior |
|---|---|---|
| 🟢 GREEN | < 50% context | Normal |
| 🟡 YELLOW | 50–75% | Start compaction |
| 🟠 ORANGE | 75–90% | Aggressive compaction; drop low-value messages |
| 🔴 RED | > 90% | Force compaction + user warning |
Parallel Sessions
Users can keep multiple Sessions open for different tasks. Sessions are strictly isolated:
- Separate Agent state
- Separate inputs and outputs
- Separate active Skills
- Separate token budget
Example: three patent matters → three Sessions, no interference.
Cross-session capabilities
Graft (cross-session outputs)
A new Session can graft another Session’s deliverables and avoid rework. Typical: impact-analysis Session grafts full-chain data from a traceability Session. See Graft.
Memory sharing (via MemoryOS)
When a Session ends, the system extracts fact / preference / error_pattern into LTM for other Sessions. See Memory.
Hook coordination
Hooks can chain behavior across Sessions. See Hooks.
Security & isolation
- Tenant isolation — Sessions in different tenants never see each other
- User isolation — within a tenant, Sessions are private by default unless shared
- Permission model — owner, collaborators, read-only roles
- Audit — open / edit / share / archive are logged
Related docs
- Agents & multi-agent — Orchestrator runs on top of Session
- Memory — memory after Session ends
- Graft
- Storage — where Session files land
- Code entrypoints:
AgentFlow/src/session/·api/apps/conversation_app.py