Lab

Diagnose conversations

Pick chats the agent already had, launch a diagnosis with checks, and read its failures and fixes.

Endpoints

All paths start with /api/v1/diagnostics and need X-Space-Slug.

MethodURLDoesAuth
GET/agents/{agent_id}/chats/The agent's chats the key's owner can openKey or bearer
POST/agents/{agent_id}/runs/Launch a diagnosis; 201; billedKey or bearer
GET/agents/{agent_id}/runs/The agent's diagnosesKey or bearer
GET/agents/{agent_id}/runs/{run_id}/Status and conclusionsKey or bearer
POST/agents/{agent_id}/runs/{run_id}/cancel/Stop it; 202Key or bearer
DELETE/agents/{agent_id}/runs/{run_id}/Delete it; 204Key or bearer
GET/runs/Every diagnosis in the workspace, newest first; ?kit_id= narrows to one environmentKey or bearer
POST/compare/Compare 2–20 diagnoses of the same agent and environment: {"run_ids"}; 422 for runs without an environmentKey or bearer

Request fields

FieldRule
trace_idsRequired, at least one: IDs of the caller's own chats with this agent in this workspace, from GET /agents/{agent_id}/chats/
kit_idUse the checks of an environment of this agent; replaces eval_assertions
eval_assertionsChecks of your own, shaped as in Build an environment
diagnostic_effortlow, medium (default) or high

Diagnose an agent

  1. List the agent's chats and pick the ones to read; a chat started through run-stream is the one whose thread_id is the threadId you sent:

    curl "$CENTRAL_HUB_URL/api/v1/diagnostics/agents/42/chats/" \
      -H "X-API-Key: $ALO_API_KEY" \
      -H "X-Space-Slug: $WORKSPACE_SLUG"
  2. Launch the diagnosis:

    curl -X POST "$CENTRAL_HUB_URL/api/v1/diagnostics/agents/42/runs/" \
      -H "X-API-Key: $ALO_API_KEY" \
      -H "X-Space-Slug: $WORKSPACE_SLUG" \
      -H "Content-Type: application/json" \
      -d '{"trace_ids": [678, 679], "kit_id": 7, "diagnostic_effort": "low"}'
  3. Poll GET /agents/42/runs/{id}/ until status is completed, failed or cancelled; on the way it passes through pending, loading, scoring, analyzing and optimizing, and cancelling after a cancel.

  4. Read the conclusions in the same response; see Result fields. Read a diagnosed chat with GET /agents/42/chats/{chat_id}/, using an ID from trace_ids.

Result fields

FieldHolds
score, diagnosis_summaryThe result in one number and one paragraph
per_assertion_results[]{id, label, passed, total}: how each check did across the diagnosed chats
failure_categories[]{category, severity, fix_level, description, count, examples}: patterns the analysis found, including inefficient successes, in how many chats, with examples
recommendations[]{priority, title, fix_level, description, suggested}: the fix to make

Troubleshooting

ResponseCauseFix
404 Trace(s) not found: […]A trace_ids entry is not the caller's own chat with this agent in this workspace; chats shared with the caller do not countUse chats the caller started
404 Diagnostic kit not foundkit_id is wrong or not visibleCheck it with GET /kits/
422 This environment belongs to another agent.kit_id names another agent's environmentUse an environment of this agent, or of the agent it was promoted from
422 Unsupported assertion type(s): …A check in eval_assertions has an unknown typeUse a type from GET /check-catalog/

On this page