Sessions
Introduction
An agent session is one task an agent did, across every source it touched.
It has a purpose ("Reconcile November invoices against the CRM"), the agent
that ran it, and the member it acted for. Every key minted for that task
belongs to the session, so every call the key makes is logged with the
session's id (ses_…).
Open Sessions in the sidebar to see what each agent did, on which sources, and how many of its calls were refused, failed, or wrote data. Open a session to see its calls in time order, and revoke it to stop every key it holds at once.
A session key is different: it is the short-lived key an agent gets from
start_source_session for one source. An agent session groups those keys,
one or more per source, under the task they were minted for.
How an agent starts one
An agent connected over MCP calls start_session with the
task's purpose in one sentence, and optionally the
issue it is for. It gets back a session_id and passes
it to start_source_session and the other source tools for the rest of the
task. It calls end_session when the task is done.
start_source_session and the query and MCP source tools also take a
purpose, which starts a session in the same call. Passing the same purpose
again stays in that session.
Without session_id, a call goes to the agent's current session, the
newest one it used in the last 30 minutes. When there is none, those tools
refuse the call and ask the agent for a purpose, so every task it starts
is labeled. Calls to a proxied MCP server's own tools (such as
linear_create_issue) and get_query_result still start a session without
one; these implicit sessions show No purpose given on the list.
A script or integration with a Control API token starts
a session with POST /api/v1/sessions and mints keys into it with
session_id. A key minted without session_id belongs to no session.
When a session ends
A session is open until one of these happens:
| What | When |
|---|---|
| The agent ends it | end_session, or POST /api/v1/sessions/{id}/end |
| It goes idle | 30 minutes without a call for an implicit session, 24 hours for one started with a purpose |
| It reaches 7 days | However active it is |
| Someone revokes it | From its page, or DELETE /api/v1/sessions/{id} |
An open session with no activity for 30 minutes shows as Idle on the
Sessions pages: the agent most likely finished without calling
end_session, or is waiting on something. It is still open and still takes
keys, and its next call makes it Open again. It ends once it reaches the
idle limit above. The Status filter's Open lists only sessions active
in the last 30 minutes; Idle lists the rest. The Control API reports
both as open.
Every key the agent gets and every swarmvia tool it uses keeps a session active. Where the Sessions pages show call counts, the calls an agent makes straight to a source's endpoint with its key keep it active too.
An ended session takes no new keys. Keys it already holds keep working until they expire, at most 7 days after they were minted. Revoking a session ends it and revokes every live key it holds, on every source, at once. If a key cannot be revoked right away, the session page says so and keeps Revoke session available to try again.
The Sessions list
Each row shows the purpose, the agent (a connector's name or an API token's name) and the member it acted for, the sources it used, its call counts (where shown), when it started and was last active, and whether it is open, ended or revoked.
Filter by status, by sessions with or without a purpose, by agent, member, source and start date, and search the purposes.
A session's page
- Sources: each source it used, with its calls, refused calls, errors and writes where call counts are shown, and a link to that source's Logs filtered to the session.
- Timeline: every call across those sources, newest first: time, source, what it ran (a database call's statement, an MCP call's tool, or an API call's method and path), status, outcome and duration. When an API source's policy decided a call, a Policy column says how: allowed or denied. Click a call to see its full log entry. Work the agent reported doing outside swarmvia sits among the calls, marked Reported (see below).
- Handoff: the handoff the agent left in this session.
- Keys: each key minted in the session, its source, and when it was minted, expires and was revoked.
When an API token held the session, its name links to the token's activity: every session and call of that integration.
A refused call is one the source's access rules stopped: the caller's IP, the
key, a policy, a tool, or the database. A write is a
proxied call with a method other than GET, HEAD or OPTIONS.
Work outside swarmvia
An agent also does work swarmvia never sees: it opens a pull request on
GitHub, runs a command in a shell, posts to Slack. To keep the whole task in
one place, it calls record_activity (MCP) or
POST /api/v1/sessions/{id}/activity (the Control API)
with one line of what it did:
- System: where it happened, such as
GitHub. - Action: what was done, such as
Opened PR #412 to fix the invoice export. - Outcome:
done,failedorskipped. - Link and time, both optional.
These lines are what the agent says it did. swarmvia did not see the work happen, so the timeline marks each one Reported. They hold no output, payloads or secrets, and a session takes at most 5,000. For a system the agent uses a lot, add it as a source instead: its calls are then logged, not reported.
Who sees what
- Owners and admins see every session in the organization.
- A member sees the sessions that acted for them.
- Whoever can see a session can revoke it.
- A session page shows only the sources the viewer can see. The rest are counted as "more sources you can't see".
Settings → Connected agents shows each agent's open sessions and links to its sessions. An issue's page lists the sessions that worked on it.
Limitations
- A session is kept as long as your plan keeps access logs (Free 7 days, Starter 30, Team 90, Business 1 year), counted from when it ended. Its calls and reported work follow the same window, so the oldest of them can expire while the session is still listed.
- Call counts may not be shown for your organization yet. The timeline lists the session's calls either way.
- The Source filter finds sessions that minted a key on that source.