Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.phrony.com/llms.txt

Use this file to discover all available pages before exploring further.

The Runs API covers routes under /v1/runs/{runId} for a run you obtained from Start a run. The key must be authorized for that run. Start runs from the Agents API.

The run status object

GET /v1/runs/{runId} returns a JSON object for polling. Shapes can include more fields; at minimum:
{
  "runId": "00000000-0000-0000-0000-000000000001",
  "status": "Running",
  "output": null
}

GET /v1/runs/{runId}

Get current status and result fields for a run. Poll until the run reaches a terminal state, unless you use stream or other signals.
Response (JSON): At minimum:
FieldTypeRequiredDescription
runIdstring (UUID)YesSame as {runId} in the path.
statusstringYesRun status for polling.
outputJSON or nullYesResult payload when available.
errorstringNoError message if the run failed.
The API may include other fields.

GET /v1/runs/{runId}/conversation

Return a session snapshot, per-run summaries, and a merged timeline of steps (plus synthetic completion rows).
  • Auth: Run-access key.
Query (optional):
ParameterTypeDescription
stepContentslim or fullslim strips redundant keys from step content objects (see below). Default is full when omitted.
Response (success, JSON): A session snapshot plus runs and a merged, sorted items timeline (steps from projection plus synthetic completion rows).
FieldTypeDescription
sessionobjectSession row for this session.
runsarrayRun summary for every run in the session (including sub-agents when present).
itemsarrayTimeline item — one row per step or synthetic RunCompleted / SessionCompleted row.
Conversation: session object
FieldTypeDescription
idstring (UUID)Session id.
tenantIdstring (UUID)Workspace id.
agentIdstring (UUID)Agent id.
agentVersionIdstring (UUID)Version id for the session.
llmModelstring or nullModel for that version, when resolved.
triggerTypestringHow the run was started.
triggeredBystring or nullAPI key or other “who started it” wire value.
triggerIdstring (UUID) or nullTrigger id.
triggerNamestring or nullTrigger label when resolved.
statusstringSession status.
totalTokensUsednumberCumulative tokens.
outputJSON or nullSession output when set.
errorstring or nullError when the session failed.
startedAtstring (ISO-8601)Start time.
finishedAtstring (ISO-8601) or nullWhen finished, if applicable.
inputJSON or nullStart input (root run) when available.
startContextobject or nullStart context (for example userInput, frozen config) when the snapshot has it.
Conversation: runs[] run summary
FieldTypeDescription
idstring (UUID)Run id.
sessionIdstring (UUID)Parent session.
agentIdstring (UUID)Run’s agent.
agentVersionIdstring (UUID)Version used for the run.
parentRunIdstring (UUID) or nullParent run for sub-agent runs.
depthnumberNesting depth (0 for the root).
statusstringRun status.
totalTokensUsednumberRun token usage.
outputJSON or nullRun output when set.
errorstring or nullRun error if any.
startedAt / finishedAtstring (ISO-8601) or nullRun timing.
triggerType / triggeredBy / triggerId / triggerName(mixed)Carried from the session for context.
inputJSON or nullFrom the run’s execution snapshot when available.
llmModelstring or nullFor this run’s version.
agentNamestring or nullDisplay name.
versionLabelstring or nullVersion label.
Conversation: items[] timeline item
FieldTypeDescription
runIdstring (UUID)Which run the row belongs to.
idstring (UUID)Step or synthetic row id.
sequencenumberMonotonic per run; not a global sort key (use ordinal).
ordinalnumber1-based order after the service merges and sorts the full session timeline.
typestringEngine step type (for example UserTaskReq, Reasoning, …) or synthetic RunCompleted / SessionCompleted.
contentJSON or nullStep payload; shape depends on type. For synthetic rows, includes completion status / output / error style fields.
tokensUsednumber or nullTokens for the step, when set.
errorstring or nullError on the step when set.
startedAt / finishedAtstring (ISO-8601) or nullStep timing.
stepContent=slim: For object content values, the API omits these keys to reduce payload size: session_id, run_id, tenant_id, agent_id, agent_version_id, event_id. Other shapes are unchanged. Output-only (redacted) response: When the API trigger has Expose step timeline to API clients off, Phrony may return a redacted JSON body for this route. See Embedded agents — API redaction. In that mode, roughly:
ChangeWhat you get
itemsOnly completion-style rows: SessionCompleted, and RunCompleted for the root run.
runs[] / items / sessioninput, startContext (on session), and per-run output / error on runs may be nulled to avoid exposing full detail.

GET /v1/runs/{runId}/stream

Subscribe to Server-Sent Events for live session and run activity. Use a server or fetch with a stream reader so you can set X-API-Key.
  • Auth: Run-access key.
