The endpoint
RunAgentInput and reads a stream of AG-UI events back. Every AG-UI run streams.
Every call carries an API key as a bearer token:
Call it
- TypeScript
- curl
With the official client, The client checks every event against the AG-UI schema and its ordering rules, and fails the run if one breaks them.
@ag-ui/client:agui.ts
The request
ARunAgentInput, at most 1 MB.
The conversation. It is your agent’s session: the same thread reaches the same running instance, so your agent remembers. 1 to 256 characters. Left out, Onecortex generates one.
The conversation as the client holds it. The text of the last
user message is your agent’s prompt, and the whole list reaches your agent as messages, each as { "role": "...", "content": "..." } with text parts joined. A run with no user message and no resume is refused with 400 before your agent is called: Send at least one user message, or a resume to answer a paused run.The answer to a run that ended with an interrupt. See Pauses.
Reach your agent unchanged, as
params, with any other field the client sends. Onecortex does not run a front end’s tools or read its state: your agent decides what they mean. Each framework page says where params arrive in your code.The events
Each line is an unnameddata: frame holding one AG-UI event. While your agent is silent, a : ping comment arrives every 15 seconds, which AG-UI clients ignore.
What your agent reports depends on its framework: see Streaming. Anything still open when the run ends, a message, a tool call or a step, is closed before
RUN_FINISHED.
Pauses
A run your agent pauses for a person, as in Human in the loop, ends withRUN_FINISHED whose outcome lists the interrupts:
reason carries input_required, because AG-UI requires one.
To continue, run again on the same threadId with a resume that answers every interrupt:
resume with RUN_ERROR and VALIDATION_ERROR: This agent does not pause for input, so there is nothing to resume.
Errors
A refusal before the stream starts, such as a missing key, another organization’s agent or a rate limit, is an HTTP error with the same JSON body and status as the invoke API, which AG-UI clients report as a failed run. See Errors. A failure after the stream starts is aRUN_ERROR event, with the message from Errors and one of these codes: