Skip to main content
A diagnostic session is the core unit of work in Agent Therapy. You submit a structured conversation log from your agent, and Agent Therapy analyzes it for behavioral patterns — things like instruction drift, hallucination bursts, tool misuse, and goal hijacking. When the session completes, you receive a full behavioral health report with a numeric health score, a list of findings, and concrete recommendations for fixing each issue.

Preparing Your Behavior Logs

Agent Therapy expects your conversation log as a JSON array of message objects. Each object represents one turn in the conversation and must include a role, content, and timestamp.
Supported roles: Timestamps must be ISO 8601 UTC strings. Tool messages should include a tool_name field — this enables tool-specific behavioral checks.
We recommend including at least 3 complete exchanges (user → assistant → user) for accurate analysis. Shorter logs may not contain enough signal for the diagnostic engine to detect patterns reliably, and findings may have lower confidence scores.

Starting a Session

1

Prepare your behavior log

Collect the conversation turns from your agent and format them as the JSON array described above. Make sure all messages have valid ISO 8601 timestamps.
2

Submit the session

Send a POST request to /v1/sessions with your agent ID and the log.
Request body fields:
3

Wait for the session to complete

Analysis is asynchronous. Poll GET /v1/sessions/{id} until the status field returns completed or failed. Most sessions complete within 10–30 seconds. See Session Status below for the full polling pattern.
4

Retrieve the report

Once the status is completed, the full diagnostic report is included in the session object returned by GET /v1/sessions/{id}. See Reading the Report for a field-by-field breakdown.

Session Status

Sessions move through the following statuses after submission: Polling pattern:
If a session fails, check the error field in the response for a human-readable explanation. Common causes include malformed log JSON, an unrecognized agent_id, or logs that are too short to analyze.

Reading the Report

When a session reaches completed status, the response from GET /v1/sessions/{id} includes the full diagnostic report inline. Here is a complete example:
Report fields explained: