How webhook mode works
- Start the agent — Your service calls the execution API a single time to start the workflow (a “start-only” execute that returns
task_idwithout subscribing to SSE). Storetask_id(and any correlation ids you need). - Receive run updates — In Sudoiq, configure your webhook URL. The platform POSTs a JSON body to that URL whenever the run state changes. Each payload should parse to
AgentGraphRunStatusResponse(or the equivalent model fromasapi). Inspectstatusfor the current phase (for example completed, terminal failure, or awaiting_tool_calls). - Handle tool calls — When
statusisawaiting_tool_calls, the model has requested tools your process must execute. Run your handlers, then callsend_tool_responseswith the sameagent_idandtask_idso the run can continue; you may receive another webhook on the next pause or when the run finishes.
get_agent_task_status in a loop; rely on deliveries to your webhook (retries and idempotency are covered under Operational notes).
Start a run (then wait for callbacks)
Use the SDK method that starts a workflow run and returnstask_id without opening a streaming connection. The exact symbol ships with your asapi release (often a “start only” execute variant).
Python
Until your SDK exposes
start_agent_run, use the start-only execute method documented in the installed asapi package (same HTTP call as streaming start, without subscribing to the event stream).Webhook handler: tools and completion
The sameprocess_webhook_tools and send_tool_responses helpers power tool rounds; only delivery differs from the streaming path.
Python
Operational notes
- Persistence — Store
task_id, tenant, and correlation ids when you start the run. - Idempotency — Providers may retry deliveries; design handlers to tolerate duplicates where possible.
- Out of scope — These docs do not show
while-loop status polling in application code.