Skip to main content
Sessions are the core diagnostic unit in Agent Therapy. A session represents a complete analysis run over a behavior log you submit — typically a multi-turn conversation or tool-use trace captured from a live agent. Session analysis is asynchronous: you submit a log, receive a session ID, and then poll (or use webhooks) to retrieve the completed report when it is ready. Completed sessions include a health score, a list of behavioral findings, and actionable recommendations.

POST /sessions

Submit an agent behavior log to start a new diagnostic session. The session is queued for analysis immediately and transitions through pending → processing → completed (or failed if analysis cannot complete).

Request Body

string
required
The unique identifier of the registered agent this session belongs to. Must be a valid agt_ prefixed agent ID.
array
required
An ordered array of log objects representing the agent’s conversation or tool-use trace. Each object in the array must conform to the log object schema below. Minimum 1 turn; for logs exceeding 50 turns you may prefer the asynchronous sessions approach over the Diagnostics API.
string
An optional free-text description providing context about the session — for example, the task the agent was performing, the environment it was running in, or any known anomalies.

Log Object Fields

Each object in the behavior_log array represents a single turn or event:
string
required
The role of the participant who produced this turn. Accepted values: user, assistant, tool, system.
string
required
The text content of the turn. For tool roles, this is typically the tool’s output or return value.
string
An optional ISO 8601 timestamp for when this turn occurred. Including timestamps enables time-based pattern analysis such as unusual latency spikes.
string
The name of the tool invoked. Required when role is tool; ignored for other roles.
object
An optional object for attaching arbitrary key-value data to the turn — for example, model parameters, token counts, or internal trace IDs.

Response Fields

string
The unique identifier for the session. Prefixed with sess_.
string
The agent ID this session was submitted for.
string
The current processing status: pending, processing, completed, or failed.
string
ISO 8601 timestamp indicating when the session was submitted.

Example


GET /sessions/

Retrieve the current status and, once completed, the full diagnostic report for a session. Poll this endpoint after submitting a session, or use a webhook to be notified when the session.completed event fires.

Path Parameters

string
required
The unique identifier of the session to retrieve. Prefixed with sess_.

Response Fields

string
The session’s unique identifier.
string
The agent this session belongs to.
string
Current status: pending, processing, completed, or failed.
number
A 0–100 score reflecting the overall behavioral health observed in this session. Present only when status is completed.
string
A short natural-language summary of the session’s findings and recommendations. Present only when status is completed.
array
An array of finding objects identifying specific behavioral patterns detected. Present only when status is completed.
array
An array of natural-language recommendation strings describing suggested interventions or changes. Present only when status is completed.
string
ISO 8601 timestamp when the session was submitted.
string
ISO 8601 timestamp when analysis finished. null until status is completed or failed.

Example


GET /sessions

List diagnostic sessions, filtered to a specific agent. Results are paginated.

Query Parameters

string
required
The unique identifier of the agent whose sessions you want to list.
integer
Number of sessions to return per page. Defaults to 20, maximum 100.
string
Cursor from the previous page’s next_cursor field. Omit for the first request.
string
Filter results by session status. Accepted values: pending, processing, completed, failed.

Example