Response: text/event-stream — each SSE event’s data string is a single JSON object (line). Parse it with JSON.parse after decoding UTF-8.
AspectDescription
FormatServer-Sent Events; each data line is one JSON value.
ClientBrowsers’ EventSource cannot set X-API-Key; use a server or fetch + stream reader.
Event object schema (root fields on each data JSON):
FieldTypeDescription
tsstringISO-8601 timestamp (when the hub emitted the event).
kindstep · session · run · user_task · aitlGroups the event.
subjectstringFine-grained name (for example engine.session.started, engine.run.completed, engine.subagent.spawned, engine.step.* — exact strings are engine/projection details).
dataobjectPayload; fields depend on kind and subject (run ids, session ids, step bodies, and so on).
kind roles (at a glance):
kindRole
sessionSession started / completed / paused, etc.
runRun started / completed, subagent spawn, HITL pause, etc.
stepIndividual engine/projection step (reasoning, tool, …).
user_taskHuman / approval task lifecycle.
aitlAgent-in-the-loop (AITL) request updates.
Output-only (redacted) stream: When the same API trigger setting hides the full timeline, Phrony filters the SSE event stream. Events with kind step, user_task, or aitl are dropped, and run events with subject engine.subagent.spawned are also dropped, so the client only receives a safe subset. Unfiltered clients still receive the full set of kind values.

The session message body

POST to /v1/runs/{runId}/input or /v1/runs/{runId}/messages accepts JSON with a runId that matches the path, plus either userTaskId (HITL), or text / message, and/or files, depending on how the run is paused. See Send input or messages below for field tables.

POST /v1/runs/{runId}/input and /v1/runs/{runId}/messages

Resume a run that is waiting for a human, conversation, or file attachments. Same body shape; pick either path.
These routes cover the usual ways to resume a run that is waiting for a human, including many approvals and follow-ups. Not every type of user task can be completed through the API—for example, some escalations to a person from multi-agent runs, and some anomaly or alert steps, must be completed in the Phrony dashboard. See User task — Phrony API.
  • Auth: Run-access key.
  • Status: 202 Accepted on success.
Request body (JSON): runId must match {runId} in the path.
FieldTypeRequiredDescription
runIdstring (UUID)YesSame as {runId} in the path.
userTaskIdstring (UUID)NoFor human-in-the-loop / approval flows: the pending user task to complete. When set, other completion fields may apply.
approvedbooleanNoFor approval / HITL: whether to run pending HTTP tool calls (default true when applicable).
selectedOptionIdstringNoFor multi-option tasks: chosen option from the task’s options list.
textValuestringNoFor text-kind tasks.
numberValuenumberNoFor number-kind tasks.
metadataobjectNoExtra fields stored on the user task.
textstringNoPreferred for conversational WaitingForResponse (alias: message).
messagestringNoSame role as text.
filesarrayNoWorkspace file attachments for a user turn. See File item below.
completedByEmailstring (email)NoSet by the dashboard; do not rely on a client copy for untrusted clients.
files[] item (when resuming with attachments):
FieldTypeRequiredDescription
phronyFiletrueYesMust be the literal true.
objectKeystringYesObject key from finalize.
filenamestringNoDisplay or hint name.
mediaTypestringNoContent type.
Validation: You must provide userTaskId, or non-empty text/message, or at least one files entry, according to the pause type. Response (success, JSON): 202 Accepted body, typically:
FieldTypeDescription
statusstringAcceptance status from the service (work may still run asynchronously).
errorstringOptional error message if the service rejected the follow-up.

Summary

MethodPathPurpose
GET/v1/runs/{runId}Run status and result fields.
GET/v1/runs/{runId}/conversationConversation JSON.
GET/v1/runs/{runId}/streamSSE stream.
POST/v1/runs/{runId}/input or …/messagesHITL completion or conversational message.

Examples

Start a run and poll status

Use runId from the Start a run POST response with GET /v1/runs/{runId} until the run reaches a finished state in your use case. (Start + poll example also appears on Agents API.)

Get conversation and stream (SSE)

Conversation returns JSON. Stream is Server-Sent Events: use curl -N for a quick look. In the browser, EventSource cannot set custom headers, so you typically call stream from a server with X-API-Key, or use a fetch-based text/event-stream reader in Node or Bun.
export PHRONY_API_BASE="${PHRONY_API_BASE:-https://api.phrony.com}"
export PHRONY_API_KEY="phk_..."
RUN_ID="00000000-0000-0000-0000-000000000001"

curl -sS -G "${PHRONY_API_BASE}/v1/runs/${RUN_ID}/conversation" \
  --data-urlencode "stepContent=slim" \
  -H "X-API-Key: ${PHRONY_API_KEY}"

# Raw SSE (Ctrl+C to stop)
curl -sSN "${PHRONY_API_BASE}/v1/runs/${RUN_ID}/stream" \
  -H "X-API-Key: ${PHRONY_API_KEY}"

Send a follow-up message

When the run is waiting for user text, POST to …/input or …/messages. The body must include runId, non-empty text, and/or files, or a userTaskId for human-in-the-loop flows.
export PHRONY_API_BASE="${PHRONY_API_BASE:-https://api.phrony.com}"
export PHRONY_API_KEY="phk_..."
RUN_ID="00000000-0000-0000-0000-000000000001"

curl -sS -X POST "${PHRONY_API_BASE}/v1/runs/${RUN_ID}/messages" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ${PHRONY_API_KEY}" \
  -d '{"runId":"'"${RUN_ID}"'","text":"My reply from curl"}'
  • Agents API — Start runs and list sessions.
  • File library — Upload files, then reference them in input or files, including presign/finalize examples.
  • Embedded agents — Longer walkthroughs and the same three languages.