Agent runtime
A Console agent is more than one request and one answer. Behind Build → Agents sits a runtime that keeps a conversation as a session, writes everything that happens in it to an event log, can pause for a person, stop at a budget, hold files in a bucket you choose, run in the background, and tell your own systems about it with signed webhooks.
This section documents that runtime end to end: what each part is, where its switches are in Studio, what the client API looks like, and what the errors mean. Every claim here comes from the control plane's code; where an older document and the code disagreed, the code won.
Two ways to read this section
Operators and agent authors want the Guide pages — the Studio click-path, every setting with its default, and what it changes. Integrators want the API pages (Agent sessions, Webhooks, Agents). Each Guide page carries the same calls as curl and as @cognipeer/console-sdk so you can copy either.
The pieces
| Concept | What it is | Page |
|---|---|---|
| Session | One conversation with an agent: its messages, files, spend and what it is doing now. The {id} in resp_{id} is the session id. | Sessions |
| Turn | One user message and everything the agent does until it answers or stops. | Session events |
| Event log | An append-only record of every turn: messages, tool calls, requests for a person, spend. Readable afterwards or followed live. | Session events |
| Action | A request that pauses a turn until someone answers it: a tool approval, a question, or a tool that runs in the host page. | Approvals & questions |
| Session budget | A cap on what the whole session may spend, with a choice between pause and stop. | Session budgets |
| Session file | A document or image attached to a session, stored in a Document Store bucket you chose. | Session files |
| Run | A turn that was queued with background: true instead of holding the HTTP call open. | Background runs |
| Webhook | A signed, retried HTTP call from Console to your URL when something above happens. | Webhooks |
| Sub-agent | A second agent loop a turn hands a task to, with its own prompt, tools and model, that sends back one result. | Delegation (sub-agents) |
| Template | A ready-made agent from the catalog of 25 that becomes an editable draft in your project. | Agent templates |
| Channel | A Slack app or Teams bot that lets people talk to one published agent where they already work (Enterprise). | Slack and Microsoft Teams channels |
| Feedback | What a chat surface (a portal, an embedded widget, your own client) builds on an agent: thumbs, titles, regenerate and edit. | Feedback & message actions |
┌─────────────── session ───────────────┐
user message ─► turn ──┤ event log (every step, 30 days) │──► SSE / poll
│ │ files (your bucket) │
│ │ budget (pause / stop) │
│ └───────────────────────────────────────┘
│
├─► tool needs approval / agent asks a question
│ └─► requires_action ──► person answers ──► turn carries on
│
├─► session budget reached ──► budget_paused ──► raise it ──► turn carries on
│
└─► end_turn / limit / cancelled / error ──► idle
│
└──► webhooks: session.idled, action.required, budget.reached, agent_run.*, …A turn that pauses is not lost. Whether it waited for a person or for a budget, the same turn carries on from where it stopped when the request is answered.
Where the switches are
Open Build → Agents, then an agent. Its tabs are Overview, Sessions, Build, Ship, Feedback and Usage. The runtime's settings live in the Build tab, as sections of one page that one Save Configuration button writes.
| Build section | What it controls | Stored as | Takes effect |
|---|---|---|---|
| Callback | Where the result of an async run is POSTed when the request names no URL of its own | config.callback | With the version that runs |
| Session budget | What a whole session may spend, pause or stop, and whether API clients may change it | config.budget | With the version that runs |
| Variables | Named, typed values a caller sends next to the message, for calls from code and triggers, not for chat; see Variables | config.variables | With the version that runs |
| Files | Whether people can attach files, which bucket, limits, how images are read | config.attachments | With the version that runs: the draft in Studio, the published version for API and portal traffic |
| Approvals & questions | Tool approvals, questions, timeouts, who may answer | config.humanInTheLoop | Same — publish again for API and portal traffic |
Draft versus published
The runs API, the Responses and chat completions endpoints, A2A and portals run the published version of an agent (the draft only if it was never published); the Studio playground runs the draft. Send version to pin a version, or "version": "draft" to run the draft from the API. Files, approvals, budget and experience settings travel with the version, so a change you save in Build reaches API and portal callers only after you publish again. See Build and publish an agent for the publish flow.
New agents do not have to start empty: pick one of 25 ready-made agents in Agent templates, and split work across sub-agents when a task needs its own prompt, tools or model.
There are no per-agent execution settings any more: how long a call waits, how long a run may last and how many may be active are operator settings, see Background runs. Calling agents from other systems, with copy-paste examples for Open WebUI, n8n, the OpenAI SDK, CI pipelines and triggers, is in Agent integrations.
Two places live outside the agent page:
- Build → Agents → Webhooks (
/dashboard/agents/webhooks) manages webhook endpoints. They belong to a project or the whole tenant, not to one agent. - Data → Document Store holds the buckets that session files are stored in, and Model Hub holds the input types that decide whether a model is shown images.
Conventions the client API follows
| Convention | Detail |
|---|---|
| Base path and auth | https://<your-host>/api/client/v1 with Authorization: Bearer cpeer_…. A token sees only its own project. |
| Field names | The agent family — Responses, runs, sessions, events, actions, session files — is snake_case (stop_reason, required_action, max_cost_usd). Webhook endpoint objects and webhook event payloads are camelCase (projectId, conversationId). The dashboard's own /api/… routes are camelCase. Tool args and free-form answers are never re-keyed. |
| Identifiers | Run run_{id}, response resp_{runId} (the same run; older resp_{conversationId} ids still work), action act_{id}, webhook event evt_{id}, webhook secret whsec_…. A session's id is the bare conversation id, with no prefix. |
| Errors | { "error": { "type": "…", "code": "…", "message": "…" } } on the runs API and the sessions routes, with extra snake_case fields where they help (pending_action_ids, spent_usd, max_cost_usd, action_status). The OpenAI endpoints answer the OpenAI envelope (message, type, param, code); A2A answers JSON-RPC errors. |
| Unknown values | New event types, stop reasons and webhook events can appear in later releases. Ignore the ones you do not know. |
The same engine behind every door
The runs API, POST /responses, POST /chat/completions and A2A all start the same run. POST /agents/responses stays as an agents-only alias of POST /responses. See Calling agents from other systems.
Statuses at a glance
| Where | Values | Meaning |
|---|---|---|
Session runtime_status | idle, running, requires_action, budget_paused | What the session is doing now. idle includes a session that has never run. |
Session / event stop_reason | end_turn, requires_action, limit, cancelled, error, budget_reached | Why the last turn stopped. |
Response status | queued, in_progress, completed, incomplete, failed, cancelled, requires_action | queued and in_progress come with a 202. incomplete = a limit or the session budget ended the turn before a final answer. A Responses stop_reason of a normal answer is completed; the session's is end_turn. |
Run status | scheduled, queued, running, requires_action, succeeded, failed, canceled | scheduled has a future start. requires_action is non-terminal and waits for a person. |
Pending action status | pending, resolved, expired, cancelled | An action is answered at most once. |
Defaults and limits
| What | Value | Where to change it |
|---|---|---|
| Session events kept | 30 days | AGENT_SESSION_EVENT_RETENTION_DAYS |
Event data size | 16 KB, then truncated with _truncated: true | — |
| Wait window of a synchronous call | 600 s, then 202 and the run continues | AGENT_SYNC_TIMEOUT_MS |
| Run ceiling (any run) | 30 min | AGENT_BACKGROUND_MAX_DURATION_MS |
| Active default-class runs per tenant | 250 (inline, queued and running) | AGENT_RUN_MAX_ACTIVE_PER_TENANT |
| Deferred runs | 2 running, 10 000 queued, wait up to 24 h | AGENT_DEFERRED_*, see Run classes |
| Runs kept | 30 days | AGENT_RUN_RETENTION_DAYS |
| Approval waits | 1440 min (a day), 0 = never | Approvals & questions |
| Session files | 10 per session, 20 MB each, kept 30 days; agent-created files 10 per turn, 2 MB each | Files |
| Webhook delivery | 8 attempts over about two days, 10 s timeout | Environment, see Webhooks |
| Webhook endpoints | 50 per tenant | — |
What's new
The agent platform release adds the runs API, triggers (schedule, once, manual and webhook) and run classes, complete Responses, chat-completions and A2A dialects (streaming, structured output, variables, cancel) and agent file outputs, and removes the Execution settings, agent schedules and the Assistants adapter. See Calling agents from other systems and the release notes.
The earlier agent runtime release (October 2026) added, in one go:
- the session event log with a poll endpoint and a resumable Server-Sent-Events stream, and a live Activity tab in Studio;
- human in the loop: tool approvals, questions to the user, tools that run in the embedding page, a
requires_actionResponses status, andinput-requiredover A2A; - session budgets with pause and stop, client overrides, and tenant spend limits that now count agent spend;
- webhooks under Build → Agents → Webhooks, with signing, retries, redelivery and secret rotation;
- session files stored in a bucket of your project, images that travel by reference, and a
view_imagetool; - the sessions API: create an empty session, upload, ask, list, delete — and
session_idon the Responses API; - model input types in the Model Hub, so an image is only sent to a model that reads images;
- a
snake_caseclient wire for everything in the agent family, and a rewritten OpenAPI specification.
An agent that uses none of it behaves as before: without approvals it never pauses, without a budget it never stops on one, and without a bucket it takes no attachments. The one thing to check is a client that sends input_file or input_image parts by habit — those used to be ignored and are now either used or refused, see Session files.

