@preapexis/piexis 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/AGENTS.md +21 -41
  2. package/README.md +73 -139
  3. package/extensions/agents.ts +205 -0
  4. package/extensions/ask-question.ts +54 -95
  5. package/extensions/recommended-tools.ts +62 -0
  6. package/extensions/ui.ts +204 -58
  7. package/lib/agent-config.ts +55 -0
  8. package/lib/agents.ts +208 -0
  9. package/lib/question-model.ts +98 -0
  10. package/lib/question-ui.ts +214 -0
  11. package/lib/recommended-tools.ts +119 -0
  12. package/lib/subagent-runner.ts +146 -0
  13. package/lib/ui-tips.json +41 -0
  14. package/package.json +5 -13
  15. package/prompts/init.md +10 -2
  16. package/prompts/summary.md +7 -6
  17. package/schemas/agent.schema.json +48 -0
  18. package/skills/{claude-api/LICENSE.txt → caveman/LICENSE} +2 -2
  19. package/skills/caveman/LICENSE-MIT +21 -0
  20. package/skills/caveman/NOTICE +10 -0
  21. package/skills/caveman/SKILL.md +89 -0
  22. package/skills/find-skills/SKILL.md +141 -0
  23. package/skills/ponytail/LICENSE +21 -0
  24. package/skills/ponytail/NOTICE +9 -0
  25. package/skills/ponytail/SKILL.md +52 -0
  26. package/skills-lock.json +6 -0
  27. package/tests/agents.test.mjs +605 -0
  28. package/tests/ask-question-pty.test.mjs +16 -0
  29. package/tests/ask-question.test.mjs +269 -0
  30. package/tests/fixtures/agents-provider.ts +55 -0
  31. package/tests/fixtures/ask-question-pty.py +91 -0
  32. package/tests/fixtures/ask-question-terminal.mjs +69 -0
  33. package/tests/fixtures/recommended-tools-terminal.mjs +103 -0
  34. package/tests/init-workflow.test.mjs +31 -0
  35. package/tests/recommended-tools-pty.test.mjs +16 -0
  36. package/tests/recommended-tools.test.mjs +423 -0
  37. package/tests/resources.test.mjs +66 -0
  38. package/tests/skills-routing.test.mjs +7 -4
  39. package/tests/ui-tip-reload.test.mjs +70 -0
  40. package/tests/ui.test.mjs +450 -0
  41. package/tsconfig.json +1 -0
  42. package/eval/README.md +0 -72
  43. package/eval/permission-cases.json +0 -28
  44. package/eval/permissions.mjs +0 -103
  45. package/extensions/background-tasks.ts +0 -433
  46. package/extensions/background-worker.ts +0 -50
  47. package/extensions/glob.ts +0 -32
  48. package/extensions/mode.ts +0 -397
  49. package/lib/bash-approvals.ts +0 -113
  50. package/lib/bash-policy.ts +0 -164
  51. package/lib/mode-policy.ts +0 -174
  52. package/lib/path-policy.ts +0 -182
  53. package/lib/permission-classifier.ts +0 -128
  54. package/lib/permission-config.ts +0 -91
  55. package/lib/permission-denials.ts +0 -32
  56. package/lib/permission-intent.ts +0 -128
  57. package/lib/permission-taxonomy.ts +0 -15
  58. package/lib/task-broker.ts +0 -65
  59. package/lib/task-checkout.ts +0 -39
  60. package/lib/task-git.ts +0 -44
  61. package/lib/task-patch.ts +0 -106
  62. package/lib/task-permissions.ts +0 -51
  63. package/lib/task-report.ts +0 -62
  64. package/lib/task-worktree-policy.ts +0 -56
  65. package/skills/claude-api/SKILL.md +0 -572
  66. package/skills/claude-api/csharp/claude-api/README.md +0 -362
  67. package/skills/claude-api/csharp/claude-api/batches.md +0 -14
  68. package/skills/claude-api/csharp/claude-api/files-api.md +0 -25
  69. package/skills/claude-api/csharp/claude-api/streaming.md +0 -28
  70. package/skills/claude-api/csharp/claude-api/tool-use.md +0 -164
  71. package/skills/claude-api/curl/examples.md +0 -256
  72. package/skills/claude-api/curl/managed-agents.md +0 -371
  73. package/skills/claude-api/go/claude-api/README.md +0 -188
  74. package/skills/claude-api/go/claude-api/files-api.md +0 -23
  75. package/skills/claude-api/go/claude-api/streaming.md +0 -43
  76. package/skills/claude-api/go/claude-api/tool-use.md +0 -220
  77. package/skills/claude-api/go/managed-agents/README.md +0 -564
  78. package/skills/claude-api/java/claude-api/README.md +0 -238
  79. package/skills/claude-api/java/claude-api/files-api.md +0 -27
  80. package/skills/claude-api/java/claude-api/streaming.md +0 -24
  81. package/skills/claude-api/java/claude-api/tool-use.md +0 -228
  82. package/skills/claude-api/java/managed-agents/README.md +0 -443
  83. package/skills/claude-api/php/claude-api/README.md +0 -174
  84. package/skills/claude-api/php/claude-api/batches.md +0 -15
  85. package/skills/claude-api/php/claude-api/files-api.md +0 -13
  86. package/skills/claude-api/php/claude-api/streaming.md +0 -27
  87. package/skills/claude-api/php/claude-api/tool-use.md +0 -253
  88. package/skills/claude-api/php/managed-agents/README.md +0 -443
  89. package/skills/claude-api/python/claude-api/README.md +0 -565
  90. package/skills/claude-api/python/claude-api/batches.md +0 -198
  91. package/skills/claude-api/python/claude-api/files-api.md +0 -170
  92. package/skills/claude-api/python/claude-api/sdk-upgrade.md +0 -286
  93. package/skills/claude-api/python/claude-api/streaming.md +0 -179
  94. package/skills/claude-api/python/claude-api/tool-use.md +0 -627
  95. package/skills/claude-api/python/managed-agents/README.md +0 -335
  96. package/skills/claude-api/ruby/claude-api/README.md +0 -134
  97. package/skills/claude-api/ruby/claude-api/streaming.md +0 -16
  98. package/skills/claude-api/ruby/claude-api/tool-use.md +0 -41
  99. package/skills/claude-api/ruby/managed-agents/README.md +0 -394
  100. package/skills/claude-api/shared/admin-api.md +0 -179
  101. package/skills/claude-api/shared/agent-design.md +0 -101
  102. package/skills/claude-api/shared/anthropic-cli.md +0 -269
  103. package/skills/claude-api/shared/claude-platform-on-aws.md +0 -59
  104. package/skills/claude-api/shared/cost-optimization.md +0 -233
  105. package/skills/claude-api/shared/error-codes.md +0 -262
  106. package/skills/claude-api/shared/live-sources.md +0 -166
  107. package/skills/claude-api/shared/managed-agents-api-reference.md +0 -455
  108. package/skills/claude-api/shared/managed-agents-client-patterns.md +0 -220
  109. package/skills/claude-api/shared/managed-agents-core.md +0 -359
  110. package/skills/claude-api/shared/managed-agents-environments.md +0 -226
  111. package/skills/claude-api/shared/managed-agents-events.md +0 -290
  112. package/skills/claude-api/shared/managed-agents-memory.md +0 -201
  113. package/skills/claude-api/shared/managed-agents-multiagent.md +0 -260
  114. package/skills/claude-api/shared/managed-agents-onboarding.md +0 -82
  115. package/skills/claude-api/shared/managed-agents-outcomes.md +0 -108
  116. package/skills/claude-api/shared/managed-agents-overview.md +0 -77
  117. package/skills/claude-api/shared/managed-agents-scheduled-deployments.md +0 -156
  118. package/skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +0 -282
  119. package/skills/claude-api/shared/managed-agents-tools.md +0 -504
  120. package/skills/claude-api/shared/managed-agents-webhooks.md +0 -143
  121. package/skills/claude-api/shared/model-migration.md +0 -1872
  122. package/skills/claude-api/shared/models.md +0 -142
  123. package/skills/claude-api/shared/platform-availability.md +0 -53
  124. package/skills/claude-api/shared/prompt-audit.md +0 -223
  125. package/skills/claude-api/shared/prompt-caching.md +0 -292
  126. package/skills/claude-api/shared/token-counting.md +0 -56
  127. package/skills/claude-api/shared/tool-use-concepts.md +0 -526
  128. package/skills/claude-api/typescript/claude-api/README.md +0 -405
  129. package/skills/claude-api/typescript/claude-api/batches.md +0 -106
  130. package/skills/claude-api/typescript/claude-api/files-api.md +0 -98
  131. package/skills/claude-api/typescript/claude-api/streaming.md +0 -178
  132. package/skills/claude-api/typescript/claude-api/tool-use.md +0 -586
  133. package/skills/claude-api/typescript/managed-agents/README.md +0 -359
  134. package/tests/auto-permissions.test.mjs +0 -315
  135. package/tests/background-tasks.test.mjs +0 -27
  136. package/tests/background-worker.test.mjs +0 -60
  137. package/tests/bash-permissions.test.mjs +0 -276
  138. package/tests/glob.test.mjs +0 -31
  139. package/tests/mode.test.mjs +0 -62
  140. package/tests/permission-evaluation.test.mjs +0 -70
  141. package/tests/permission-foundation.test.mjs +0 -194
  142. package/tests/permission-policy.test.mjs +0 -158
  143. package/tests/runtime/README.md +0 -51
  144. package/tests/runtime/harness.mjs +0 -190
  145. package/tests/runtime/permissions.test.mjs +0 -192
  146. package/tests/runtime/tui.test.mjs +0 -60
  147. package/tests/task-integration.test.mjs +0 -324
  148. package/tests/task-permissions.test.mjs +0 -178
  149. package/tests/task-worktree-policy.test.mjs +0 -53
@@ -1,455 +0,0 @@
1
- # Managed Agents - Endpoint Reference
2
-
3
- All endpoints require `x-api-key` and `anthropic-version: 2023-06-01` headers. Managed Agents endpoints additionally require the `anthropic-beta` header.
4
-
5
- > Most users should define agents and environments as version-controlled YAML applied with the `ant` CLI - see `shared/anthropic-cli.md`. The endpoints below are the underlying API that the CLI and SDKs drive.
6
-
7
- ## Beta Headers
8
-
9
- ```
10
- anthropic-beta: managed-agents-2026-04-01
11
- ```
12
-
13
- The SDK adds this header automatically for all `client.beta.{agents,environments,sessions,vaults,memory_stores,deployments,deployment_runs}.*` calls. Skills endpoints use `skills-2025-10-02`; Files endpoints use `files-api-2025-04-14`.
14
-
15
- ---
16
-
17
- ## SDK Method Reference
18
-
19
- All resources are under the `beta` namespace. Python and TypeScript share identical method names.
20
-
21
- | Resource | Python / TypeScript (`client.beta.*`) | Go (`client.Beta.*`) |
22
- | --- | --- | --- |
23
- | Agents | `agents.create` / `retrieve` / `update` / `list` / `archive` | `Agents.New` / `Get` / `Update` / `List` / `Archive` |
24
- | Agent Versions | `agents.versions.list` | `Agents.Versions.List` |
25
- | Environments | `environments.create` / `retrieve` / `update` / `list` / `delete` / `archive` | `Environments.New` / `Get` / `Update` / `List` / `Delete` / `Archive` |
26
- | Environment Work (self-hosted) | `environments.work.poller` / `stats` / `stop` | See `shared/managed-agents-self-hosted-sandboxes.md` |
27
- | Sessions | `sessions.create` / `retrieve` / `update` / `list` / `delete` / `archive` | `Sessions.New` / `Get` / `Update` / `List` / `Delete` / `Archive` |
28
- | Session Events | `sessions.events.list` / `send` / `stream` | `Sessions.Events.List` / `Send` / `StreamEvents` |
29
- | Session Threads | `sessions.threads.list` / `retrieve` / `archive`; `sessions.threads.events.list` / `stream` | `Sessions.Threads.List` / `Get` / `Archive`; `Sessions.Threads.Events.List` / `StreamEvents` |
30
- | Session Resources | `sessions.resources.add` / `retrieve` / `update` / `list` / `delete` | `Sessions.Resources.Add` / `Get` / `Update` / `List` / `Delete` |
31
- | Deployments | `deployments.create` / `update` / `pause` / `unpause` / `archive` / `run` | Not yet documented - WebFetch the SDK repo (`shared/live-sources.md`) |
32
- | Deployment Runs | `deployment_runs.list` / `retrieve` (TS: `deploymentRuns.*`) | Not yet documented - WebFetch the SDK repo (`shared/live-sources.md`) |
33
- | Vaults | `vaults.create` / `retrieve` / `update` / `list` / `delete` / `archive` | `Vaults.New` / `Get` / `Update` / `List` / `Delete` / `Archive` |
34
- | Credentials | `vaults.credentials.create` / `retrieve` / `update` / `list` / `delete` / `archive` / `mcp_oauth_validate` | `Vaults.Credentials.New` / `Get` / `Update` / `List` / `Delete` / `Archive` / `McpOauthValidate` |
35
- | Memory Stores | `memory_stores.create` / `retrieve` / `update` / `list` / `delete` / `archive` | `MemoryStores.New` / `Get` / `Update` / `List` / `Delete` / `Archive` |
36
- | Memories | `memory_stores.memories.create` / `retrieve` / `update` / `list` / `delete` | `MemoryStores.Memories.New` / `Get` / `Update` / `List` / `Delete` |
37
- | Memory Versions | `memory_stores.memory_versions.list` / `retrieve` / `redact` | `MemoryStores.MemoryVersions.List` / `Get` / `Redact` |
38
-
39
- **Naming quirks to watch for:**
40
- - Agents and Session Threads have **no delete** - only `archive`. Archive is **permanent**: the agent becomes read-only, new sessions cannot reference it, and there is no unarchive. Confirm with the user before archiving a production agent. Environments, Sessions, Vaults, Credentials, and Memory Stores have both `delete` and `archive`; Session Resources, Files, Skills, and Memories are `delete`-only; Memory Versions have neither - only `redact`.
41
- - Session resources use `add` (not `create`).
42
- - Go's event stream is `StreamEvents` (not `Stream`).
43
- - The self-hosted worker class is `EnvironmentWorker` from `anthropic.lib.environments` / `@anthropic-ai/sdk/helpers/beta/environments` / `anthropic-sdk-go/lib/environments`; `client.beta.environments.work.worker(...)` is a factory that returns the same class, alongside the `environments.work.poller/stats/stop` client methods.
44
-
45
- **Agent shorthand:** `agent` on session create accepts three forms - a bare string (`agent="agent_abc123"`, latest version), a pinned reference `{type: "agent", id, version}`, or `{type: "agent_with_overrides", id, version?, model?, system?, tools?, mcp_servers?, skills?}` to override those fields for this session only (see `shared/managed-agents-core.md` -> Override agent configuration for a session).
46
-
47
- **Model shorthand:** `model` on agent create accepts either a bare string (`model="claude-opus-5"` - uses `standard` speed) or the full config object, which takes `speed`, `effort`, and `inference_geo` alongside `id`: `{id: "claude-opus-5", speed: "fast"}`, `{id: "claude-opus-5", effort: "high"}`, `{id: "claude-opus-5", inference_geo: "us"}`. `effort` accepts a level string (`low`/`medium`/`high`/`xhigh`/`max`) or `{type: "<level>"}`, and is **agent-configuration only** - an `effort` inside a per-session `model` override is ignored. `inference_geo` (`"us"` | `"global"`) pins the geography serving the agent's model requests, and unlike `effort` **is** applied in a per-session `model` override. See `shared/managed-agents-core.md` -> Effort on the agent model / Pinning inference geography. Note: `speed: "fast"` is supported on Claude Opus 5 and Opus 4.8 - on the Claude API only, which includes Managed Agents but not Amazon Bedrock, Google Cloud, or Microsoft Foundry. Opus 4.7 fast mode has been removed; `speed: "fast"` on Opus 4.7 returns an error.
48
-
49
- ---
50
-
51
- ## Agents
52
-
53
- **Step one of every flow.** Sessions require a pre-created agent - there is no inline agent config under `managed-agents-2026-04-01`.
54
-
55
- | Method | Path | Operation | Description |
56
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
57
- | `GET` | `/v1/agents` | ListAgents | List agents |
58
- | `POST` | `/v1/agents` | CreateAgent | Create a saved agent configuration |
59
- | `GET` | `/v1/agents/{agent_id}` | GetAgent | Get agent details |
60
- | `POST` | `/v1/agents/{agent_id}` | UpdateAgent | Update agent configuration. `version` is **optional**: supply it (>= 1) for optimistic concurrency - a mismatch returns 409 - or omit it for an unconditional last-write-wins update. |
61
- | `POST` | `/v1/agents/{agent_id}/archive` | ArchiveAgent | Archive an agent. Makes it **read-only**; existing sessions continue, new sessions cannot reference it. No unarchive - this is the terminal state. |
62
- | `GET` | `/v1/agents/{agent_id}/versions` | ListAgentVersions | List agent versions |
63
-
64
- ## Sessions
65
-
66
- | Method | Path | Operation | Description |
67
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
68
- | `GET` | `/v1/sessions` | ListSessions | List sessions (paginated) |
69
- | `POST` | `/v1/sessions` | CreateSession | Create a new session |
70
- | `GET` | `/v1/sessions/{session_id}` | GetSession | Get session details |
71
- | `POST` | `/v1/sessions/{session_id}` | UpdateSession | Update session `metadata`/`title`, `agent.tools`/`agent.mcp_servers` (session-local override; session must be `idle`), or `budget` - change the cap (higher or lower; the new value must exceed the consumed list cost) or remove it with `null`; removal is one-way, and a budget can never be added post-create. `vault_ids` is create-only (rejected on update). See `shared/managed-agents-core.md` -> Updating the agent configuration mid-session / Session budgets. |
72
- | `DELETE` | `/v1/sessions/{session_id}` | DeleteSession | Delete a session |
73
- | `POST` | `/v1/sessions/{session_id}/archive` | ArchiveSession | Archive a session |
74
-
75
- ## Events
76
-
77
- | Method | Path | Operation | Description |
78
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
79
- | `GET` | `/v1/sessions/{session_id}/events` | ListEvents | List events (polling, paginated) |
80
- | `POST` | `/v1/sessions/{session_id}/events` | SendEvents | Send events (user message, tool result) |
81
- | `GET` | `/v1/sessions/{session_id}/events/stream` | StreamEvents | Stream events via SSE. Optional `event_deltas[]=agent.message` / `agent.thinking` opts in to live-preview `event_start`/`event_delta` events - see `shared/managed-agents-events.md` § Live previews. |
82
-
83
- ## Session Threads
84
-
85
- Per-subagent event streams in multiagent sessions. See `shared/managed-agents-multiagent.md`.
86
-
87
- | Method | Path | Operation | Description |
88
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
89
- | `GET` | `/v1/sessions/{session_id}/threads` | ListThreads | List threads (paginated) |
90
- | `GET` | `/v1/sessions/{session_id}/threads/{thread_id}` | GetThread | Retrieve one thread (carries `agent` snapshot, `status`, `parent_thread_id`, `stats`, `usage`) |
91
- | `POST` | `/v1/sessions/{session_id}/threads/{thread_id}/archive` | ArchiveThread | Archive a thread |
92
- | `GET` | `/v1/sessions/{session_id}/threads/{thread_id}/events` | ListThreadEvents | List past events for one thread (paginated) |
93
- | `GET` | `/v1/sessions/{session_id}/threads/{thread_id}/stream` | StreamThreadEvents | Stream one thread via SSE (SDK: `threads.events.stream`) |
94
-
95
- ## Session Resources
96
-
97
- | Method | Path | Operation | Description |
98
- | -------- | ------------------------------------------------------- | ---------------- | ---------------------------------------- |
99
- | `GET` | `/v1/sessions/{session_id}/resources` | ListResources | List resources attached to session |
100
- | `POST` | `/v1/sessions/{session_id}/resources` | AddResource | Attach `file` or `github_repository` resource (SDK method: `add`, not `create`). `memory_store` resources attach at session-create time only. Self-hosted environments accept **only** `memory_store` (at create); `file` / `github_repository` are rejected there. |
101
- | `GET` | `/v1/sessions/{session_id}/resources/{resource_id}` | GetResource | Get a single resource |
102
- | `POST` | `/v1/sessions/{session_id}/resources/{resource_id}` | UpdateResource | Update resource |
103
- | `DELETE` | `/v1/sessions/{session_id}/resources/{resource_id}` | DeleteResource | Remove resource from session |
104
-
105
- ## Environments
106
-
107
- | Method | Path | Operation | Description |
108
- | -------- | ---------------------------------------------------------------- | -------------------- | ----------------------------------- |
109
- | `POST` | `/v1/environments` | CreateEnvironment | Create environment |
110
- | `GET` | `/v1/environments` | ListEnvironments | List environments |
111
- | `GET` | `/v1/environments/{environment_id}` | GetEnvironment | Get environment details |
112
- | `POST` | `/v1/environments/{environment_id}` | UpdateEnvironment | Update environment |
113
- | `DELETE` | `/v1/environments/{environment_id}` | DeleteEnvironment | Delete environment. Returns 204. |
114
- | `POST` | `/v1/environments/{environment_id}/archive` | ArchiveEnvironment | Archive environment. Makes it **read-only**; existing sessions continue, new sessions cannot reference it. No unarchive - this is the terminal state. |
115
- | `GET` | `/v1/environments/{environment_id}/work/stats` | WorkQueueStats | Self-hosted work-queue depth/pending/workers. `x-api-key` auth. See `shared/managed-agents-self-hosted-sandboxes.md`. |
116
- | `POST` | `/v1/environments/{environment_id}/work/{work_id}/stop` | StopWork | Self-hosted: stop a claimed work item. `x-api-key` auth. |
117
-
118
- For `type: "self_hosted"`, `config` is the bare `{"type": "self_hosted"}` - `networking` and `packages` do not apply. (`networking` never governs `web_search` / `web_fetch` in either type - those are restricted per-tool with `allowed_domains` / `blocked_domains` in the agent toolset; see `shared/managed-agents-tools.md`.)
119
-
120
- ## Deployments
121
-
122
- Scheduled deployments (`depl_` IDs) run an agent on a recurring cron schedule - each firing creates a session. See `shared/managed-agents-scheduled-deployments.md` for the conceptual guide (cron/DST semantics, failure behavior, lifecycle).
123
-
124
- | Method | Path | Operation | Description |
125
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
126
- | `POST` | `/v1/deployments` | CreateDeployment | Create a scheduled deployment |
127
- | `POST` | `/v1/deployments/{deployment_id}` | UpdateDeployment | Update deployment configuration (see `shared/managed-agents-scheduled-deployments.md`) |
128
- | `POST` | `/v1/deployments/{deployment_id}/pause` | PauseDeployment | Suppress scheduled triggers (reversible; manual runs still allowed) |
129
- | `POST` | `/v1/deployments/{deployment_id}/unpause` | UnpauseDeployment | Resume from the next occurrence (no backfill) |
130
- | `POST` | `/v1/deployments/{deployment_id}/archive` | ArchiveDeployment | **Terminal** - schedule stops, deployment becomes immutable |
131
- | `POST` | `/v1/deployments/{deployment_id}/run` | RunDeployment | Trigger a manual run immediately (`trigger_context.type: "manual"`); works while paused |
132
-
133
- ## Deployment Runs
134
-
135
- Each trigger attempt (scheduled or manual) writes a `deployment_run` record (`drun_` IDs) carrying either the created `session_id` or an `error.type` (`environment_archived`, `agent_archived`, `vault_not_found`, `session_rate_limited`, `service_unavailable`).
136
-
137
- | Method | Path | Operation | Description |
138
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
139
- | `GET` | `/v1/deployment_runs?deployment_id=...` | ListDeploymentRuns | List runs for a deployment (paginated; filter failures with `has_error=true`) |
140
- | `GET` | `/v1/deployment_runs/{deployment_run_id}` | GetDeploymentRun | Retrieve a single run by ID (a `deployment_run.*` webhook event carries this as `data.id`) |
141
-
142
- ## Vaults
143
-
144
- Vaults store credentials that Anthropic manages on your behalf - MCP credentials (OAuth with auto-refresh, or static bearer tokens) and `environment_variable` credentials substituted into outbound requests at egress. Attach to sessions via `vault_ids`. See `managed-agents-tools.md` §Vaults for the conceptual guide and credential shapes.
145
-
146
- | Method | Path | Operation | Description |
147
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
148
- | `POST` | `/v1/vaults` | CreateVault | Create a vault |
149
- | `GET` | `/v1/vaults` | ListVaults | List vaults |
150
- | `GET` | `/v1/vaults/{vault_id}` | GetVault | Get vault details |
151
- | `POST` | `/v1/vaults/{vault_id}` | UpdateVault | Update vault |
152
- | `DELETE` | `/v1/vaults/{vault_id}` | DeleteVault | Delete vault |
153
- | `POST` | `/v1/vaults/{vault_id}/archive` | ArchiveVault | Archive vault |
154
-
155
- ## Credentials
156
-
157
- Credentials are individual secrets stored inside a vault.
158
-
159
- | Method | Path | Operation | Description |
160
- | -------- | ----------------------------------------------------------------- | ------------------ | ---------------------------- |
161
- | `POST` | `/v1/vaults/{vault_id}/credentials` | CreateCredential | Create a credential |
162
- | `GET` | `/v1/vaults/{vault_id}/credentials` | ListCredentials | List credentials in vault |
163
- | `GET` | `/v1/vaults/{vault_id}/credentials/{credential_id}` | GetCredential | Get credential metadata |
164
- | `POST` | `/v1/vaults/{vault_id}/credentials/{credential_id}` | UpdateCredential | Update credential |
165
- | `DELETE` | `/v1/vaults/{vault_id}/credentials/{credential_id}` | DeleteCredential | Delete credential |
166
- | `POST` | `/v1/vaults/{vault_id}/credentials/{credential_id}/archive` | ArchiveCredential | Archive credential |
167
- | `POST` | `/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate` | McpOauthValidate | Validate an MCP OAuth credential |
168
-
169
- ## Memory Stores
170
-
171
- Workspace-scoped persistent memory that survives across sessions. Attach to a session via a `{"type": "memory_store", "memory_store_id": ...}` entry in `resources[]` (session-create time only). See `shared/managed-agents-memory.md` for the conceptual guide, the FUSE-mount agent interface, preconditions, and versioning.
172
-
173
- | Method | Path | Operation | Description |
174
- | -------- | ------------------------------------------------ | ------------------ | ---------------------------------------- |
175
- | `POST` | `/v1/memory_stores` | CreateMemoryStore | Create a store (`name`, `description`, `metadata`) |
176
- | `GET` | `/v1/memory_stores` | ListMemoryStores | List stores (`include_archived`, `created_at_{gte,lte}`) |
177
- | `GET` | `/v1/memory_stores/{memory_store_id}` | GetMemoryStore | Get store details |
178
- | `POST` | `/v1/memory_stores/{memory_store_id}` | UpdateMemoryStore | Update store |
179
- | `DELETE` | `/v1/memory_stores/{memory_store_id}` | DeleteMemoryStore | Delete store |
180
- | `POST` | `/v1/memory_stores/{memory_store_id}/archive` | ArchiveMemoryStore | Archive store. Makes it **read-only**; existing sessions continue, new sessions cannot reference it. No unarchive. |
181
-
182
- ## Memories
183
-
184
- Individual text documents inside a store (<= 100KB each). `create` creates at a `path` and returns `409` (`memory_path_conflict_error`, with `conflicting_memory_id`) if the path is occupied; `update` mutates by `mem_...` ID (rename and/or content). Only `update` accepts a `precondition` (`{"type": "content_sha256", "content_sha256": ...}`) - on mismatch returns `409` (`memory_precondition_failed_error`). List endpoints accept `view: "basic"|"full"` (controls whether `content` is populated; `retrieve` defaults to `full`).
185
-
186
- | Method | Path | Operation | Description |
187
- | -------- | ----------------------------------------------------------------- | -------------- | ---------------------------------------- |
188
- | `GET` | `/v1/memory_stores/{memory_store_id}/memories` | ListMemories | Returns `Memory \| MemoryPrefix`; filter by `path_prefix`, `depth` |
189
- | `POST` | `/v1/memory_stores/{memory_store_id}/memories` | CreateMemory | Create at `path` (SDK: `memories.create`); `409 memory_path_conflict_error` if occupied |
190
- | `GET` | `/v1/memory_stores/{memory_store_id}/memories/{memory_id}` | GetMemory | Read one memory (defaults to `view="full"`) |
191
- | `PATCH` | `/v1/memory_stores/{memory_store_id}/memories/{memory_id}` | UpdateMemory | Change `content`, `path`, or both by ID; optional `precondition` |
192
- | `DELETE` | `/v1/memory_stores/{memory_store_id}/memories/{memory_id}` | DeleteMemory | Delete (optional `expected_content_sha256`) |
193
-
194
- ## Memory Versions
195
-
196
- Immutable per-mutation snapshots (`memver_...`) - the audit and rollback surface. `operation` in `created` / `modified` / `deleted`.
197
-
198
- | Method | Path | Operation | Description |
199
- | -------- | ----------------------------------------------------------------------------- | --------------------- | ---------------------------------------- |
200
- | `GET` | `/v1/memory_stores/{memory_store_id}/memory_versions` | ListMemoryVersions | Newest-first; filter by `memory_id`, `operation`, `session_id`, `api_key_id`, `created_at_{gte,lte}` |
201
- | `GET` | `/v1/memory_stores/{memory_store_id}/memory_versions/{version_id}` | GetMemoryVersion | List fields + full `content` |
202
- | `POST` | `/v1/memory_stores/{memory_store_id}/memory_versions/{version_id}/redact` | RedactMemoryVersion | Clear `content`/`content_sha256`/`content_size_bytes`/`path`; preserve actor + timestamps |
203
-
204
- ## Files
205
-
206
- | Method | Path | Operation | Description |
207
- | -------- | ------------------------------------------------ | ---------------- | ---------------------------------------- |
208
- | `POST` | `/v1/files` | UploadFile | Upload a file |
209
- | `GET` | `/v1/files` | ListFiles | List files |
210
- | `GET` | `/v1/files/{file_id}` | GetFile | Get file metadata (SDK method: `retrieve_metadata`) |
211
- | `GET` | `/v1/files/{file_id}/content` | DownloadFile | Download file content |
212
- | `DELETE` | `/v1/files/{file_id}` | DeleteFile | Delete a file |
213
-
214
- ## Skills
215
-
216
- | Method | Path | Operation | Description |
217
- | -------- | --------------------------------------------------------------- | ------------------ | ---------------------------- |
218
- | `POST` | `/v1/skills` | CreateSkill | Create a skill |
219
- | `GET` | `/v1/skills` | ListSkills | List skills |
220
- | `GET` | `/v1/skills/{skill_id}` | GetSkill | Get skill details |
221
- | `DELETE` | `/v1/skills/{skill_id}` | DeleteSkill | Delete a skill |
222
- | `POST` | `/v1/skills/{skill_id}/versions` | CreateVersion | Create skill version |
223
- | `GET` | `/v1/skills/{skill_id}/versions` | ListVersions | List skill versions |
224
- | `GET` | `/v1/skills/{skill_id}/versions/{version}` | GetVersion | Get skill version |
225
- | `DELETE` | `/v1/skills/{skill_id}/versions/{version}` | DeleteVersion | Delete skill version |
226
-
227
- ---
228
-
229
- ## Request/Response Schema Quick Reference
230
-
231
- ### CreateAgent Request Body
232
-
233
- **Always start here.** `model`, `system`, `tools`, `mcp_servers`, `skills` are top-level fields on this object - they do NOT go on the session.
234
-
235
- ```json
236
- {
237
- "name": "string (required, 1-256 chars)",
238
- "model": "claude-opus-5 (required - bare string, or {id, speed?, effort?, inference_geo?} object)",
239
- "description": "string (optional, up to 2048 chars)",
240
- "system": "string (optional, up to 100,000 chars)",
241
- "tools": [
242
- { "type": "agent_toolset_20260401" }
243
- ],
244
- "skills": [
245
- { "type": "anthropic", "skill_id": "xlsx" },
246
- { "type": "custom", "skill_id": "skill_abc123", "version": "1" }
247
- ],
248
- "mcp_servers": [
249
- {
250
- "type": "url",
251
- "name": "github",
252
- "url": "https://api.githubcopilot.com/mcp/"
253
- }
254
- ],
255
- "multiagent": {
256
- "type": "coordinator",
257
- "agents": [
258
- "agent_abc123",
259
- { "type": "agent", "id": "agent_def456", "version": 4 },
260
- { "type": "self" }
261
- ]
262
- },
263
- "metadata": {
264
- "key": "value (max 16 pairs, keys <=64 chars, values <=512 chars)"
265
- }
266
- }
267
- ```
268
-
269
- > Limits: `tools` max 128, `skills` max 20, `mcp_servers` max 20 (unique names). `multiagent.agents` 1-20 entries (string ID | `{type:"agent",id,version?}` | `{type:"self"}` | `{type:"advisor",model}`, at most one advisor) - see `shared/managed-agents-multiagent.md`.
270
-
271
- ### CreateSession Request Body
272
-
273
- ```json
274
- {
275
- "agent": "agent_abc123 (required - string shorthand for latest version, or {type: \"agent\", id, version} object)",
276
- "environment_id": "env_abc123 (required)",
277
- "title": "string (optional)",
278
- "resources": [
279
- {
280
- "type": "github_repository",
281
- "url": "https://github.com/owner/repo (required)",
282
- "authorization_token": "ghp_... (required)",
283
- "mount_path": "/workspace/repo (optional - defaults to /workspace/<repo-name>)",
284
- "checkout": { "type": "branch", "name": "main" }
285
- }
286
- ],
287
- "initial_events": [
288
- { "type": "user.message", "content": [{ "type": "text", "text": "Review the auth module." }] }
289
- ],
290
- "vault_ids": ["vlt_abc123 (optional - vault credentials: MCP auth + environment variables)"],
291
- "budget": {
292
- "type": "limit",
293
- "max_list_cost": { "amount": "2500", "currency": "USD" }
294
- },
295
- "metadata": {
296
- "key": "value"
297
- }
298
- }
299
- ```
300
-
301
- > The `agent` field accepts a string ID, `{type: "agent", id, version}`, or `{type: "agent_with_overrides", id, version?, ...}` for session-local overrides of `model`/`system`/`tools`/`mcp_servers`/`skills`. Outside the overrides form, those fields live on the agent, not here. An `effort` inside a `model` override is ignored - set it on the agent. An `inference_geo` inside a `model` override **is** applied (omitting it clears the agent's pin for this session).
302
- >
303
- > **`budget`** (optional, create-only) is a hard dollar cap on the session's list-priced spend; `amount` is an integer string in minor units (cents - `"2500"` = $25.00), `USD` only. It can be changed or removed later via session update, never added. See `shared/managed-agents-core.md` -> Session budgets.
304
- >
305
- > **`initial_events`** (optional, max 50) sends events at creation and starts the agent loop in the same call. Only `user.message` and `user.define_outcome` are accepted - no `system.message`, and none of the tool-result kinds. Validation is all-or-nothing. See `shared/managed-agents-core.md` -> Seeding a session with `initial_events`.
306
- >
307
- > **`checkout`** accepts `{type: "branch", name: "..."}` or `{type: "commit", sha: "..."}`. Omit for the repo's default branch.
308
-
309
- ### CreateEnvironment Request Body
310
-
311
- ```json
312
- {
313
- "name": "string (required)",
314
- "description": "string (optional)",
315
- "config": {
316
- "type": "cloud | self_hosted",
317
- "networking": {
318
- "type": "unrestricted | limited (union - see SDK types)"
319
- },
320
- "packages": { }
321
- },
322
- "metadata": { "key": "value" }
323
- }
324
- ```
325
-
326
- ### CreateDeployment Request Body
327
-
328
- ```json
329
- {
330
- "name": "Weekly compliance scan",
331
- "agent": "agent_abc123 (required - same shapes as CreateSession)",
332
- "environment_id": "env_abc123 (required)",
333
- "initial_events": [
334
- { "type": "user.message", "content": [{ "type": "text", "text": "Run the weekly compliance scan." }] }
335
- ],
336
- "schedule": {
337
- "type": "cron",
338
- "expression": "0 20 * * 5",
339
- "timezone": "America/New_York"
340
- }
341
- }
342
- ```
343
-
344
- > Optional session config (`resources`, `vault_ids`, etc.) is supported the same way as on CreateSession, including `budget` - copied onto each fired session; unlike a session's, it can be added where none exists and re-added after clearing (see `shared/managed-agents-scheduled-deployments.md` § Deployment budgets). Response includes `status`, `paused_reason`, and `schedule.upcoming_runs_at` (next fire times). See `shared/managed-agents-scheduled-deployments.md`.
345
-
346
- ### SendEvents Request Body
347
-
348
- ```json
349
- {
350
- "events": [
351
- {
352
- "type": "user.message",
353
- "content": [
354
- {
355
- "type": "text",
356
- "text": "Hello"
357
- }
358
- ]
359
- }
360
- ]
361
- }
362
- ```
363
-
364
- > `system.message` events (append system-level context for this turn and later ones) use the same envelope with `type: "system.message"` - supported on Claude Opus 5, Claude Opus 4.8, Claude Sonnet 5, Claude Fable 5.1, and Claude Mythos 5.1, checked against the agent's *primary* model only; see `shared/managed-agents-events.md` § Adding system context mid-session.
365
-
366
- ### Define Outcome Event
367
-
368
- ```json
369
- {
370
- "type": "user.define_outcome",
371
- "description": "Build a DCF model for Costco in .xlsx",
372
- "rubric": { "type": "file", "file_id": "file_01..." },
373
- "max_iterations": 5
374
- }
375
- ```
376
-
377
- > `rubric` is required: `{type: "text", content}` or `{type: "file", file_id}`. `max_iterations` default 3, max 20. Echoed back with `outcome_id` + `processed_at`. See `shared/managed-agents-outcomes.md`.
378
-
379
- ### Tool Result Event
380
-
381
- ```json
382
- {
383
- "type": "user.custom_tool_result",
384
- "custom_tool_use_id": "sevt_abc123",
385
- "content": [{ "type": "text", "text": "Result data" }],
386
- "is_error": false
387
- }
388
- ```
389
-
390
- ---
391
-
392
- ## Error Handling
393
-
394
- Managed Agents endpoints use the standard Anthropic API error format. Errors are returned with an HTTP status code and a JSON body containing `type`, `error`, and `request_id`:
395
-
396
- ```json
397
- {
398
- "type": "error",
399
- "error": {
400
- "type": "invalid_request_error",
401
- "message": "Description of what went wrong"
402
- },
403
- "request_id": "req_011CRv1W3XQ8XpFikNYG7RnE"
404
- }
405
- ```
406
-
407
- Include the `request_id` when reporting issues to Anthropic - it lets us trace the request end-to-end. The inner `error.type` is one of the following:
408
-
409
- | Status | Error type | Description |
410
- |---|---|---|
411
- | 400 | `invalid_request_error` | The request was malformed or missing required parameters |
412
- | 401 | `authentication_error` | Invalid or missing API key |
413
- | 403 | `permission_error` | The API key doesn't have permission for this operation |
414
- | 404 | `not_found_error` | The requested resource doesn't exist |
415
- | 409 | `invalid_request_error` | The request conflicts with the resource's current state (e.g., sending to an archived session) |
416
- | 413 | `request_too_large` | The request body exceeds the maximum allowed size |
417
- | 429 | `rate_limit_error` | Too many requests - check rate limit headers for retry timing |
418
- | 500 | `api_error` | An internal server error occurred |
419
- | 529 | `overloaded_error` | The service is temporarily overloaded - retry with backoff |
420
-
421
- Note that `409 Conflict` carries `error.type: "invalid_request_error"` (there is no separate `conflict_error` type); inspect both the HTTP status and the `message` to distinguish conflicts from other invalid requests.
422
-
423
- ---
424
-
425
- ## Pagination
426
-
427
- Most Managed Agents list endpoints use the `page` / `next_page` cursor scheme:
428
-
429
- | Field | Where | Notes |
430
- |---|---|---|
431
- | `limit` | query | Max items per page |
432
- | `page` | query | Opaque cursor from a previous response - pass a `next_page` or `prev_page` value here |
433
- | `order` | query | `asc` / `desc` on endpoints that support sorting. A cursor encodes the `order` of the request that produced it - reusing it with a different `order` returns 400. Other params (filters, `limit`) can change between paginated requests. |
434
- | `next_page` | response | Cursor for the next page; `null` when there are no more results |
435
- | `prev_page` | response | Cursor for the previous page on endpoints that support backward pagination - currently **only `GET /v1/sessions`**. `null` on the first page. On endpoints that don't support it, the field is **absent** (not `null`). |
436
-
437
- Every SDK exposes an auto-paginating iterator that follows `next_page`. In Python and TypeScript, iterate the list result directly; the other SDKs expose the iterator via a separate method (iterating the plain list result returns one page). SDK auto-pagination is **forward-only** - to go back a page, read `prev_page` from the response and pass it back as the `page` parameter yourself.
438
-
439
- > Warning: Some endpoints use a **different** cursor scheme: Message Batches, Files, Models, and several Admin API endpoints take `after_id`/`before_id` and return `has_more`/`first_id`/`last_id` instead of `page`/`next_page`. Some `page`-scheme endpoints (e.g. `GET /v1/skills`) also return a `has_more` boolean alongside `next_page`. Check the endpoint's reference page for its exact pagination fields.
440
-
441
- ---
442
-
443
- ## Rate Limits
444
-
445
- Managed Agents endpoints have per-organization request-per-minute (RPM) limits, separate from your [Messages API token limits](https://platform.claude.com/docs/en/api/rate-limits). Model inference inside a session still draws from your organization's standard ITPM/OTPM limits.
446
-
447
- | Endpoint group | Scope | RPM | Max concurrent |
448
- |---|---|---|---|
449
- | Create operations (Agents, Sessions, Vaults) | organization | 300 | - |
450
- | All other operations (Agents, Sessions, Vaults) | organization | 600 | - |
451
- | All operations (Environments) | organization | 60 | 5 |
452
-
453
- Files and Skills endpoints use the standard tier-based [rate limits](https://platform.claude.com/docs/en/api/rate-limits).
454
-
455
- When a limit is exceeded the API returns `429` with a `rate_limit_error` (see [Error Handling](#error-handling) for the response envelope) and a `retry-after` header indicating how many seconds to wait before retrying. The Anthropic SDK reads this header and retries automatically.