Skip to main content

Managing Sessions

This guide covers the full session lifecycle: creating sessions, inviting agents, sending messages, and closing sessions. All examples use curl and assume Svantic is running at https://api.svantic.com.

Prerequisites

  • A Svantic account with API credentials
  • At least one registered agent

1

Authenticate

Every session operation requires a JWT. Exchange your tenant credentials for a token:
The token authenticates all subsequent requests.
2

Create a Session

Response:
Svantic verifies your JWT, creates the session, and automatically sets up the internal agents needed for orchestration.
3

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.
4

Invite an Agent into a Session

Add an agent to a session:
If you omit instance_id, Svantic picks an available instance of that agent_type automatically:
Response:
5

Send Messages

Send a message to the session via the A2A /send endpoint (JSON-RPC 2.0). The session’s orchestrator handles routing:
The A2A protocol handles streaming via message/stream. All metadata (files, action_data, target_agent, yolo_mode, context) is sent as DataParts in the A2A Message.
6

List Agents in a Session

See which agents are in a session and how they joined:
Response:
7

Close a Session

Explicitly close a session to clean up resources:
What happens:
  1. Per-session agents are shut down
  2. Remote agents are released for other sessions
  3. Cleanup events are published

Self-Join Shortcut

For entry-point agents that create sessions, you can combine session creation and self-join in one call:
This creates the session, auto-attaches internal agents, AND binds the caller — all in one round-trip.

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:
  1. Checks if the agent type is already in the session — if so, routes to the same instance (session affinity)
  2. Finds an available registered instance
  3. Adds it to the session and dispatches the task
This means registration alone is enough — Svantic pulls agents into sessions as needed.

Session TTL

Sessions without activity are automatically closed after the TTL threshold (default: 30 minutes). The threshold is configurable via settings.json:
Set to 0 to disable automatic cleanup (not recommended for production).

Further Reading