Agents
An agent is instructions, a model and tools. A tool is one of your workflows, or a function in the agent's own code.
Define an agent
Deploy an agent with PUT /v1/agents/:agent, from a project with shiftlabs deploy, or from a template on the dashboard's Agents screen. Each deploy adds a version and makes it current.
Agents are on in a new workspace. An admin can turn them off.
# Deploy the agent (developer key). Answers {"name", "version", "warnings"}.
# Deploy each tool's workflow first.
curl -X PUT https://api.shiftlabs.org/v1/agents/billing \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"title": "Billing assistant",
"instructions": "Answer questions about invoices. Look them up first.",
"model": "@cf/zai-org/glm-4.7-flash",
"tools": [{
"workflow": "lookup-invoice",
"description": "Look up an invoice by its id.",
"parameters": {
"type": "object",
"properties": {"invoice": {"type": "string"}},
"required": ["invoice"]
},
"approval": "never"
}]
}'
title1 to 80 characters, shown in the dashboard.
descriptionWhat the agent does, up to 300 characters, shown in the dashboard's list of agents. Optional.
instructionsWhat the agent is for and how it works, 1 to 8,000 characters. In a project,
file("./x.md")keeps them in a file.modelA model id from Models, or
<provider>/<model>on your own provider key. Default@cf/zai-org/glm-4.7-flash.fallbackUp to 3 more model ids, tried in order when a request to
modelfails before it answers. None may be of a lower tier thanmodel. Left out, the platform picks one;[]means none. On your own provider key, only that provider's models, and the platform picks none.providerKeyThe workspace secret holding your API key with the provider of a
modelon your own provider key, by name. Pro only.maxTurnsModel turns one message may take, 1 to 20. Default 6.
budget{conversationUsd, monthlyUsd, endUserDailyUsd}: what the agent may spend, and what each end user may spend with it in a day. See Budgets.access{role, members}: who may message the agent. See Access.welcomeShown in the dashboard's chat before the first message, up to 500 characters. Optional.
suggestionsUp to 4 first messages, each up to 200 characters, offered in the dashboard's chat. Choosing one sends it.
toolsUp to 16 workflow tools, counting the tools in the agent's code.
codeThe
codeHashof the agent's code. Every tool in the code joins the agent.
import { agent, file, project, workflowTool } from "shiftlabs";
export default project({
workflows: { "stripe-refund": "./workflows/stripe-refund.ts" },
agents: {
"invoice-assistant": agent({
title: "Invoice assistant",
description: "Answers billing questions and issues refunds.",
instructions: file("./agents/invoice-assistant.md"),
model: "@cf/zai-org/glm-4.7-flash",
tools: [
workflowTool("stripe-refund", {
description: "Refund an invoice.",
approval: "always",
}),
],
budget: { conversationUsd: 0.5, monthlyUsd: 20, endUserDailyUsd: 0.25 },
access: { role: "developer", members: ["ana@acme.com"] },
welcome: "Ask me about an invoice.",
suggestions: ["Why was I charged twice?", "Refund invoice in_123"],
}),
},
});
An agent's name is 2 to 48 lowercase letters, digits and hyphens, and starts with a letter. shiftlabs is taken by the helper, and shiftlabs-draft by the workflow editor's AI drafts: PUT /v1/agents/:agent, PUT /v1/agents/:agent/code, a release, a rollback and a promotion that use either return 400.
A bad field, a workflow tool without approval, or a tool whose workflow doesn't exist, returns 400 {"error": "invalid definition", "detail"}. For a model id agents can't use, the detail lists the ones they can. A model your plan doesn't include returns 403 {"error": "plan", "detail"}. A new agent past your plan's limit returns 403 {"error": "quota exceeded", "limit": "agents", "max"}.
Models
Free workspaces use the small models. Pro workspaces use every model below, and models on your own provider key. A model's tier is its answer quality, from 1 to 5. Prices are in US dollars per million tokens. Each response's tokens, at the prices of the model that answered, count toward the agent's budgets and the workspace's model allowance.
| Model | Tier | Input | Output |
|---|---|---|---|
@cf/google/gemma-4-26b-a4b-it | 4 | $0.10 | $0.30 |
@cf/ibm-granite/granite-4.0-h-micro | 1 | $0.017 | $0.112 |
@cf/meta/llama-3.1-8b-instruct-fp8-fast | 2 | $0.045 | $0.384 |
@cf/meta/llama-3.2-1b-instruct | 1 | $0.027 | $0.201 |
@cf/meta/llama-3.2-3b-instruct | 1 | $0.051 | $0.335 |
@cf/mistral/mistral-7b-instruct-v0.1 retired by Workers AI on 2026-05-30 | 1 | $0.11 | $0.19 |
@cf/qwen/qwen3-30b-a3b-fp8 | 4 | $0.051 | $0.335 |
@cf/zai-org/glm-4.7-flash | 4 | $0.06 | $0.40 |
| Model | Tier | Input | Output |
|---|---|---|---|
@cf/aisingapore/gemma-sea-lion-v4-27b-it | 3 | $0.351 | $0.555 |
@cf/deepseek-ai/deepseek-r1-distill-qwen-32b | 3 | $0.497 | $4.881 |
@cf/deepseek-ai/deepseek-v4-flash-0731 cached input $0.014 | 5 | $0.44 | $1.32 |
@cf/deepseek-ai/deepseek-v4-pro-0813 cached input $0.044 | 5 | $1.32 | $3.96 |
@cf/deepseek-ai/deepseek-v4.1-flash-1017 cached input $0.006 | 5 | $0.30 | $1.20 |
@cf/google/gemma-3-12b-it retired by Workers AI on 2026-05-30 | 2 | $0.345 | $0.556 |
@cf/meta/llama-2-7b-chat-fp16 retired by Workers AI on 2026-05-30 | 1 | $0.556 | $6.667 |
@cf/meta/llama-3-8b-instruct retired by Workers AI on 2026-05-30 | 2 | $0.282 | $0.827 |
@cf/meta/llama-3-8b-instruct-awq retired by Workers AI on 2026-05-30 | 2 | $0.123 | $0.266 |
@cf/meta/llama-3.1-70b-instruct-fp8-fast | 3 | $0.293 | $2.253 |
@cf/meta/llama-3.1-8b-instruct retired by Workers AI on 2026-05-30 | 2 | $0.282 | $0.827 |
@cf/meta/llama-3.1-8b-instruct-awq retired by Workers AI on 2026-05-30 | 2 | $0.123 | $0.266 |
@cf/meta/llama-3.1-8b-instruct-fp8 | 2 | $0.152 | $0.287 |
@cf/meta/llama-3.2-11b-vision-instruct | 2 | $0.049 | $0.676 |
@cf/meta/llama-3.3-70b-instruct-fp8-fast | 3 | $0.293 | $2.253 |
@cf/meta/llama-4-scout-17b-16e-instruct | 3 | $0.27 | $0.85 |
@cf/mistralai/mistral-small-3.1-24b-instruct | 3 | $0.351 | $0.555 |
@cf/moonshotai/kimi-k2.5 cached input $0.10; retired by Workers AI on 2026-05-30; served by @cf/moonshotai/kimi-k2.6 at its price | 5 | $0.60 | $3.00 |
@cf/moonshotai/kimi-k2.6 cached input $0.16 | 5 | $0.95 | $4.00 |
@cf/moonshotai/kimi-k2.7-code cached input $0.19 | 4 | $0.95 | $4.00 |
@cf/nvidia/nemotron-3-120b-a12b | 4 | $0.50 | $1.50 |
@cf/openai/gpt-oss-120b | 4 | $0.35 | $0.75 |
@cf/openai/gpt-oss-20b | 4 | $0.20 | $0.30 |
@cf/qwen/qwen2.5-coder-32b-instruct | 3 | $0.66 | $1.00 |
@cf/qwen/qwen3.8-27b | 5 | $0.45 | $3.20 |
@cf/qwen/qwq-32b | 3 | $0.66 | $1.00 |
@cf/zai-org/glm-5.2 cached input $0.26 | 5 | $1.40 | $4.40 |
@cf/zai-org/glm-5.3 cached input $0.26 | 5 | $1.40 | $4.40 |
@cf/zai-org/glm-5.3-flash cached input $0.03 | 5 | $0.15 | $0.50 |
- Any other model id returns
400, unless it is a model on your own provider key. - A fallback must be the same tier as
modelor higher, so a failing model never lowers the quality of answers. A fallback of a lower tier returns400. - Without
fallback, the platform picks one at each deploy: of the models still served at the lowest tier at or above that ofmodel, the one closest in price. For a small model it picks a small model. Once an earlier pick has retired, deploying the same definition picks another and adds a version. - When a fallback answers, the conversation's
modelitem names it with"fallback": true, and the dashboard's trace marks it. - When Workers AI retires a model, the table above notes the date. A deploy or release naming a model or fallback that retires within 30 days goes ahead, with a sentence for each in
warningsthatshiftlabs deployprints. Naming a retired one returns400, or409for a rollback, with its successor or the models still served. - After its model retires, a conversation is answered by the successor Workers AI named, else by the agent's first fallback still served, else by a model the platform picks by the rule above. That model's price applies: a Kimi K2.5 conversation now costs Kimi K2.6's. Its budgets run out sooner. Its
modelitems carry"retired", the date, and the dashboard's trace says so. A retired fallback gives way to its successor, or is skipped. Deploy the agent with another model to choose for yourself. - In a Free workspace, deploying, releasing or messaging an agent on a Pro model returns
403 {"error": "plan", "detail"}. An agent on a Pro model stops taking messages when its workspace moves back to Free.
Your own provider key
On Pro, an agent can run on another provider's model, on your account with that provider. Your provider bills you for it, and shiftlabs doesn't. Store your API key with the provider as a workspace secret, then name the model <provider>/<model> and the secret providerKey.
# Store the key (admin key). Leave it not readable: no workflow can read it.
curl -X PUT https://api.shiftlabs.org/v1/secrets/OPENAI_API_KEY \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"value": "<your OpenAI API key>"}'
# Deploy the agent on it (developer key).
curl -X PUT https://api.shiftlabs.org/v1/agents/billing \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"title": "Billing assistant",
"instructions": "Answer questions about invoices.",
"model": "openai/gpt-4.1-mini",
"fallback": ["openai/gpt-4.1"],
"providerKey": "OPENAI_API_KEY"
}'
- The provider is one of
anthropic,baseten,cerebras,cohere,deepseek,google-ai-studio,google-vertex-ai,grok,groq,mistral,openai,parallel,perplexityandworkers-ai. The model is the provider's own name for it, as Cloudflare AI Gateway's OpenAI-compatible endpoint takes it, such asanthropic/claude-sonnet-4-5orgoogle-ai-studio/gemini-2.5-flash. shiftlabs doesn't check the model: one the provider doesn't serve fails the turn with the provider's error. - The request goes from shiftlabs to AI Gateway, then to the provider. Your key is read from the secret for each request, inside shiftlabs, and sent only in that request's
Authorizationheader. It never reaches your workflows, code tools, the model, the transcript, logs, errors or the dashboard. Each use is written to the audit log, on the Audit screen and at/v1/audit, asprovider_keywith the agent and the model. - The secret must not be
readable, since a readable secret reaches workflow code. A deploy doesn't check the secret: a message checks it. - Your provider bills each response. Its
modelitem reads"byok": trueand"costUsd": 0, and the dashboard's trace marks ityour key. It counts toward no budget, and toward neither the $2 of model use per month nor model use on your bill. Its tokens count toward the model tokens per 24 hours. - A fallback must be another model of the same provider, and is asked on the same key. The platform picks none, and never a model it pays for.
- Tool calls work as they do on the platform's models. How well a model uses them is up to the model.
- In a Free workspace, deploying, releasing or messaging an agent on your own key returns
403 {"error": "plan", "detail"}. It stops taking messages when its workspace moves back to Free. - A request that can't use the key ends the turn as
failedat once, without a fallback or a retry, and costs nothing. Itserroritem names the secret, never the key. See below. - An end user reads only
The agent could not answer: the model request failed., without the secret's name. - Of each request, AI Gateway keeps what it keeps of the platform's models. See Conversations.
Such an error item reads The agent could not answer: its provider key, the secret OPENAI_API_KEY, and goes on with one of these.
isn't in the workspace. An admin must add it, or restore it from the trash.No secret has that name, or it is in the trash.
can be read by workflow code, which a provider key must not be. An admin must turn off readable on it.The secret is
readable.has spaces, line breaks or other characters no key has. An admin must set it again.The value holds a character no header can carry.
was refused by openai. An admin must replace its value.The provider answered
401or403, or AI Gateway found no key in the request it takes for the provider.is over openai's limits or out of credit. Try again later, or raise the limits with openai.The provider answered
429.
Workflow tools
A workflow tool runs one of your workflows. The model's arguments, checked against parameters, are the run's payload. Arguments over 1 MiB as JSON fail the call without starting a run, and the model reads why. In a project, workflowTool(workflow, {...}) defines one.
import { agent, project, workflowTool } from "shiftlabs";
import * as z from "zod";
export default project({
workflows: { "lookup-invoice": "./workflows/lookup-invoice.ts" },
agents: {
billing: agent({
title: "Billing assistant",
instructions: "Answer questions about invoices. Look them up first.",
model: "@cf/zai-org/glm-4.7-flash",
tools: [
workflowTool("lookup-invoice", {
description: "Look up an invoice by its id.",
parameters: z.object({ invoice: z.string() }),
approval: "never",
}),
],
}),
},
});
workflowThe workflow's name. Deploy the workflow before the agent.
descriptionWhen to use the tool, 1 to 1,024 characters. The model chooses tools by it.
parametersA JSON Schema with
"type": "object", up to 8 KB. Left out, it is the workflow's payload schema as of the agent's deploy, or any object when the workflow has none. A payload schema that isn't an object schema, or is over 8 KB, can't stand in: that deploy returns400and asks forparameters. Inshiftlabs.config.ts, any Standard JSON Schema too, such as a zod 4.2+ schema:shiftlabs deploysends its JSON Schema.approvalRequired: each workflow tool says whether its calls wait for a person.
"never"runs every call at once."always"holds every call until an admin or approver approves it.{"approvers": ["role:admin", "ana@acme.com"]}holds it for those roles and members only: up to 20, eachrole:admin,role:approver,role:manageror the email of a member who is an admin or approver when you deploy. A developer never approves. See Who approves.{"approvals": 2}needs that many different members to approve, 1 to 5, alone or withapprovers; see Two approvers. A tool without it returns400, naming the tool and these choices. Versions deployed before it was required keep the"never"they were stored with, and roll back as they were. The stored definition reads"approval": "always"with the tool'sapproversandapprovalsbeside it, and a deploy takes that shape too.waitSecondsHow long a call waits for the run's output, 5 to 300. Default 60.
- A call starts a run, as run now does. It counts toward runs per 24 hours and runs at once, and it is refused past the spending limit.
- Only someone who may start runs gets workflow tools: developers, admins and keys that hold
run.start. A viewer, or a key whose capabilities leaverun.startout, still talks to the agent, and its code tools still run for them, but the conversations they start have no workflow tools. A conversation keeps the tools it started with and goes by the role of its person's latest message. So in one started before they lostrun.start, each workflow tool call fails withyour role can't start runsfrom their next message on, and no run starts and no approval is asked for. Until that message the agent goes by their earlier role, also in its answer to an approval decided meanwhile, and a call already waiting for approval runs whenever an approver approves it. Conversations of end users and schedules, and a workflow'sstep.ask, keep their workflow tools, though a key's scope still limits them, as below. - The run is listed with your other runs, with origin
agentandorigin_ref<agent>/<conversation id>. - The model reads
Run <id> completed. Output: <JSON>, or the run's error. A run still going afterwaitSecondsgoes on, but its output doesn't reach the conversation. - A readable secret's value in a result is replaced by
[redacted]before the model or the transcript sees it. A result is cut at 16,000 characters. - An API key scoped to some workflows can't give an agent tools outside them. That deploy returns
403. - A key scoped to some workflows gets only those workflows' tools, since it may start only their runs. So do the end users it names with
personor a chat token, the schedules it adds or changes, and a workflow deployed with it when it asks an agent. The conversations they start have no tools for other workflows, and in an older one that still has them, each call of such a tool fails withthis key is limited to other workflows, and no run starts and no approval is asked for. An end user's conversation goes by the key that sent its latest message (a repeat with the sameIdempotency-Keydoesn't count), so one started before 4 November 2026 gets the key's limit from the key's next message on. A scope that names only agents limits no tool, and the key's other limits don't reach its end users: a key withoutrun.startstill gives them every tool its scope allows. - A tool that took its workflow's payload schema keeps it until the agent is deployed again.
shiftlabs deployreleases a project's workflows and agents together, so they stay in step.
Code tools
A code tool is a function in the agent's own TypeScript, defined with its description and parameters by tool({...}, fn). It has no network, no environment and no secrets. It keeps a SQLite database for each person who talks to the agent.
import { tool, tools } from "shiftlabs";
export default tools({
"save-note": tool(
{
description: "Save a note.",
parameters: {
type: "object",
properties: { text: { type: "string" } },
required: ["text"],
},
},
({ text }: { text: string }, { sql }) => {
sql.exec("CREATE TABLE IF NOT EXISTS notes (at INTEGER, text TEXT)");
sql.exec("INSERT INTO notes (at, text) VALUES (?, ?)", Date.now(), text);
return { saved: true };
},
),
"list-notes": tool(
{ description: "List the latest notes." },
(_args, { sql }) => {
sql.exec("CREATE TABLE IF NOT EXISTS notes (at INTEGER, text TEXT)");
return sql
.exec("SELECT at, text FROM notes ORDER BY at DESC LIMIT 20")
.toArray();
},
),
});
import { agent, project } from "shiftlabs";
// shiftlabs deploy uploads the code, then releases the agent with it.
export default project({
agents: {
notes: agent({
title: "Notes",
instructions: "Save notes people give you; read them back when asked.",
model: "@cf/zai-org/glm-4.7-flash",
code: "./agents/notes.tools.ts",
}),
},
});
# Upload the code (developer key).
# Answers {"codeHash", "tools", "sizeBytes", "warnings"}.
curl -X PUT https://api.shiftlabs.org/v1/agents/notes/code \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
--data-binary @agents/notes.tools.ts
# Name the hash in the agent's next version. Every tool in the code joins it.
curl -X PUT https://api.shiftlabs.org/v1/agents/notes \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"title": "Notes",
"instructions": "Save notes people give you; read them back when asked.",
"model": "@cf/zai-org/glm-4.7-flash",
"code": "<codeHash>"
}'
descriptionWhen to use the tool, 1 to 1,024 characters. The model chooses tools by it. Required.
parametersA JSON Schema with
"type": "object", up to 8 KB. Default: any object. The upload converts a Standard JSON Schema to JSON Schema.waitSecondsHow long a call waits for the function, 5 to 300. Default 60.
- The code is bundled and scanned like a workflow, 512 KiB at most, and a new upload counts toward new versions per 24 hours. Its default export must be
tools({...}), with atool(...)under each name. Names are lowercase letters, digits and hyphens. - The upload reads each tool's description and parameters. A tool with no description or no function, a bad name or parameters that aren't an object schema returns
400 {"error": "invalid tool", "detail"}, anddetailnames the tool. Descriptions and parameters together are at most 256 KiB. - The upload loads the code once, with no network, to read them, and so do
PUT /v1/agents/:agentand a release that namecode. Loading may take 60 seconds: past that, the request returns503 {"error": "temporarily unavailable"}with adetailandRetry-After: 30. Nothing changed, so the agent's code and current version stay as they were. Send it again. PUT /v1/agents/:agentand a release that namecodecount toward the 20 deploys a minute, as the upload does. See Rate limits.- Nothing changes until a version names the hash in
code. Then every tool in the code joins the agent, after its workflow tools. A name can't be both a workflow tool and a code tool. An upload that no version names is dropped after a day. - A function gets the model's arguments and
{sql, conversation, log}.sql.exec(query, ...bindings)returns a cursor withtoArray(),one()androwsWritten. The model reads the return value as JSON. - Each person's database is shared by all their conversations with the agent, and a workflow that asks the agent has one for all its runs. Each end user of your app has their own. It is kept until the workspace is deleted, or until the agent is deleted and erased from the trash. Conversations reaching the end of their period don't erase it.
- On paid plans, each person's code runs apart from everyone else's. On Free, everyone in a workspace runs an agent version's code together: a value one person's call keeps outside a function can show up in another person's call, and a call that runs out of CPU time restarts the code for all of them. A value kept outside a function lasts only while the code is loaded. Keep data in
sql, which is each person's own. - A code tool never waits for approval. Calls to other services belong in workflow tools.
- A person's calls run one at a time. A call still waiting for an earlier one when its
waitSecondspass fails without running. - A call gets 2,000 ms of CPU and the tool's
waitSeconds. Past either, that call fails and the code restarts. A call cut off by a platform restart is not run again. - After 3 calls in the workspace are stopped for CPU time in one UTC day, every code tool call fails without running until 00:00 UTC, with
the workspace's agent code was stopped for CPU time 3 times today, so its code tools are off until 00:00 UTC (limit codeStopsPerDay=3). The model reads it and goes on; workflow tools still run. See Limits.
Tool results are data
A tool result can hold text anyone wrote: an email, a ticket, a web page or a record a workflow read. Such text can try to give the model orders. This is called prompt injection.
- The model gets each tool result between
<untrusted_tool_result>tags, with a rule after the agent's instructions: what is inside is data, never instructions. Transcripts, streams and the dashboard show the result without the tags. - This makes injection less likely, but no model is proof against it. Give a tool that changes anything, such as a refund, an email or a deploy,
"approval": "always", so a person sees every call before it runs. See Approvals. - Give the agent only the tools it needs, and put a budget on it.
Conversations
Anyone the agent's access includes can talk to it. A message starts a conversation, and the agent answers in the background. Read the conversation, or stream it to get the answer as it is written.
# Start a conversation (any role).
# Answers 202 {"conversation", "status": "working"}.
curl -X POST https://api.shiftlabs.org/v1/agents/billing/conversations \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"text": "What is the status of invoice in_1QxYzExample?"}'
# Read it until its status is no longer working.
curl https://api.shiftlabs.org/v1/agents/billing/conversations/<conversation> \
-H "authorization: Bearer $SHIFTLABS_API_KEY"
# Send the next message. Answers 202.
curl -X POST \
https://api.shiftlabs.org/v1/agents/billing/conversations/<conversation>/messages \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"text": "When was it paid?"}'
workingThe agent is calling models and tools.
answeredThe agent replied. Send the next message.
waiting for approvalA tool call waits for an approver. See Approvals.
stopped at maxTurnsThe model kept asking for tools past
maxTurns. Send another message to go on.budget reachedThe conversation spent its
budget.conversationUsd. The next message returns409 {"error": "budget reached"}. Start a new conversation.monthly budget reachedThe agent spent its
budget.monthlyUsdfor this UTC month. See Budgets.daily budget reachedThe agent answered, and the conversation's end user has now spent the agent's
budget.endUserDailyUsdfor this UTC day. Their next message, in this conversation or another, returns429until the day ends. See Budgets.allowance reachedThe workspace's model allowance ran out during the turn.
failedA model request failed or sent nothing for 120 seconds, or the turn stopped without an answer. The transcript's
erroritem says why. Send the next message to try again.
- A message is 1 to 4,000 characters. It can't start with
Approval update:, which marks approval answers. - A conversation keeps the agent version it started on. Only the person or API key that started it can add to it.
- A message can carry an
Idempotency-Keyheader, 1 to 255 visible ASCII characters such as a UUID. A repeat with the same key within 24 hours sends the agent nothing and returns the first202 {"conversation", "status"}, withIdempotent-Replayed: true. The same key with another agent, conversation, person or text returns409.shiftlabs/clientand Python'sshiftlabs.clientsend a key with each message, and send it again after a network error, or a503withRetry-Afterof 5 seconds or less. See API. - A workflow's
step.askstarts a conversation the workflow owns. Itspersonisworkflow:<name>, itspersonLabelisworkflow <name>, and itsrunis the run that asked. Nobody can add to it. - A model request that sends nothing for 120 seconds, before or during its answer, ends the turn as
failed, with anerroritem saying the model did not respond for 120 s. It isn't retried, and its unfinished answer costs nothing. Text that keeps arriving is never cut off. - When shiftlabs briefly fails while it takes in a message, it sends the message to the agent again, at most twice, and the agent gets it once. If it still fails, the request returns
503withRetry-After: 1: send it again, with the sameIdempotency-Keyif it had one. A model request that fails because shiftlabs was briefly unavailable is retried twice, 0.5 and 1 second apart. If the last one fails too, the turn ends asfailedwith theerroritemThe agent could not answer: the platform was briefly unavailable. Send the message again., and the failed requests cost nothing. - A turn waits for each tool call at most the tool's
waitSeconds. Past it, a workflow tool's run goes on without the conversation, and a code tool's call fails. A helper tool's call fails after 30 seconds, and the model reads<tool> did not finish within 30 s. - A turn that stops without an answer ends as
failedwithin about 2 minutes, with theerroritemThe agent stopped without an answer. Send the message again.A message sent while it ends isn't processed and gets theerroritemYour message wasn't processed. Send it again. - One model turn calls at most 10 tools on Free and 50 on Pro. The answer stops at the first call past that, which fails without running, with
Tool call limit reached (toolCallsPerTurn 10): this call did not run.The model reads it and goes on. The stopped answer's tokens are estimated from the length of its request and what it wrote, and count toward budgets and the model allowance. GET …/conversationslists your own, newest first, 50 a page (up to 100 withlimit) and the next fromNext-Before, and with?person=an end user's. Developers and admins can list everyone's with?all=1and read any conversation. Lists leave out the conversations workflows started:?workflows=1lists those instead, and?run=<id>one run's. Reading other people's conversations is written to the audit log. A viewer gets403for?all=1,?workflows=1or?run=and404for another person's conversation.- An API key limited to some workflows gets
404for a conversation a workflow it can't reach started. It can't read other people's conversations at all, a schedule's included, because their transcripts and the agent's answers can hold what other workflows returned:?all=1returns403 {"error": "forbidden", "reason": "this key is limited to other agents or workflows"}, and another person's conversation and its stream return404. It still lists and reads its own, its end users' with?person=, and with?workflows=1or?run=those its workflows started. Another person's conversation with the helper needs a key without a scope that holds every developer capability, because its tool output was made with that person's access. Lists leave out what the key can't read, so a page can hold fewer thanlimitwithNext-Beforeset. - A conversation reads
{id, agent, person, personLabel, run, version, status, startedAt, lastAt, costUsd, busy, turns, maxTurns, budgetUsd, items, approvals, lastEventId}.costUsdis its model use (USD).runisnullunless a workflow owns it.budgetUsdis its version'sbudget.conversationUsd.itemsis the transcript:user,assistant,model(the model that gave each response, whether it was a fallback,retiredwhen the agent's model had retired,byokwhen it ran on your own provider key,"finish": "length"when the answer stopped at the model's output limit, its tokens and model use (USD) ascostUsd),tool_call,tool_result,approval_updateanderror.lastEventIdis where its stream stands afteritems. - A conversation also reads
diagnostics: its latest 20 diagnostics and its latest 5tools_failedones, oldest first, each{at, reason, model, toolCalls, toolErrors, toolNames, finish, durationMs, chars, excerpt}.reasonistool_call_limit,model_silent,model_failed,tools_refused,tools_failedorstuck. A failed model request the platform retries has none.modelis the model that served the request.toolNamesnames the first 5 calls, or for a tool round the first 5 that were refused or failed, each cut at 64 characters.finishis how the model ended its answer,nullif it never did.durationMsis how long the request took, or for a tool round its longest call.excerptis the first 1,000 characters of what the model wrote, without its reasoning, or of the calls that failed, with your readable secrets' values replaced. When your secrets couldn't be read,excerptis""andtoolNamesis empty. A chat token doesn't read it. - A conversation is erased 7 days after its last message on Free, and 30 days on Pro. See How long conversations are kept. Of each model request, the AI gateway may keep the model, tokens, cost, status, duration and the workspace, agent and conversation ids for up to 30 days, never the prompt or the answer. See Privacy.
End users
An app built on an agent calls it with one API key for all its users. Give that key agent.chat_as, and it names the user each request is for with person. Each person gets their own conversations, their own code tool database and their own message limit.
# Create the app's key (admin key). agent.chat_as is in no role, so list it.
curl -X POST https://api.shiftlabs.org/v1/api-keys \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "billing-app",
"role": "developer",
"capabilities": ["agent.chat", "agent.chat_as"],
"scope": {"agents": ["billing"]}
}'
# Start a conversation for user_123.
# Answers 202 {"conversation", "status": "working"}.
curl -X POST https://api.shiftlabs.org/v1/agents/billing/conversations \
-H "authorization: Bearer $APP_KEY" -H "content-type: application/json" \
-d '{"text": "Where is my refund?", "person": "user_123"}'
# Read it, list user_123's conversations, and send the next message as user_123.
curl \
"https://api.shiftlabs.org/v1/agents/billing/conversations/<conversation>?person=user_123" \
-H "authorization: Bearer $APP_KEY"
curl \
"https://api.shiftlabs.org/v1/agents/billing/conversations?person=user_123" \
-H "authorization: Bearer $APP_KEY"
curl -X POST \
https://api.shiftlabs.org/v1/agents/billing/conversations/<conversation>/messages \
-H "authorization: Bearer $APP_KEY" -H "content-type: application/json" \
-d '{"text": "Thanks!", "person": "user_123"}'
agent.chat_asis in no role. An admin gives it to a developer or admin key by listing it incapabilities, or on the API keys screen under Limit this key → Only when ticked. Members signed in to the dashboard never hold it.personis 1 to 128 letters, digits and_ - . @ : | + =, such as your app's user id. Send it in the body of aPOSTand as?person=on aGET. A key withoutagent.chat_asgets403with"capability": "agent.chat_as", and a bad name gets400.- The conversation's
personisuser:<person>, and itspersonLabelis the name you sent. Every key in the workspace that names the same person reaches the same conversations, so a new key carries on where an old one stopped. - The dashboard and approval notices show an end user as
<person> (end user), soceo@acme.comfrom your app isn't taken for the memberceo@acme.com. - Without
person, the key is the person, as before. Asuser_123, a key can't read or add to its own conversations, a member's, a workflow's or another person's: they return404. - Each person has their own limit of 10 messages a minute, and every person's messages count toward the workspace's limits. The agent's access is checked against the key.
- A key scoped to some workflows gives the people it names only those workflows' tools: the agent starts no other workflow for them, as the key itself can't. A conversation of theirs from before 4 November 2026 has every tool until the key's next message in it. Its other limits don't reach them.
- Each person may spend the agent's
budget.endUserDailyUsdon model use each UTC day, $0.10 unless the agent says otherwise, all their conversations with it together. Past it, their messages return429 {"error": "daily budget reached", "detail", "endUserDailyUsd", "resetsAt"}until the day ends. See Budgets. - The helper talks only with members and keys, so
personon it returns400. ?person=can't be combined with?all=1,?workflows=1or?run=: that's403withoutconversation.read_othersand400with it. Developers and admins see every person's conversations with?all=1.
Browsers
An API key never goes in a browser. Your server mints a chat token for one person and one agent, and the browser chats with it, from any site. A token lasts at most an hour. With shiftlabs/client, the server mints it with chatTokens.create and the page chats with new Shiftlabs({ chatToken }).
# With the app's key, which holds agent.chat_as.
# Answers 201 {"token", "agent", "person", "expiresAt"}.
curl -X POST https://api.shiftlabs.org/v1/chat-tokens \
-H "authorization: Bearer $APP_KEY" -H "content-type: application/json" \
-d '{"agent": "billing", "person": "user_123", "ttl": "15 minutes"}'
const conversations =
"https://api.shiftlabs.org/v1/agents/billing/conversations";
const headers = {
authorization: `Bearer ${token}`,
"content-type": "application/json",
};
// Start a conversation as user_123,
// then read it until its status is no longer working.
const started = await fetch(conversations, {
method: "POST",
headers,
body: JSON.stringify({ text: "Where is my refund?" }),
});
const { conversation } = await started.json();
const reply = await (
await fetch(`${conversations}/${conversation}`, { headers })
).json();
POST /v1/chat-tokens {"agent", "person", "ttl"?}needs a key withagent.chat_asandagent.chatthat reaches the agent.ttlis milliseconds or a duration such as"15 minutes", from 1 minute to 1 hour, and an hour by default. The helper has no chat tokens.- Send the token as
Authorization: Bearer slc_…. It starts, lists, reads, streams and adds to its person's conversations with its agent, and nothing else. Another agent returns403with"reason": "this chat token is for another agent", any other route403, and another person's conversation404. It never lists everyone's conversations, whatever its key can do. - A token reads what its person may see:
{id, agent, person, personLabel, status, startedAt, lastAt, busy, items, approvals, lastEventId}.itemsholds onlyuserandassistantmessages anderror, what the person is told when the agent couldn't answer, without the model provider's own message.approvalsholds only the requests still waiting. Its stream is the same:user,text,approvalandstatusevents, and a failed status'serrorwithout the provider's message. Tool calls and results, models, model use and budget stay with your key: past the agent's monthly budget a token gets429 {"error": "monthly budget reached"}andRetry-After, without the amount. Past its person's daily budget it gets429 {"error": "daily budget reached", "detail"}andRetry-After:detailis a sentence your page can show the person, without any amount. Lists leave outcostUsd,versionandrun. - After
expiresAta token returns401 {"error": "chat token expired"}: mint a new one. A token also stops working once its key is revoked or expires. - A page on any site can call these routes with a token: their answers carry
Access-Control-Allow-Origin: *, a429included. Answers to API keys don't, so a browser can't use a key. - One person's tokens make at most 120 requests a minute, and all of a workspace's tokens together 1,200. That's apart from the 1,200
/v1calls of your keys and the dashboard, so browsers can't slow down your server's calls. Messages also count toward the person's and the workspace's limits.
Stream a conversation
GET …/conversations/:conversation/stream sends the conversation as it happens, as Server-Sent Events: the agent's text as it is written, its tool calls and their results, approvals and status changes. Anyone who can read the conversation can stream it. Each event is an id and one data: line of JSON with a type.
# Send the next message. Answers 202.
curl -X POST \
https://api.shiftlabs.org/v1/agents/billing/conversations/<conversation>/messages \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"text": "When was it paid?"}'
# Stream the answer.
# -N prints each event as it arrives; the stream ends when the agent is done.
curl -N \
https://api.shiftlabs.org/v1/agents/billing/conversations/<conversation>/stream \
-H "authorization: Bearer $SHIFTLABS_API_KEY"
text{"delta"}: the next piece of the agent's answer.user,approval_update{"text", "at"}: a message in, or the platform's approval update.tool_call,tool_resultAs in the transcript:
{"id", "name", "arguments", "at"}, then{"id", "name", "isError", "text", "at"}.approval{"id", "tool", "status", "requestedAt", "expiresAt", "decidedAt"}: a tool call waits for an approver, or was decided.status{"status", "error"?}: the conversation's status. Onfailed,errorsays why.
- A stream starts with your latest message and the answer so far. Then come the approvals whose answer hasn't reached the conversation yet, and its status.
- It ends after a
statusother thanworking: close your client then, or it reconnects for nothing. Reconnecting with that lastidwhile the conversation is at rest gets204. Open it again after your next message, or once the status isworkingagain, for example after an approval. - Reconnect with the last
idyou got in aLast-Event-IDheader, or as?lastEventId=, and the stream goes on from there without repeating text. A conversation'slastEventIdstreams what came after itsitems. - A browser's
EventSourcecan't send theauthorizationheader. Read the stream withfetch, or an SSE client that sends headers. - A stream also ends after 5 minutes: reconnect to go on. While nothing else happens, a comment line comes every 20 seconds.
- A conversation takes 10 streams at once. The next one gets
429. - Streaming someone else's conversation needs
conversation.read_others, and is written to the audit log like a read. - A chat token streams only what its person may see: no
tool_call,tool_resultorapproval_updateevents.
How long conversations are kept
A conversation is erased 7 days after its last message on Free, and 30 days after it on Pro. The agent's answer counts as a message, so a conversation in use isn't cut off. On Enterprise the contract sets the period, up to 365 days: conversationRetentionDays in Limits.
- Erasing a conversation erases its transcript, trace and diagnostics, and its approval requests. Reading, streaming or messaging it then returns
404, as for a conversation that never existed, and lists leave it out. - A conversation still
workingorwaiting for approvalis kept until it ends, then for the period after its last message. One whose last message is more than 4 days and 2 hours older than that is erased all the same: that is longer than any approval request waits (72 hours), with the time its answer takes to arrive and a day for the turn, so its status can only be one that was never updated. - A conversation goes within the hour after its period ends.
- Its model use stays counted: toward the model allowance, the agent's monthly model use and budgets, end users' daily budgets and billing.
- After a move from Pro to Free, conversations already past 7 days are erased with the workspace's next agent message, and at the latest when they reach 30 days. After a move to Pro, every conversation still kept has 30 days.
- A workflow's
step.askconversations and scheduled messages are kept the same way. Turning agents off doesn't keep conversations longer. - What the agent's code stores in each person's database isn't a conversation's: it stays until the agent or the workspace is deleted. Deleting the workspace erases every conversation sooner, and the trash erases a deleted agent's when it erases the agent. See Delete an agent.
Scheduled messages
A schedule can message an agent on a cron. Each tick starts a new conversation with message, and the agent answers in the background as it does for a person.
import { project, schedule } from "shiftlabs";
export default project({
schedules: {
"monday-summary": schedule({
agent: "billing",
message: "Summarize last week's refunds.",
cron: "0 9 * * 1",
timezone: "America/Detroit",
}),
},
});
- The conversation belongs to the schedule: its
personisschedule:<name>and itspersonLabelisschedule <name>. Developers and admins see it with?all=1, as they see other people's conversations. No one can add messages to it. - No one sent the message, so the agent acts for no person: platform tools, which read the workspace as the person talking, refuse, and the built-in helper can't be scheduled. Workflow tools and code tools work as usual, and a tool that needs approval waits for an approver.
- A schedule a key scoped to some workflows adds or changes gives the agent only those workflows' tools, as that key gets. Once a member or an unscoped key changes it, it gives every tool again; a release that leaves it as it is changes nothing. Trigger now with a key scoped to some workflows returns
403 {"error": "forbidden", "reason": "this key is limited to other workflows"}for a schedule that may start other workflows, such as one a member made. - Each message counts like any agent message: toward runs per day, the model allowance and the agent's budgets. A message a limit refuses starts nothing, and the Schedules screen shows why.
- The agent must exist once the release is in, and adding or changing an agent schedule needs agents turned on and the
agent.deploycapability. While agents are off, each tick starts nothing and the Schedules screen showsagents are off in this workspace. The agent's current version answers, on models your plan includes. - While the agent is in the trash, each tick starts nothing. The schedule records
lastSkipped: "the agent is in the trash"inGET /v1/schedules, and the Schedules screen shows that the last tick was skipped. A restore brings the schedule back with the agent, and erasing the agent erases the schedule. - An agent's schedule takes
jitterandcatchup, and can be paused, resumed and triggered now; it takes nooverlaporpauseOnFailureand can't be backfilled. See Schedules and Pause, trigger or backfill a schedule. Each control also needsagent.deploy. messageis 1 to 4,000 characters, and can't start withApproval update:.
Budgets
budget caps what the agent spends on model use, in US dollars.
conversationUsdWhat one conversation may spend, above 0 and at most 5. Default 0.5.
monthlyUsdWhat all the agent's conversations may spend in a UTC month, above 0 and at most 1,000. Optional. Without it, the workspace's model allowance is the only monthly cap.
endUserDailyUsdWhat each end user may spend with the agent in a UTC day, all their conversations together, above 0 and at most 100, or
nullfor no cap. Default 0.1, about 200 model responses of 5,000 tokens in and 500 out on the default model, so one visitor of an app that mints chat tokens for anyone can't use up your model credit.
- A turn that spends
conversationUsdstops asbudget reached. The conversation's next message returns409 {"error": "budget reached"}. - A turn that spends
monthlyUsdstops asmonthly budget reached. Until the month ends, every message to the agent returns429 {"error": "monthly budget reached", "monthlyUsd"}withRetry-After. - The current version's
monthlyUsdholds for every conversation, whichever version it started on. GET /v1/agentsshows each agent's model use (USD) this UTC month asstats.costMonthUsd.- An end user is a
personyour app's key names, or a chat token's. Members, and API keys chatting as themselves, have no daily budget. - An end user's turn that reaches
endUserDailyUsdgoes on to its answer, and the conversation readsdaily budget reached. Until the UTC day ends, their next message to the agent, in any conversation, returns429 {"error": "daily budget reached", "detail", "endUserDailyUsd", "resetsAt"}withRetry-After.resetsAtis the next 00:00 UTC, in milliseconds since the epoch, anddetaila sentence for the person. A chat token getserroranddetailonly. - Turns already running when an end user reaches it finish, so they can spend past it by what those turns spend, at most
conversationUsdeach. - The current version's
endUserDailyUsdholds for all of an end user's conversations, whichever version each started on. A version deployed without a budget stores the default it was deployed with: 0.1 from 8 November 2026, 0.5 before, until it is deployed again. A version deployed beforeendUserDailyUsdexisted has 0.1. GET /v1/agentsshows how many end users reached it this UTC day asstats.endUsersCapped, and when the latest did asstats.endUserCappedAt. The agent's page on the dashboard says so too.- Each model response's model use counts to the nearest $0.000001, and budgets, the model allowance and
costUsd(model use, USD) add up those amounts exactly. - A model response counts once toward
monthlyUsd,endUserDailyUsd,costMonthUsdand the model allowance. When shiftlabs briefly fails while counting it, it tries twice more. If those fail too, the response counts only towardconversationUsd.
Access
access says who may message the agent. Without it, every member can, from viewer up.
roleThe lowest role that may message the agent:
viewer,developeroradmin. Without it, onlymembersmay.membersUp to 100 members, by the email they sign in with, who may message the agent whatever their role.
- Each message is checked against the current version's
access, in new conversations and old ones. A message from outside it returns403 {"error": "forbidden", "reason"}. People keep reading the conversations they started. - API keys count by their role.
- A viewer can message an agent its
accessincludes, but the agent's workflow tools don't start runs for them, and a key scoped to some workflows gets only those workflows' tools. See Workflow tools. GET /v1/agentsshowscanChaton each agent: whether you may message it. The dashboard shows the chat only to them.
Versions
Each deploy of an agent adds a version, numbered from 1, and makes it current. New conversations start on the current version. The helper isn't deployed: its version is a number that changes whenever its definition does, and the dashboard shows it as built in.
GET /v1/agents/:agent/versionslists the newest 50, each with its definition,deployedBy, anddeployedByNamefor an API key.- A release makes agent definitions current together with workflow versions. An agent whose definition hasn't changed keeps its version. Rolling back a release makes its agent versions current again.
shiftlabs deployand a template's Deploy each make one release.
Delete an agent
Delete an agent with Delete agent on its page on the dashboard's Agents screen, or with DELETE /v1/agents/:agent. Developers and admins can. The agent moves to the workspace's trash for 7 days, where an admin can restore it.
# Developer key. Answers {"deleted", "stoppedConversations", "withdrawnApprovals", "purgeAt"}.
curl -X DELETE https://api.shiftlabs.org/v1/agents/billing \
-H "authorization: Bearer $SHIFTLABS_API_KEY"
- Gone at once
The agent leaves
GET /v1/agentsand the Agents screen. Its versions, messages to it and chat tokens for it return404 {"error": "agent not found"}, as for an agent that doesn't exist, and a workflow'sstep.askfails withagent <name> not found. Its conversations list as[], and reading or streaming one returns404. - Turns stop
A turn in progress, or waiting for approval, ends as
failedwith theerroritemThe agent was deleted.Astep.askwaiting on it fails. - Approvals withdrawn
Its pending approval requests become
withdrawn, with the notethe agent was deletedanddecidedBythe one who deleted it. Nobody is told: no alert email or webhook, and nothing in the conversation. A request already posted to Slack is edited to say it was withdrawn. A request answered but not yet delivered to its conversation never is. - Schedules
Its schedules skip every tick, and the Schedules screen shows
the agent is in the trashas why. - Model usage
What it spent stays counted toward the workspace's model allowance for the month. An agent made again under the same name counts that month's model use toward its own monthly budget.
- Restore
An admin restores it on the dashboard's Trash screen or with
POST /v1/trash/restoreand{"kind": "agent", "name"}. Its versions, the current one included, its conversations still within their period, its code with each person's code tool database, and its schedules come back. Withdrawn requests stay withdrawn, and stopped conversations stayfailed: a new message goes on. - Delete for good
An admin erases it on the Trash screen or with
POST /v1/trash/purge, or it is erased 7 days after the delete. That erases its definition and versions, its code, each person's code tool database, its schedules, its approval requests and its conversations, with their transcripts, traces and diagnostics. The name is free at once. Its model usage stays counted.
- Deleting needs the
agent.deploycapability. A key scoped to other agents can't delete it. - The built-in helper can't be deleted:
DELETE /v1/agents/shiftlabsreturns400. - While the agent is in the trash, its name stays taken.
PUT /v1/agents/:agent,PUT /v1/agents/:agent/codeand a release that names it return409with the item intrash, andshiftlabs deployexits7. Restore it, or delete it for good to use the name now. See Trash. - The audit log records the delete as
agent_delete, with how many conversations stopped and approvals were withdrawn, and a restore or erasure asagent_restoreoragent_purge.
Turn agents on or off
Agents are on in a new workspace. An admin turns them off, or on again, in Settings → Agents or with the API. The helper is on wherever agents are.
# Admin key. Answers {"on", "chosen", "override"}.
curl -X PUT https://api.shiftlabs.org/v1/workspace/agents \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"enabled": false}'
- While agents are off, the agent routes return
404,/v1/approvalslists only workflow runs' requests, a release that names agents returns400, a workflow'sstep.askfails with an error that says so, and the dashboard hides Helper and Agents. - Turning agents off keeps agents, conversations and their approvals. Conversations are still erased at the end of their period.
GET /v1/meshowsfeatures.agentsandagentsSwitch{on, chosen, override}. When shiftlabs has set agents on or off for the workspace (override),PUTreturns409. Contact support to change it.- Each change is written to the audit log as
feature_set.
Limits
Agents count toward the workspace's plan. Model use, the helper's included, counts toward the model allowance.
| Limit | Free | Pro |
|---|---|---|
| Agents the helper isn't counted | 3 | 25 |
| Model tokens per 24 hours input and output | 50,000 | 5,000,000 |
| Model use per UTC month | $2 | $2, or $1,000 with model use billed past the $2 included |
| Models | the small models | every model, and models on your own provider key |
| Messages per 24 hours counted apart from runs | 1,000 | 250,000 |
| Messages a minute | 30 per workspace, 10 per person or workflow | 30 per workspace, 10 per person or workflow |
| Tool calls per model turn | 10 | 50 |
| Conversations kept after the last message | 7 days | 30 days |
- Past the model allowance, a message returns
429 {"error": "quota exceeded", "limit", "max"}with"limit": "modelTokensPerDay"or"modelCentsPerMonth", andRetry-After. Past the month's model use it also carriesdetail, a sentence naming the amount and when it resets, andresetsAt, the next 00:00 UTC on the 1st in milliseconds, except to a chat token. A turn that uses up the allowance stops asallowance reached. - Past the messages per 24 hours, a message returns
429with"limit": "runsPerDay"andRetry-After. Past the messages a minute, it returns429 {"error": "rate limited"}withRetry-After: 60. - On Free, model use past the $2 a month isn't billed, and messages are refused until the month ends. On Pro, model use past the $2 included each billing month is billed at the model's list price × 1.20, up to your spending limit. Until your subscription includes model credit, Pro's model use stops at $2 a month instead. See Model use.
- Workflow tool calls are runs, with your plan's run limits. Each code tool call gets 2,000 ms of CPU, and one stopped there counts the CPU time it used. After 3 such stops in a UTC day, code tools pause until 00:00 UTC. A model turn's tool calls past its limit fail without running. See Conversations.
- On Pro, past the spending limit or while a payment is failing, messages return
429. See Plans and billing. While shiftlabs pauses new runs, they return503. See Rate limits.
API
Define agents, upload their code and talk to them with the /v1 API.
| Route | Method | Minimum role |
|---|---|---|
/v1/workspace/agents {"enabled"}; {on, chosen, override} | PUT | admin |
/v1/agents each agent's current version, stats and canChat, the helper first with builtIn: true | GET | viewer |
/v1/agents/:agent the definition; {name, version, warnings} | PUT | developer |
/v1/agents/:agent {deleted, stoppedConversations, withdrawnApprovals, purgeAt}; moves it to the trash for 7 days with its versions, conversations, code and schedules; see Delete an agent | DELETE | developer |
/v1/agents/:agent/code body: TypeScript whose default export is tools({...}); {codeHash, tools, sizeBytes, warnings} | PUT | developer |
/v1/agents/:agent/versions newest first, 50 at most | GET | viewer |
/v1/agents/:agent/conversations POST {"text", "person"?}: 202 {conversation, status}, takes an Idempotency-Key; GET your own, ?person= an end user's, ?all=1 everyone's, ?workflows=1 the ones workflows started, ?run= | GET · POST | viewer |
/v1/agents/:agent/conversations/:conversation status, transcript, model use (USD) and approvals; ?person= for an end user's | GET | viewer |
/v1/agents/:agent/conversations/:conversation/messages {"text", "person"?}: 202 {conversation, status}; takes an Idempotency-Key | POST | viewer |
/v1/agents/:agent/conversations/:conversation/stream Server-Sent Events until the conversation comes to rest; Last-Event-ID or ?lastEventId= resumes, and 204 once there is nothing more; ?person= for an end user's | GET | viewer |
/v1/chat-tokens {"agent", "person", "ttl"?}: a chat token for one agent and end user, 1 minute to 1 hour; 201 {token, agent, person, expiresAt} | POST | developer key with agent.chat_as |