Skip to main content
Create a conversation with a question, start an agent run, and follow the execution to its result.

Before you start

You need curl, jq, an API credential, 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 ENVIRONMENT_ID to that environment’s UUID. Replace the project reference in the examples if you use another project.

1. Store the question

Call POST /conversations with an initial user message:
create-conversation.sh
The response contains the conversation ID. The message is stored, but the agent has not executed yet.

2. Start the run

Set the environment ID, then call POST /runs. The run reads its input from the conversation’s stored messages.
start-agent.sh
Expect HTTP 202 and accepted: true. Keep RUN_ID for subsequent requests. Acceptance does not mean execution has finished.

3. Follow progress

Call GET /runs/{run_id}/stream to replay and follow the run’s events:
follow-run.sh
If the connection drops, reconnect with Last-Event-ID set to the last received SSE event ID. Do not create another run merely to reconnect.

4. Read the result

Call GET /runs/{run_id}:
read-run.sh
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

Use POST /runs/{run_id}/cancel if you need to stop an active run, then read its status again:
cancel-run.sh

API references