Before you start
You needcurl, jq, uuidgen, an API credential with permission to create and read runs, and a runnable project agent. This example uses triage-agent in support-assistant.
Create the agent and deploy its project to an available environment first. Set PROJECT_ID to the project’s UUID and ENVIRONMENT_ID to that environment’s UUID. Replace the project reference in the examples if you use another project.
1. Store the question
CallPOST /conversations with an initial user message:
create-conversation.sh
2. Start the run
Set the environment ID, then callPOST /runs. The run reads its input from the conversation’s stored messages.
start-agent.sh
id. Keep RUN_ID for subsequent requests. Acceptance does not mean execution has finished.
Reuse the same idempotency key and request body when retrying this creation request. Use a new key for a separate run. A credential without read access receives only run_id and status; use a credential with read access for this walkthrough.
3. Follow progress
CallGET /runs/{run_id}/stream to replay and follow the run’s events:
follow-run.sh
Last-Event-ID set to the last received SSE event ID. Do not create another run merely to reconnect.
4. Read the result
CallGET /runs/{run_id}:
read-run.sh
status is pending or running. A completed run has status: "completed". Inspect output and the associated conversation messages to verify the response. For a failed run, inspect error and its events.
A waiting run needs the input or resume condition recorded for it. See run lifecycle before submitting a response or resuming execution.
Cancel active work
UsePOST /runs/{run_id}/cancel if you need to stop an active run, then read its status again:
cancel-run.sh
API references
- Create a conversation, create a run, and read a run.
- Execution GraphQL operations and MCP tools expose their supported execution operations.