Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One capture · api

One read of Claude Developer Platformapi-20261130T183711Z

2 pages moved out of 972 read.

Pages moved 2 significant first
Pages read 972 in this capture
Captured 18:37 UTC
Corpus hash 2832c5a3ede9 corpus-hash

What this read moved

1-2 of 2

managed-agents/self-hosted-sandboxes-per-session Changed · +36 / -27 lines

from line 148
148148 export ANTHROPIC_WORK_SECRET
149149 mkdir -p "/host/outputs/$ANTHROPIC_SESSION_ID"
150150 exec docker run --rm \
151 -e ANTHROPIC_SESSION_ID -e ANTHROPIC_ENVIRONMENT_KEY \
152 -e ANTHROPIC_WORK_ID -e ANTHROPIC_ENVIRONMENT_ID -e ANTHROPIC_BASE_URL \
151 -e ANTHROPIC_SESSION_ID -e ANTHROPIC_WORK_ID \
152 -e ANTHROPIC_ENVIRONMENT_ID -e ANTHROPIC_BASE_URL \
153153 -e ANTHROPIC_WORK_SECRET \
154154 -v "/host/outputs/$ANTHROPIC_SESSION_ID":/workspace \
155155 your-image
from line 158
158158 
159159 The poller sets `ANTHROPIC_WORK_ID`, `ANTHROPIC_ENVIRONMENT_ID`, `ANTHROPIC_SESSION_ID`, and `ANTHROPIC_ENVIRONMENT_KEY`. `ANTHROPIC_BASE_URL` reaches the script only if you set it on the poller’s host. The script reads `ANTHROPIC_WORK_SECRET` from the work item’s JSON on standard input. See [Environment variables](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-reference#environment-variables).
160160 
161 The script leaves the environment key on the host, and the worker in the sandbox authenticates with the [work item’s secret](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-per-session#forward-the-work-items-secret). If you replace `docker run`, pass only the five variables that it names with `-e`, not the script’s whole environment.
162 
161163 `/host/outputs` is a host directory you choose. Mounting it at `/workspace` lets you retrieve the session’s deliverables after the sandbox exits. The mount also picks up the downloaded `skills/` tree and any intermediate files.
162164 </Step>
163165 
from line 172
170172 
171173## Forward the work item’s secret
172174 
173Each claimed work item can carry a `secret` (csharp, go: `Secret`) that Anthropic issues for that session. The worker that runs the session needs it to mount [memory stores](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-memory).
175Each claimed work item can carry a `secret` (csharp, go: `Secret`) that Anthropic issues for that session. When it does, the worker that runs the session authenticates with the secret. The worker also needs it to mount [memory stores](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-memory).
174176 
175177A worker that claims and runs sessions in one process passes the secret along itself. `EnvironmentWorker` with `run()` (go: `Run()`) is one such worker, and `ant beta:worker poll` without `--on-work` is another. When your own code sits between the claim and the worker, you forward the secret:
176178 
from line 181
179181| `ant beta:worker poll --on-work` | The `secret` field of the work item JSON on your script’s standard input | `ANTHROPIC_WORK_SECRET` in the sandbox’s environment |
180182| The Python, TypeScript, or Go SDK’s `work.poller()` (typescript: `new WorkPoller()`; go: `environments.NewWorkPoller()`) | The `secret` (go: `Secret`) field of each claimed work item | `ANTHROPIC_WORK_SECRET` in the sandbox’s environment or the `work_secret` (typescript: `workSecret`; go: `WorkSecret`) argument to `handle_item()` (typescript: `handleItem()`; go: `HandleItem()`) |
181183 
182Pass the secret only into the sandbox that serves that session, and never log it. See [Security model](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-security) for how it relates to the environment key.
184The agent’s commands can read the worker’s environment variables, so limit what you pass into the sandbox:
183185 
186* **The secret:** Pass it only into the sandbox that serves that session, and never log it.
187* **The environment key:** Keep it out of the sandbox. It gives access to every session in the environment.
188 
189See [Security model](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-security) for how the two credentials relate.
190 
191To run on the secret alone, the worker in the sandbox needs one of these versions or later:
192 
193* `ant` CLI 1.32.0 (1.33.0 to use memory stores)
194* Python SDK 1.5.0
195* TypeScript SDK 0.125.0
196* Go SDK 1.72.0
197 
198A worker that has no usable secret and no environment key exits with an error and runs no tool calls. An older worker exits the same way. The error names the environment key, but don’t add the key. Check the worker’s version, and check that the secret reaches the sandbox.
199 
184200## Launch sandboxes from the SDK poller
185201 
186202To claim work from your own code instead of `ant beta:worker poll --on-work`, use the poller in the Python, TypeScript, or Go SDK: `work.poller()` (typescript: `new WorkPoller()`; go: `environments.NewWorkPoller()`). It polls the queue and gives you each claimed session, and you launch the sandbox:
from line 219
203219 
204220 SANDBOX_ENV = (
205221 "ANTHROPIC_ENVIRONMENT_ID",
206 "ANTHROPIC_ENVIRONMENT_KEY",
207222 "ANTHROPIC_WORK_ID",
208223 "ANTHROPIC_SESSION_ID",
209224 "ANTHROPIC_WORK_SECRET",
from line 228
213228 
214229 async def launch_container(work: BetaSelfHostedWork) -> None:
215230 print(f"claimed session {work.data.id}")
216 # Replace `docker run` with your own sandbox launcher. Forward the environment
217 # key (never your API key) and the work item's per-session secret: the worker
218 # inside needs the secret to mount the session's memory stores.
231 # Replace `docker run` with your own sandbox launcher. Forward the work item's
232 # secret, never the environment key or your API key. The worker inside
233 # authenticates with the secret.
219234 env = os.environ | {
220235 "ANTHROPIC_WORK_ID": work.id,
221236 "ANTHROPIC_SESSION_ID": work.data.id,
from line 267
252267 
253268 const SANDBOX_ENV = [
254269 "ANTHROPIC_ENVIRONMENT_ID",
255 "ANTHROPIC_ENVIRONMENT_KEY",
256270 "ANTHROPIC_WORK_ID",
257271 "ANTHROPIC_SESSION_ID",
258272 "ANTHROPIC_WORK_SECRET",
from line 279
265279 
266280 async function launchContainer(work: BetaSelfHostedWork): Promise<void> {
267281 console.log(`claimed session ${work.data.id}`);
268 // Replace `docker run` with your own sandbox launcher. Forward the environment
269 // key (never your API key) and the work item's per-session secret: the worker
270 // inside needs the secret to mount the session's memory stores.
282 // Replace `docker run` with your own sandbox launcher. Forward the work item's
283 // secret, never the environment key or your API key. The worker inside
284 // authenticates with the secret.
271285 const env = {
272286 ...process.env,
273287 ANTHROPIC_WORK_ID: work.id,
from line 330
316330 
317331 var sandboxEnv = []string{
318332 "ANTHROPIC_ENVIRONMENT_ID",
319 "ANTHROPIC_ENVIRONMENT_KEY",
320333 "ANTHROPIC_WORK_ID",
321334 "ANTHROPIC_SESSION_ID",
322335 "ANTHROPIC_WORK_SECRET",
from line 338
325338 
326339 func launchContainer(ctx context.Context, work *anthropic.BetaSelfHostedWork) error {
327340 fmt.Printf("claimed session %s\n", work.Data.ID)
328 // Replace `docker run` with your own sandbox launcher. Forward the environment
329 // key (never your API key) and the work item's per-session secret: the worker
330 // inside needs the secret to mount the session's memory stores.
341 // Replace `docker run` with your own sandbox launcher. Forward the work item's
342 // secret, never the environment key or your API key. The worker inside
343 // authenticates with the secret.
331344 args := []string{"run", "--rm", "--detach"}
332345 for _, name := range sandboxEnv {
333346 args = append(args, "-e", name)
from line 396
383396 
384397## Run the SDK worker inside the sandbox
385398 
386Replace the `ant beta:worker run` entrypoint with an SDK entrypoint when the sandbox must [serve custom tools](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-custom-tools) or use [non-default memory sync settings](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-memory#configure-sync). The entrypoint constructs `EnvironmentWorker` and calls `handle_item()` (typescript: `handleItem()`; go: `HandleItem()`), which reads the same `ANTHROPIC_*` variables that the spawn script forwards.
399Replace the `ant beta:worker run` entrypoint with an SDK entrypoint when the sandbox must [serve custom tools](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-custom-tools) or use [non-default memory sync settings](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-memory#configure-sync). The entrypoint constructs `EnvironmentWorker` and calls `handle_item()` (typescript: `handleItem()`; go: `HandleItem()`), which reads the same `ANTHROPIC_*` variables that the spawn script forwards. The client needs no credential of its own, because the worker authenticates with the [work item’s secret](https://platform.claude.com/docs/en/managed-agents/self-hosted-sandboxes-per-session#forward-the-work-items-secret).
387400 
388401<CodeGroup exclude="shell, csharp, java, php, ruby">
389402 <CodeGroupItem language="cURL">
from line 410
397410 ```python Python
398411 import asyncio
399412 import contextlib
400 import os
401413 import signal
402414 from anthropic import AsyncAnthropic
403415 from anthropic.lib.environments import EnvironmentWorker
from line 416
404416 
405417 
406418 async def main() -> None:
407 async with AsyncAnthropic(
408 auth_token=os.environ["ANTHROPIC_ENVIRONMENT_KEY"]
409 ) as client:
419 async with AsyncAnthropic() as client:
410420 worker = EnvironmentWorker(client, workdir="/workspace")
411421 # With no arguments, handle_item() reads the ANTHROPIC_* variables the spawn
412 # script forwarded, including ANTHROPIC_WORK_SECRET.
422 # script forwarded. It authenticates with ANTHROPIC_WORK_SECRET.
413423 task = asyncio.create_task(worker.handle_item())
414424 # Canceling the task when the container is stopped lets the worker upload
415425 # changed memory files and remove the store directories before it exits.
from line 437
427437 import Anthropic from "@anthropic-ai/sdk";
428438 import { EnvironmentWorker } from "@anthropic-ai/sdk/helpers/beta/environments";
429439 
430 const client = new Anthropic({ authToken: process.env.ANTHROPIC_ENVIRONMENT_KEY });
440 const client = new Anthropic();
431441 const controller = new AbortController();
432442 // Aborting when the container is stopped lets the worker upload changed memory
433443 // files and remove the store directories before it exits.
from line 445
435445 process.once("SIGINT", () => controller.abort());
436446 
437447 // With no arguments, handleItem() reads the ANTHROPIC_* variables the spawn
438 // script forwarded, including ANTHROPIC_WORK_SECRET.
448 // script forwarded. It authenticates with ANTHROPIC_WORK_SECRET.
439449 await new EnvironmentWorker({
440450 client,
441451 workdir: "/workspace",
from line 469
459469 
460470 "github.com/anthropics/anthropic-sdk-go/v2"
461471 "github.com/anthropics/anthropic-sdk-go/v2/lib/environments"
462 "github.com/anthropics/anthropic-sdk-go/v2/option"
463472 )
464473 
465474 func main() {
from line 477
468477 ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
469478 defer stop()
470479 
471 client := anthropic.NewClient(option.WithAuthToken(os.Getenv("ANTHROPIC_ENVIRONMENT_KEY")))
480 client := anthropic.NewClient()
472481 worker := environments.NewEnvironmentWorker(client, environments.EnvironmentWorkerOptions{
473482 Workdir: "/workspace",
474483 })
475484 // With zero-value options, HandleItem reads the ANTHROPIC_* variables the spawn
476 // script forwarded, including ANTHROPIC_WORK_SECRET.
485 // script forwarded. It authenticates with ANTHROPIC_WORK_SECRET.
477486 if err := worker.HandleItem(ctx, environments.HandleItemOptions{}); err != nil {
478487 log.Fatalf("worker: %v", err)
479488 }

manage-claude/enterprise-admin-api-key-scopes Changed · +2 / -2 lines

from line 123
123123 
124124Most scopes act only on the organization you create the key in. A Claude Enterprise organization normally belongs to a [parent organization](https://platform.claude.com/docs/en/manage-claude/administering-claude#which-organization-you-have), which can hold several linked organizations. Keys with Compliance API, group, or audit scopes can reach further:
125125 
126* **Compliance API scopes:** These reach all linked organizations when you select **All organizations** under [Key access](https://platform.claude.com/docs/en/manage-claude/admin-api-keys#key-access), which the Admin API keys and tokens page describes.
126* **Compliance API scopes:** These reach all linked organizations when you select **All organizations**, if the key form offers it. The Admin API keys and tokens page describes [Key access](https://platform.claude.com/docs/en/manage-claude/admin-api-keys#key-access).
127127* **Group scopes (`read:rbac_groups` and `write:rbac_groups`):** These scopes act on groups. Groups belong to the parent organization, and its linked organizations share them. For which keys can hold these scopes, see [Groups and roles](https://platform.claude.com/docs/en/manage-claude/user-management#groups-and-roles) on the User management page.
128* **Audit scope (`read:org_audit`):** The primary owner can create a key with this scope for all linked organizations. That key can then read the Compliance API of every linked organization and the Plugins API of any that has access to it. See [Reading another organization under the same parent](https://platform.claude.com/docs/en/manage-claude/plugins-api#reading-another-organization-under-the-same-parent) on the Plugins API page.
128* **Audit scope (`read:org_audit`):** Only the primary owner can create a key with this scope. Depending on the parent organization, the key reaches all linked organizations or the organization you create it in, and the key form shows which. A key that reaches all linked organizations can read the Compliance API of every linked organization and the Plugins API of any that has access to it. See [Reading another organization under the same parent](https://platform.claude.com/docs/en/manage-claude/plugins-api#reading-another-organization-under-the-same-parent) on the Plugins API page.
129129 
Feedback