产品介绍

AG-UI integration

Send a conversation turn to DataAgent and read its AG-UI event stream. Start the control plane using the quick start and check that GET /ready returns 200. The examples use the default address, http://127.0.0.1:8790.

See the REST API reference for routes and status codes, and its conversation section for request fields, events, and resumption rules.

Request

Send one new user message to POST /api/v1/runs. The server loads conversation history for the given threadId.

curl --no-buffer --include \
  --header 'Content-Type: application/json' \
  --data-binary @- http://127.0.0.1:8790/api/v1/runs <<'JSON'
{
  "threadId": "thread-001",
  "runId": "run-001",
  "messages": [
    {"id": "msg-001", "role": "user", "content": "Reply with a short greeting."}
  ],
  "tools": [],
  "context": [],
  "forwardedProps": {}
}
JSON

Use fresh run and message IDs when repeating the example. See the request contract for field constraints.

Verify the response

The terminal should show HTTP 200 and Content-Type: text/event-stream. This excerpt shows the start and end frames. The stream also includes events such as text and message snapshots.

data: {"type":"RUN_STARTED","threadId":"thread-001","runId":"run-001"}

data: {"type":"RUN_FINISHED","threadId":"thread-001","runId":"run-001","metadata":{"status":"completed","durationMs":650}}

completed means the run finished. Read the final MESSAGES_SNAPSHOT for the complete messages. waiting_for_input means the run needs a human answer. RUN_ERROR ends a failed or cancelled run.

Cancel and resume

To stop the active run, send the following request from another terminal while the stream is open.

curl --include --request POST http://127.0.0.1:8790/api/v1/runs/run-001/cancel

For the next question, keep threadId, use fresh run and message IDs, and send the new message. To reload conversation history before continuing, use the session details endpoint. When DataAgent pauses for human input, follow the human feedback contract to submit answers.

Events

Use text and tool events for live progress. An explicit cancel produces RUN_ERROR with code CANCELLED. See the terminal event reference for handling every outcome. If the server rejects the request before SSE begins, read the REST error response.