Once an agent exists and Who may run it allows your caller, you can run it from your app with the SDK or plain HTTP.
Your servers can run any agent with a secret key. A browser can run an agent only when its Who may run it rule allows the signed-in user (or anyone). See Create an agent.

List the agents you can run

You only see agents that are switched on and that you are allowed to run.

Ask it something

The call waits until the agent has finished (or is waiting for approval). A run has:

Continue a conversation

Pass the thread of an earlier run to carry on, so the agent remembers what was said.
A thread remembers its most recent messages. Start a new thread for a new topic.

Stream each step

Show the answer as it is written, and show what the agent is doing:
The events you can expect: A failure ends the stream with an error.

Don’t wait: run in the background

For long jobs, start the run and come back to it:
You can also look at a run with get(id), or have a flow start when it finishes, so you never poll.

Approve or decline what it asks

When status is waiting, pending lists what the agent wants to do. Show it to the right person, then decide:
decisions is a yes or no for each waiting call by its id, and approve answers any you did not name. Approving carries the run on; declining tells the agent no. Only the person who started the run, or someone allowed by the agent’s approval rule, can decide.

Over HTTP

Add "stream": true for server-sent events, "background": true to return at once, and "thread": "<id>" to continue a conversation. Read a run with GET /ai/v1/agent-runs/<id> and decide it with POST /ai/v1/agent-runs/<id>/decide.

Errors