Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.snorbe.deskrex.ai/llms.txt

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

Execute Agent (Streaming)

Execute a research agent using Server-Sent Events (SSE) to receive responses in real time. As the agent generates text, delta events are streamed to the client.
Ideal for long-running research tasks and UI applications that display responses in real time. For simple fire-and-forget use cases, see Execute Agent (Non-Streaming).

New Execution

POST /api/v1/agent/run/stream

Headers

HeaderRequiredDescription
AuthorizationYesAPI key in Bearer snorbe_... format
Content-TypeYesapplication/json
AcceptYestext/event-stream

Request Body

{
  "modelName": "gpt-5-mini-2025-08-07",
  "inputText": "Research the latest AI agent papers",
  "promptKey": "chat-routing",
  "locale": "en",
  "fileUrls": [],
  "mentions": [],
  "maxBrowsingSteps": 5,
  "extendedContextEnabled": false
}

Parameters

ParameterTypeRequiredDescription
modelNamestringYesModel name
inputTextstringYesInput text for the agent
promptKeystringYesPrompt key (typically "chat-routing")
localestringYes"ja" or "en"
fileUrlsstring[]NoAttached file URLs (max 10). Default: []
agentIdstringNoAgent ID. Defaults to the default agent
mentionsMention[]No@mention references (entities, agent runs, sources, other Agents). Default: []. Including type: "agent" lets the target Agent delegate via mentionAgent mid-run (see /agent/run for details)
maxBrowsingStepsnumberNoMax browsing steps (1-100)
maxChainStepsnumberNoMaximum depth of Agent-to-Agent mention chains (1-50, default 10)
maxRetriesnumberNoRetry count (0-5)
retryDelayMsnumberNoRetry delay in ms (0-10000)
includeOthersEntitiesbooleanNoInclude other users’ entities in RAG search. Default: true
extendedContextEnabledbooleanNoExtended context (uses 80% of model max tokens). Default: false
matrixEditContextobjectNoMatrix edit context (sourceRunId + selection)
matrixContinueContextobjectNoMatrix continue context (sourceRunId)
matrixSelectionContentstringNoMatrix selection XML (<matrix_selection> format)

Mention Object

{
  "id": "entity_abc123",
  "type": "entity",
  "label": "GPT-5"
}
FieldTypeDescription
idstringID of the referenced item (entity, agent run, or source)
typestring"entity" / "agent-run" / "public-source" / "private-source"
labelstringDisplay name

Resume (Restart Existing Run)

Resume execution after a HITL (Human-in-the-Loop) pause, such as plan or report confirmation.
POST /api/v1/agent/run/stream/{runId}

Request Body

{
  "modelName": "gpt-5-mini-2025-08-07",
  "extendedContextEnabled": false
}

Parameters

ParameterTypeRequiredDescription
modelNamestringYesModel name
extendedContextEnabledbooleanNoEnable extended context. Default: false

SSE Event Format

Each event is sent as data: {JSON}\n\n.

config event

Sent once at the start of the stream.
data: {"type":"config","payload":{"runId":"clxyz...","modelName":"gpt-5-mini-2025-08-07","locale":"en","inputText":"..."}}

delta event

Sent each time the agent generates text.
data: {"type":"delta","payload":{"runId":"clxyz...","deltaText":"Generated text","responseText":"Full text so far","stepIndex":0,"modelId":"gpt-5-mini-2025-08-07","provider":"openai"}}

step event

Sent when an execution step completes.
data: {"type":"step","payload":{"runId":"clxyz...","stepIndex":0,"status":"complete","finishReason":"stop","usage":{"inputTokens":1234,"outputTokens":567}}}

browse events

When the browse tool is selected, browser automation progress is streamed as events.
data: {"type":"browse-start","payload":{"runId":"clxyz...","websocketInfo":{"session_id":"browser-session-id","user_id":"user-id","ws_url":"wss://...","token":"..."}}}
data: {"type":"browse-step","payload":{"runId":"clxyz...","stepIndex":1,"action":"click","screenshot":"..."}}
data: {"type":"browse-ask-human","payload":{"runId":"clxyz...","status":"pending","question":"Which menu should I open?"}}
data: {"type":"browse-final","payload":{"runId":"clxyz...","result":"Collected information..."}}
data: {"type":"browse-end","payload":{"runId":"clxyz..."}}
When you receive browse-ask-human, answer through /browser/answer-question using browse-start.payload.websocketInfo.session_id as sessionId. Unlike plan/report/matrix reviews, you do not call /agent/run/stream/{runId} after answering a browser question.

complete event

Sent when the agent finishes. This is the final event in the stream.
data: {"type":"complete","payload":{"runId":"clxyz...","text":"Final response text","finishReason":"stop","status":"completed","model":{"id":"gpt-5-mini-2025-08-07","provider":"openai"}}}

error event

Sent when an error occurs.
data: {"type":"error","payload":{"message":"Error message"}}

Additional internal events

The SSE stream emits every internal event as the agent progresses. In addition to the basic events above (config / delta / step / browse-* / complete / error), the following are also streamed:
CategoryEvent types
Plan (HITL)plan, plan-draft-delta, plan-draft-complete, plan-confirmed, plan-rejected
Report structure (HITL)report-structure-draft-delta, report-structure-draft-complete, report_structure_confirmed, report_structure_rejected
Matrix (HITL)matrix-structure-draft-delta, matrix-structure-draft-complete, matrix-data-preview, matrix-data-updated, matrix_structure_confirmed, matrix_structure_rejected
Source summarizationsource-summary-start, source-summary-delta, source-summary-item, source-summary-complete
Graph extractiongraph-start, graph, graph-extraction-entity-delta
Recovering a dropped stream: every event sent over SSE is also persisted as agentRun.process in the database. If your SSE connection drops, call GET /turn/listturns[].agentRun.process returns the same event timeline, and referenced sources are available in turns[].agentRun.publicSourceAgentRuns / privateSourceAgentRuns.

Examples

curl -N -X POST "https://app.snorbe.deskrex.ai/api/v1/agent/run/stream" \
  -H "Authorization: Bearer snorbe_your_api_key_here" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{
    "modelName": "gpt-5-mini-2025-08-07",
    "inputText": "Research the latest AI agent papers",
    "promptKey": "chat-routing",
    "locale": "en"
  }'

Resume Example

# Resume after HITL confirmation
curl -N -X POST "https://app.snorbe.deskrex.ai/api/v1/agent/run/stream/clxxx123" \
  -H "Authorization: Bearer snorbe_your_api_key_here" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{"modelName":"gpt-5-mini-2025-08-07"}'

Error Responses

If an error occurs before the stream starts, a regular JSON response is returned instead of SSE.
HTTP StatusDescription
401Invalid API key
400Validation error
404Agent run not found for the given runId (resume only)