Coming from Anthropic's API
Code that follows Anthropic’s Managed Agents quickstart runs on your Context deployment with these changes:
- Point the SDK at your deployment’s host and authenticate with a Context task API key, either a personal key or a service account key. Choose a key explains which one to use.
- Don’t create an environment. Pass
env_defaultas the session’s environment. - Create the agent with a personal key that has the
agents:writecapability, or pick an existing agent with List agents. - Stop reading the stream only when
session.status_idlehas astop_reason.typeofend_turnorretries_exhausted. Answerrequires_actionwithuser.tool_confirmation. - Turn off SDK retries, because sending events isn’t idempotent (see SDKs).
You can’t configure an environment through the API, so there are no per-environment packages or network allowlists. On a self-hosted (KOTS) deployment, the network allowlist is one setting for the whole deployment, in the KOTS Admin Console (see Network access).
Other calls differ. See What’s stubbed or ignored, Not supported and Behavior that differs. Where the Roadmap has an item that closes a difference, the line links to it.
To find these changes in an existing codebase, install the context-managed-agents skill in your AI coding agent, such
as Claude Code. It flags every call Context refuses and rewrites what it can. See
Build with an AI coding agent.
Anthropic’s quickstart on Context
| Anthropic’s step | On Context |
|---|---|
| Create an agent | Works with a personal key that has the agents:write capability. Set model to default or to a model your deployment runs. In tools, include only the built-in toolset. To use an agent built in the app, call List agents instead. |
| Create an environment | Returns 400 for the body Anthropic’s quickstart sends, which sets limited networking and package managers. For network access on Context, see Network access. Use env_default (see Environments). |
| Create a session | Works unchanged. Pass the agent ID from the first step and env_default. |
| Stream, then send a message | Works, with one change to your loop. Stop on a session.status_idle whose stop_reason.type is end_turn or retries_exhausted, not on any idle. An agent with a tool that needs approval (the Ask setting in the Context app) goes idle with requires_action first. Answer it with user.tool_confirmation, as shown in Send events. |
Headers
anthropic-workspace-id is served: it names the Context workspace the request runs in, and the key’s owner must
work there. For the headers Context ignores or refuses, see What’s stubbed or ignored.
Where a session runs
| Request | The session runs in |
|---|---|
With anthropic-workspace-id | That workspace. It returns 404 if the key’s owner doesn’t work there, 403 if the agent isn’t in it, and 400 if a member named with x-context-owner-user-id or x-context-owner-user-email doesn’t work there. |
| Without it | The workspace the agent is installed in, if the session’s owner works there. Otherwise the owner’s private workspace. |
Either way, the agent must be in the workspace the session would run in. If it isn’t, Create a session
returns 400 with Agent "<name>" (<id>) is not in a workspace this session can run in. Send anthropic-workspace-id
naming a workspace that both the agent and the session’s owner are in, or create the agent with metadata.workspace_id
set to such a workspace.
The session object has no workspace field. To see where a session ran, read its task with the Task API: the session’s
ID is the task’s ID, the same key works with Authorization: Bearer, and the response’s workspaceId and
workspaceName name the workspace (null for a task in no workspace).
Code
Agent API or Task API
Both APIs start the same kind of task with the same key, so using both on one session is expected.
| Use the Agent API to | Use the Task API (/api/v1/tasks) to |
|---|---|
| Run code written for Anthropic’s SDKs. | Choose the workspace in the body (workspaceId). |
Stream a turn over server-sent events and resume with Last-Event-ID. | Get a webhook when the task finishes (delivery). |
Answer tool confirmations from your code (user.tool_confirmation, personal keys only). | Have the server check the result against an outputSchema. |
| Page through a session’s events in Anthropic’s shape. | Load skills on a new task (input.skills), or, with a service account key, start it for another member (ownerUserId, ownerUserEmail). |
POST /api/v1/tasks/prompt also takes a workspace by its slug (workspaceSlug) and a share setting (shareMode).
What’s stubbed or ignored
Some calls and inputs that Anthropic’s SDKs send get a normal response from Context, but Context doesn’t do what Anthropic’s API does with them. This table lists each one, along with the related calls that return an error.
| Anthropic call or input | What Context returns or does |
|---|---|
environments.create with no config, or a cloud config with unrestricted networking and no packages | Returns env_default. It creates nothing, and every call returns the same environment. name, description and metadata are ignored. |
environments.create with packages, limited networking, self_hosted, scope or any other config | Returns 400. Roadmap: Locked-down environments. |
environments.update, environments.delete and environments.archive | Return 404, because Context doesn’t serve these paths. |
env_default’s config and timestamps | config always reports unrestricted networking and empty packages, even when a self-hosted deployment restricts sandbox network access. The environment’s description, created_at and updated_at never change. |
include_archived on environments.list | Context ignores it. No environment is ever archived. |
The anthropic-version and anthropic-beta headers, and the beta=true query parameter the SDKs add | Context ignores them, so the headers can hold any value. |
The Idempotency-Key header | The SDKs send this header only when you pass an idempotency key as a request option. Requests with Idempotency-Key return 400, so don’t pass one. Context doesn’t deduplicate requests, so a retried request runs again. Roadmap: Safe retries. |
anthropic-workspace-id on files, environments and skills requests | Context checks that the key’s owner works in that workspace, then ignores the header. If the owner doesn’t work there, the request returns 404. Files and skills belong to the key’s owner, not to a workspace. |
web_search in an agent’s tools | In the built-in toolset, web_search always reads back with enabled: false, and it never runs. Agents search the web with Context’s own search tool. You can leave it out or send it with enabled: false. Naming it without enabled: false, or with enabled: true, returns 400. |
execution_identity on an agent | Only {type: "service_account"} is accepted, and it changes nothing. Every agent reads back that value. Any other value returns 400. |
| Agent fields Context doesn’t use | Every agent reads back version: 1, archived_at: null, metadata: {}, mcp_servers: [] and multiagent: null. |
expires_in_seconds on files.upload | Context checks the value against Anthropic’s range of 3,600 to 7,776,000 seconds (1 hour to 90 days), then ignores it. A value outside the range returns 400. Files never expire and have no expires_at. |
metadata, vault_ids and budget on sessions.create | An empty metadata, an empty vault_ids and a null budget are ignored. Any other value returns 400. |
| Session fields Context doesn’t use | Every session reads back metadata: {}, vault_ids: [], budget: null, outcome_evaluations: [] and stats: {}. |
The rescheduling status in the statuses filter on sessions.list | Context accepts it, but it matches nothing, because no session is ever rescheduling. |
Usage on session.usage events and on the session | session.usage events have no list_cost. On the session, list_cost is null until billing settles. Every cache write counts as a 5-minute write, so ephemeral_1h_input_tokens is always 0. server_tool_use is never sent. |
Not supported
- Agents:
- Versioning and archiving an agent return
404. Every agent has one version,1, and an update has no conflict check. Roadmap: Agent versions. toolstakes the built-in toolset and custom tools. MCP servers, theautopermission policy and the web tools’ domain and location options return400. You can’t turn onweb_search(see What’s stubbed or ignored). Becausemcp_serversreturns400, so does GitHub’s MCP server. A custom tool is answered withuser.custom_tool_resultas in Anthropic’s API; a computer you paired with the Context app whosemcp.jsonservers advertise a tool of exactly its name can answer it too, and the first answer counts. A call nobody answers ends after 12 minutes with an error result. Which computers may answer follows the key that created the session: a personal key’s sessions are answered by the key owner’s own paired computers; a service account key’s sessions are answered only by machines registered with that key (context login --api-key, the key carryingmachines:serve), never by a person’s computer, not even the computer of a member the session was created for.multiagentand a model’seffort,inference_geoorspeedreturn400. Withoutmultiagentthere are no workflow runs, soworkflow_run.*events are never sent.- On list,
include_archived=trueand thecreated_atfilters return400. - On create,
metadatatakes onlyworkspace_id. Anymetadataon an update returns400.
- Versioning and archiving an agent return
- Environments: You can’t create a custom environment or use
limitednetworking. For what each environment call returns, see What’s stubbed or ignored. Roadmap: Locked-down environments.- The environment work endpoints, which Anthropic’s self-hosted environment worker polls, aren’t served. Their paths
return
404. Roadmap: Run agents on your own machines.
- The environment work endpoints, which Anthropic’s self-hosted environment worker polls, aren’t served. Their paths
return
- Sessions:
- Agent overrides, a non-empty
metadata,vault_idsandbudgetreturn400. For the values Context accepts, see What’s stubbed or ignored. If theagentobject includes aversion, it must be1. Roadmap: Session labels and per-session settings, and Saved credentials forvault_ids. initial_eventstakes at most oneuser.message. More than one returns400. Roadmap: Start a session with more than one message.- Only
fileresources work. The session resources endpoints aren’t served. Their paths return404. Agithub_repositoryresource returns400. - An update takes only
title.agent,vault_ids,budgetand a non-emptymetadatareturn400. - The session threads endpoints aren’t served. Their paths return
404. - On list,
order=ascand theagent_version,deployment_idandmemory_store_idfilters return400.
- Agent overrides, a non-empty
- Events:
event_deltasandsession_thread_idreturn400, because event deltas and threads aren’t supported. The stream sends each message whole. Roadmap: Replies that stream as they’re written.- Sending
user.tool_result,user.define_outcomeorsystem.messagereturns400. - A
user.messagetakes only text blocks. Any other block, such as an image, returns400, and so doescache_controlon a text block. To give the agent an image or a PDF, upload it as a file and attach it to the session. Roadmap: Images and PDFs in a message. - Only 13 event types are sent. For the list, see Events.
session.erroruses five error types. MCP, credential and repository error types are never sent, andretry_status.typeis neverterminal.
- Files: On List files,
idsand alimitover 100 return400. You can’t delete a session’s output files on their own, or attach them to another session. Deleting the session removes them. - Skills: A skill on an agent takes only
latestas a version. Deleting a skill version returns400. The built-in skills include nopdfskill. Writing to a built-in skill returns400. - Other resources: Vaults, memory stores, MCP configuration, webhooks, outcomes, budgets, deployments, deployment
runs, dreams, tunnels and user profiles aren’t served. Their paths return
404. - CLI: Anthropic’s
antCLI isn’t supported. - In the Context app instead: MCP servers, webhooks, schedules and subagents are features of the Context app, not this API. To give an agent MCP servers or connected accounts, set them up in the Context app. If you need one of these in the API, tell us.
Behavior that differs
- Deleting a session: The key needs the
sessions:deletecapability, which is off by default. You can turn it on only when you create the key (see Agent API capabilities). While a turn is running, the request returns409. Senduser.interrupt, then delete the session once it’s idle. The response lists what was removed and what is kept. - Archiving a session: You can archive a running session, which Anthropic’s API refuses. The current turn isn’t
cut short, so send
user.interruptfirst to stop it. - Keeping data: Nothing expires or is deleted on a schedule. Your deployment keeps sessions, files and skills until you delete them. See How long data is kept.
- Mounting files:
mount_pathtakes a path under/workspace/or/mnt/session/uploads/. Any other absolute path is placed under/mnt/session/uploads/, so/data.csvbecomes/mnt/session/uploads/data.csv. A file sent withoutmount_pathisn’t copied to the agent’s disk. It stays in the session’sinputs/folder. On Anthropic’s API, such a file is mounted at/mnt/session/uploads/<file_id>. - Session outputs: The agent writes them to
/mnt/session/outputs/, as on Anthropic’s API. List them by settingscope_idto the session ID on List files. They stay listed after the session is archived. - Agent instructions: The
systemfield readsnullunless the calling key’s owner created the agent. - Custom tool names: A custom tool’s
namemust be lowercase letters, digits and underscores, starting with a letter, at most 64 characters (^[a-z][a-z0-9_]*$). Anthropic’s API accepts^[a-zA-Z0-9_-]{1,128}$, so a name likegetWeatherreturns400here; write itget_weather. The name becomes a tool the agent’s runtime calls by that spelling and the name a paired computer advertises, which is why it isn’t rewritten for you. - Skills: A skill belongs to the key’s owner, not to a workspace. Skill requests ignore the workspace
anthropic-workspace-idnames (see What’s stubbed or ignored). Creating a skill needs theskills:writecapability, which only a personal key can have.display_namemust match thenamein SKILL.md. Each deployment has its own built-in skills. List skills returns them, and each one is identified by its slug.
Limits and values that differ
| What | Context | Anthropic |
|---|---|---|
Session title | Up to 280 characters | Up to 500 characters |
| Files per session | 50 | 500 |
| Where the agent runs | Your deployment, with its models | Anthropic’s servers, with Claude models |
| File size | Up to 5 GiB by default, set per deployment | Up to 500 MB |
| One turn | Stopped after 4 hours by default. Set up to 12 hours (your deployment’s maximum) with max_step_minutes on POST /v1/sessions | No limit stated, and no session field to set one |
List limit | Up to 100 (events: 1,000, skills: 200) | Up to 1,000 |
| Rate limits | Per key, where your deployment enforces them. See Limits | Per organization: 300 creates and 1,200 reads a minute |
error.type on 409 | invalid_request_error, so check the status code instead | conflict_error |
| ID returned when you send an event | sevt_receipt_<uuid> | The event’s ID |
Custom tool name | ^[a-z][a-z0-9_]*$, up to 64 characters | ^[a-zA-Z0-9_-]{1,128}$ |
A session request with more than 50 files returns 500 instead of a named 400. This is a known defect.
A turn is the agent’s work on one message (also called a step). A turn that runs past the session’s
max_step_minutes (4 hours if you set none) is stopped, and the session goes idle with retries_exhausted. Time
spent waiting for your approval doesn’t count. Send the message again to retry.
On Anthropic’s API, a self-hosted sandbox runs the agent’s tools on your machines, while the agent itself still runs on Anthropic’s servers. On Context, the whole agent runs on your deployment, with the models your deployment is set up to run.
Sending an event returns a receipt ID, not the event’s ID. The stored event gets its own ID, which appears on the stream and in the session’s history.
Context extensions
Anthropic’s API has none of these:
- The stream takes a
Last-Event-IDheader to resume after a disconnect. - List files takes
after_idandbefore_idand returnshas_more,first_idandlast_id. - On
POST /v1/sessionsonly, a service account key can sendx-context-owner-user-idorx-context-owner-user-email(one, not both) with a member’s user ID or email, to create a session that member owns. - To create an agent in a workspace, send
metadata.workspace_id. POST /v1/sessionstakesmax_step_minutes, the longest one step may run. The session object returns it.