Managing Sessions
This guide covers the full session lifecycle: creating sessions, inviting agents, sending messages, and closing sessions. All examples usecurl and assume Svantic is running at https://api.svantic.com.
Prerequisites
- A Svantic account with API credentials
- At least one registered agent
Authenticate
Every session operation requires a JWT. Exchange your tenant credentials for a token:The token authenticates all subsequent requests.
Create a Session
Register Your Agent (If You're a Remote Agent)
If you’re building a remote agent (not the terminal CLI), register with Svantic:This registers your agent as available. It does not join any session yet.
Invite an Agent into a Session
Add an agent to a session:If you omit Response:
instance_id, Svantic picks an available instance of that agent_type automatically:Send Messages
Send a message to the session via the A2A The A2A protocol handles streaming via
/send endpoint (JSON-RPC 2.0). The session’s orchestrator handles routing:message/stream. All metadata (files, action_data, target_agent, yolo_mode, context) is sent as DataParts in the A2A Message.Self-Join Shortcut
For entry-point agents that create sessions, you can combine session creation and self-join in one call:Automatic Routing
You don’t need to invite agents manually for most workflows. When a session needs an agent type that isn’t already participating, Svantic automatically:- Checks if the agent type is already in the session — if so, routes to the same instance (session affinity)
- Finds an available registered instance
- Adds it to the session and dispatches the task
Session TTL
Sessions without activity are automatically closed after the TTL threshold (default: 30 minutes). The threshold is configurable viasettings.json:
0 to disable automatic cleanup (not recommended for production).
Further Reading
- Sessions — the session-first architecture
- Registering Agents — how agents register with Svantic
- Using the API — full API reference
