Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One capture · api

One read of Claude Developer Platformapi-20261020T020708Z

124 pages moved out of 785 read.

Pages moved 124 significant first
Pages read 785 in this capture
Captured 02:07 UTC
Corpus hash 05505ffc3bb1 index-hash

What this read moved

51-75 of 124, page 3 of 5

This capture is too large to show at once. Changes 51-75 of 124 are below, significant first; the rest are on the following screens.

build-with-claude/mid-conversation-effort-example Changed · +64 / -48 lines

from line 40
4040 MODEL = "claude-opus-5-5"
4141 EFFORT = "xhigh"
4242 
43 SYSTEM_PROMPT = "You are a helpful general-purpose agent. Answer the user's request directly."
43 SYSTEM_PROMPT = (
44 "You are a helpful general-purpose agent. Answer the user's request directly."
45 )
4446 
4547 REQUEST_TIMEOUT_SECONDS = 600
4648 BASH_TIMEOUT_SECONDS = 60
from line 164
162164 }
163165 return normal
164166 }
165 
166167 ```
167168 
168169 ```java Java
from line 284
283284 "description for standing consent, granularity guidance, and quality patterns. Work solo "
284285 "only on conversational or trivial turns."
285286 )
286 MODE_REFRESH = (
287 "Orchestration mode is still on. Use the Workflow tool; see its standing consent section."
288 )
287 MODE_REFRESH = "Orchestration mode is still on. Use the Workflow tool; see its standing consent section."
289288 MODE_EXIT = (
290289 "Orchestration mode is off. The Workflow tool's standard opt-in rule applies again."
291290 )
from line 326
327326 modeRefresh = "Orchestration mode is still on. Use the Workflow tool; see its standing consent section."
328327 modeExit = "Orchestration mode is off. The Workflow tool's standard opt-in rule applies again."
329328 )
330 
331329 ```
332330 
333331 ```java Java
from line 420
422420 "input_schema": {
423421 "type": "object",
424422 "properties": {
425 "summary": {"type": "string", "description": "Two or three sentences of synthesis"},
423 "summary": {
424 "type": "string",
425 "description": "Two or three sentences of synthesis",
426 },
426427 "findings": {
427428 "type": "array",
428429 "items": {
429430 "type": "object",
430431 "properties": {
431 "claim": {"type": "string", "description": "The finding, one sentence"},
432 "claim": {
433 "type": "string",
434 "description": "The finding, one sentence",
435 },
432436 "evidence": {
433437 "type": "string",
434438 "description": "How it was verified (file, line, or command output)",
435439 },
436 "severity": {"type": "string", "enum": ["high", "medium", "low", "info"]},
440 "severity": {
441 "type": "string",
442 "enum": ["high", "medium", "low", "info"],
443 },
437444 },
438445 "required": ["claim", "evidence", "severity"],
439446 },
from line 472
465472 "opt-in is standing. Author and run a workflow for every substantive task by default, " +
466473 "and lean toward verifying findings adversarially. Work solo only on conversational " +
467474 "turns or trivial mechanical edits. When a system message says the mode is off, " +
468 "revert to the opt-in rule above.",
475 "revert to the opt-in rule above."
469476 ].join("\n\n"),
470477 input_schema: {
471478 type: "object",
from line 480
473480 subtasks: {
474481 type: "array",
475482 items: { type: "string" },
476 description: "Independent subtask prompts to run as parallel agents",
477 },
483 description: "Independent subtask prompts to run as parallel agents"
484 }
478485 },
479 required: ["subtasks"],
480 },
486 required: ["subtasks"]
487 }
481488 };
482489 
483490 const BASH_TOOL: Anthropic.ToolBash20250124 = { type: "bash_20250124", name: "bash" };
from line 506
499506 claim: { type: "string", description: "The finding, one sentence" },
500507 evidence: {
501508 type: "string",
502 description: "How it was verified (file, line, or command output)",
509 description: "How it was verified (file, line, or command output)"
503510 },
504 severity: { type: "string", enum: ["high", "medium", "low", "info"] },
511 severity: { type: "string", enum: ["high", "medium", "low", "info"] }
505512 },
506 required: ["claim", "evidence", "severity"],
507 },
508 },
513 required: ["claim", "evidence", "severity"]
514 }
515 }
509516 },
510 required: ["summary", "findings"],
511 },
517 required: ["summary", "findings"]
518 }
512519 };
513520 ```
514521 
from line 658
651658 },
652659 },
653660 }
654 
655661 ```
656662 
657663 ```java Java
from line 902
896902 return f"command timed out after {BASH_TIMEOUT_SECONDS}s", True
897903 output = (proc.stdout + proc.stderr).strip() or "(no output)"
898904 if len(output) > TOOL_RESULT_MAX_CHARS:
899 output = output[:TOOL_RESULT_MAX_CHARS] + f"\n(truncated at {TOOL_RESULT_MAX_CHARS} chars)"
905 output = (
906 output[:TOOL_RESULT_MAX_CHARS]
907 + f"\n(truncated at {TOOL_RESULT_MAX_CHARS} chars)"
908 )
900909 if proc.returncode != 0:
901910 output = f"(exit code {proc.returncode})\n{output}"
902911 return output, proc.returncode != 0
from line 936
927936 return n if n < 2 else fib(n - 1) + fib(n - 2)
928937 
929938 print(fib(10))
930 `,
939 `
931940 );
932941 }
933942 
from line 947
938947 shell: "/bin/bash",
939948 cwd: WORK_DIR,
940949 timeout: BASH_TIMEOUT_SECONDS * 1000,
941 maxBuffer: 16 * 1024 * 1024,
950 maxBuffer: 16 * 1024 * 1024
942951 };
943952 return new Promise((resolve) => {
944953 exec(command, options, (error, stdout, stderr) => {
from line 1141
11321141 }
11331142 return runBash(ctx, input.Command)
11341143 }
1135 
11361144 ```
11371145 
11381146 ```java Java
from line 1434
14261434 if response.stop_reason == "pause_turn":
14271435 continue
14281436 if response.stop_reason != "tool_use":
1429 text = "".join(block.text for block in response.content if block.type == "text")
1437 text = "".join(
1438 block.text for block in response.content if block.type == "text"
1439 )
14301440 if response.stop_reason == "max_tokens":
14311441 text += "\n\n(warning: subagent response was truncated at max_tokens)"
14321442 return text
from line 1485
14751485 system: subagentSystem,
14761486 output_config: { effort: EFFORT },
14771487 tools: [BASH_TOOL, REPORT_TOOL],
1478 messages,
1488 messages
14791489 },
1480 { signal: AbortSignal.timeout(REQUEST_TIMEOUT_SECONDS * 1000) },
1490 { signal: AbortSignal.timeout(REQUEST_TIMEOUT_SECONDS * 1000) }
14811491 )
14821492 .finalMessage();
14831493 messages.push({ role: "assistant", content: response.content });
from line 1525
15151525 type: "tool_result",
15161526 tool_use_id: block.id,
15171527 content: outcome.output,
1518 is_error: outcome.isError,
1528 is_error: outcome.isError
15191529 });
15201530 }
15211531 if (report !== null) {
from line 1702
16921702 }
16931703 return "(subagent hit the turn limit before finishing)", nil
16941704 }
1695 
16961705 ```
16971706 
16981707 ```java Java
from line 1985
19761985 with open(temp, "w") as file:
19771986 json.dump(journal, file)
19781987 os.replace(temp, JOURNAL_PATH) # atomic on POSIX and Windows
1979 except OSError as error: # the journal is best-effort; never discard a computed result
1988 # A failed journal write must not lose the computed result
1989 except OSError as error:
19801990 print(f"[journal] write failed: {error}", file=sys.stderr)
19811991 return result
19821992 ```
from line 2123
21132123 }
21142124 return result, nil
21152125 }
2116 
21172126 ```
21182127 
21192128 ```java Java
from line 2288
22792288 def run_one(prompt: str) -> str:
22802289 try:
22812290 return journaled(prompt, lambda: run_subagent(model, prompt))
2282 except Exception as error: # isolation boundary: one bad subagent should not end the run
2291 # One failed subagent must not end the run
2292 except Exception as error:
22832293 return f"(subagent failed: {type(error).__name__}: {error})"
22842294 
22852295 with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_CONCURRENT) as pool:
22862296 results = list(pool.map(run_one, subtasks))
22872297 print(f"[workflow] verifying {len(results)} results", file=sys.stderr)
2288 verify_prompts = [verify_prompt_for(task, result) for task, result in zip(subtasks, results)]
2298 verify_prompts = [
2299 verify_prompt_for(task, result) for task, result in zip(subtasks, results)
2300 ]
22892301 verdicts = list(pool.map(run_one, verify_prompts))
22902302 
22912303 joined = "\n\n".join(
from line 2306
22942306 
22952307 [verify {index + 1}]
22962308 {verdict}"""
2297 for index, (task, result, verdict) in enumerate(zip(subtasks, results, verdicts))
2309 for index, (task, result, verdict) in enumerate(
2310 zip(subtasks, results, verdicts)
2311 )
22982312 )
22992313 if dropped > 0:
23002314 joined = (
from line 2334
23202334 return [];
23212335 }
23222336 return value
2323 .filter((task): task is string => typeof task === "string")
2337 .filter((task) => typeof task === "string")
23242338 .map((task) => task.trim())
23252339 .filter((task) => task.length > 0);
23262340 }
from line 2358
23442358 async function mapWithLimit<In, Out>(
23452359 items: readonly In[],
23462360 limit: number,
2347 task: (item: In) => Promise<Out>,
2361 task: (item: In) => Promise<Out>
23482362 ): Promise<Out[]> {
23492363 const results = new Array<Out>(items.length);
23502364 let cursor = 0;
from line 2389
23752389 return await journaled(prompt, () => runSubagent(model, prompt));
23762390 } catch (error) {
23772391 // Isolation boundary: one bad subagent should not end the run.
2378 const reason = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
2392 const reason =
2393 error instanceof Error ? `${error.name}: ${error.message}` : String(error);
23792394 return `(subagent failed: ${reason})`;
23802395 }
23812396 };
from line 2406
23912406 ${results[index]}
23922407 
23932408 [verify ${index + 1}]
2394 ${verdicts[index]}`,
2409 ${verdicts[index]}`
23952410 )
23962411 .join("\n\n");
23972412 const droppedNote =
from line 2607
25922607 }
25932608 return joined, false
25942609 }
2595 
25962610 ```
25972611 
25982612 ```java Java
from line 3035
30213035 if response.stop_reason == "pause_turn":
30223036 continue
30233037 if response.stop_reason != "tool_use":
3024 text = "".join(block.text for block in response.content if block.type == "text")
3038 text = "".join(
3039 block.text for block in response.content if block.type == "text"
3040 )
30253041 if response.stop_reason == "max_tokens":
30263042 # Drop the truncated assistant message so later turns do not build on it.
30273043 self.messages.pop()
from line 3050
30343050 continue
30353051 match block.name:
30363052 case "Workflow":
3037 output, is_error = run_workflow(self.model, block.input.get("subtasks", []))
3053 output, is_error = run_workflow(
3054 self.model, block.input.get("subtasks", [])
3055 )
30383056 case "bash":
30393057 output, is_error = handle_bash_block(block)
30403058 case _:
from line 3131
31133131 system: SYSTEM_PROMPT, // static for the whole session
31143132 output_config: { effort: EFFORT },
31153133 tools: [WORKFLOW_TOOL, BASH_TOOL],
3116 messages: this.#messages,
3134 messages: this.#messages
31173135 },
3118 { signal: AbortSignal.timeout(REQUEST_TIMEOUT_SECONDS * 1000) },
3136 { signal: AbortSignal.timeout(REQUEST_TIMEOUT_SECONDS * 1000) }
31193137 )
31203138 .finalMessage();
31213139 this.#messages.push({ role: "assistant", content: response.content });
from line 3175
31573175 type: "tool_result",
31583176 tool_use_id: block.id,
31593177 content: outcome.output,
3160 is_error: outcome.isError,
3178 is_error: outcome.isError
31613179 });
31623180 }
31633181 this.#messages.push({ role: "user", content: toolResults });
from line 3422
34043422 }
34053423 return "(hit the main loop turn limit before finishing)", nil
34063424 }
3407 
34083425 ```
34093426 
34103427 ```java Java
from line 3854
38373854 fmt.Println(summary)
38383855 return nil
38393856 }
3840 
38413857 ```
38423858 
38433859 ```java Java

build-with-claude/overview Changed · +14 / -14 lines

from line 38
3838 
3939The ZDR column indicates whether a feature is available under a Zero Data Retention arrangement. For most features this depends only on what the feature mechanism retains; for features tied to specific models, model-level ZDR availability also applies. See [Model-specific data retention requirements](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements).
4040 
41| Feature | Description | Zero Data Retention (ZDR) | Availability |
42| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
43| [Context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows) | Up to 1M tokens for processing large documents, extensive code bases, and long conversations. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
44| [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) | Let Claude dynamically determine when and how much to think. The only thinking mode on Claude 4.7 and later models. Use the effort parameter to control thinking depth. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
45| [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | Process large volumes of requests asynchronously for cost savings. Send batches with a large number of queries per batch. Batch API calls cost 50% less than standard API calls. | Not ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws /> |
46| [Citations](https://platform.claude.com/docs/en/build-with-claude/citations) | Ground Claude's responses in source documents. With Citations, Claude can provide detailed references to the exact sentences and passages it uses to generate responses, leading to more verifiable, trustworthy outputs. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
47| [Data residency](https://platform.claude.com/docs/en/manage-claude/data-residency) | Control where model inference runs using geographic controls. Specify `"global"` or `"us"` routing per request through the `inference_geo` parameter. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws /> |
48| [Effort](https://platform.claude.com/docs/en/build-with-claude/effort) | Control how many tokens Claude uses when responding with the effort parameter, trading off between response thoroughness and token efficiency. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
49| [Fallback credit](https://platform.claude.com/docs/en/build-with-claude/fallback-credit) | Avoid paying the prompt-cache cost twice when you retry a refused request on another model. The refusal carries a credit token, and echoing it on the retry bills the retry as though the conversation had been on the new model all along. Message Batches results do not include fallback credit tokens. | Not ZDR eligible\* | <PlatformAvailability claudeApiBeta claudePlatformAwsBeta bedrockBeta vertexAiBeta azureAiBeta /> |
50| [PDF support](https://platform.claude.com/docs/en/build-with-claude/pdf-support) | Process and analyze text and visual content from PDF documents. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
51| [Search results](https://platform.claude.com/docs/en/build-with-claude/search-results) | Enable natural citations for RAG applications by providing search results with proper source attribution. Achieve web search-quality citations for custom knowledge bases and tools. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
52| [Server-side fallback](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) | Retry a refused request inside a single API call. Use the `"default"` mode to apply Anthropic's recommended fallback models, or name up to three models of your own; when the requested model declines, the API runs the next model in the chain on the same request. The `fallbacks` parameter is not available in the Message Batches API. | Not ZDR eligible\* | <PlatformAvailability claudeApiBeta /> |
53| <Tooltip tooltipContent="On Amazon Bedrock, structured outputs are available only on the legacy InvokeModel integration, for Claude Opus 4.6, Claude Sonnet 4.6, Claude Sonnet 4.5, Claude Opus 4.5, and Claude Haiku 4.5. Claude in Amazon Bedrock doesn't support them.">[Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)</Tooltip> | Guarantee schema conformance with two approaches: JSON outputs for structured data responses, and strict tool use for validated tool inputs. | [ZDR eligible (qualified)](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#data-retention)\* | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
54| [Thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) | Enhanced reasoning capabilities for complex tasks, with an optional summary of Claude's reasoning before its final answer. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
41| Feature | Description | Zero Data Retention (ZDR) | Availability |
42| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
43| [Context windows](https://platform.claude.com/docs/en/build-with-claude/context-windows) | Up to 1M tokens for processing large documents, extensive code bases, and long conversations. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
44| [Adaptive thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) | Let Claude dynamically determine when and how much to think. The only thinking mode on Claude 4.7 and later models. Use the effort parameter to control thinking depth. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
45| [Batch processing](https://platform.claude.com/docs/en/build-with-claude/batch-processing) | Process large volumes of requests asynchronously for cost savings. Send batches with a large number of queries per batch. Batch API calls cost 50% less than standard API calls. | Not ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws /> |
46| [Citations](https://platform.claude.com/docs/en/build-with-claude/citations) | Ground Claude's responses in source documents. With Citations, Claude can provide detailed references to the exact sentences and passages it uses to generate responses, leading to more verifiable, trustworthy outputs. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
47| [Data residency](https://platform.claude.com/docs/en/manage-claude/data-residency) | Control where model inference runs using geographic controls. Specify `"global"` or `"us"` routing per request through the `inference_geo` parameter. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws /> |
48| [Effort](https://platform.claude.com/docs/en/build-with-claude/effort) | Control how many tokens Claude uses when responding with the effort parameter, trading off between response thoroughness and token efficiency. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
49| [Fallback credit](https://platform.claude.com/docs/en/build-with-claude/fallback-credit) | Avoid paying the prompt-cache cost twice when you retry a refused request on another model. The refusal carries a credit token, and echoing it on the retry bills the retry as though the conversation had been on the new model all along. Message Batches results do not include fallback credit tokens. | Not ZDR eligible\* | <PlatformAvailability claudeApiBeta claudePlatformAwsBeta bedrockBeta vertexAiBeta azureAiBeta /> |
50| [PDF support](https://platform.claude.com/docs/en/build-with-claude/pdf-support) | Process and analyze text and visual content from PDF documents. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
51| [Search results](https://platform.claude.com/docs/en/build-with-claude/search-results) | Enable natural citations for RAG applications by providing search results with proper source attribution. Achieve web search-quality citations for custom knowledge bases and tools. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
52| [Server-side fallback](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback) | Retry a refused request inside a single API call. Use the `"default"` mode to apply Anthropic's recommended fallback models, or name up to three models of your own; when the requested model declines, the API runs the next model in the chain on the same request. The `fallbacks` parameter is not available in the Message Batches API. | Not ZDR eligible\* | <PlatformAvailability claudeApiBeta /> |
53| [Structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) | Guarantee schema conformance with two approaches: JSON outputs for structured data responses, and strict tool use for validated tool inputs. | [ZDR eligible (qualified)](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#data-retention)\* | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
54| [Thinking](https://platform.claude.com/docs/en/build-with-claude/thinking) | Enhanced reasoning capabilities for complex tasks, with an optional summary of Claude's reasoning before its final answer. | ZDR eligible | <PlatformAvailability claudeApi claudePlatformAws bedrock vertexAi azureAi /> |
5555 
5656## Tools
5757 

build-with-claude/prompt-engineering/prompting-claude-fable-5-1 Changed · +11 / -11 lines

from line 178
178178 name = "demo"
179179 version = "0.1.0"
180180 description = "Demo project for the batching example"
181 `,
181 `
182182 ],
183183 [
184184 "README.md",
from line 185
185185 `# demo
186186 
187187 A small demo project. Run \`demo --help\` for usage.
188 `,
189 ],
188 `
189 ]
190190 ]);
191191 const tools: Anthropic.Beta.Messages.BetaTool[] = [
192192 {
from line 195
195195 input_schema: {
196196 type: "object",
197197 properties: { path: { type: "string" } },
198 required: ["path"],
199 },
200 },
198 required: ["path"]
199 }
200 }
201201 ];
202202 const messages: Anthropic.Beta.Messages.BetaMessageParam[] = [
203 { role: "user", content: "Summarize pyproject.toml and README.md." },
203 { role: "user", content: "Summarize pyproject.toml and README.md." }
204204 ];
205205 
206206 let response: Anthropic.Beta.Messages.BetaMessage;
from line 210
210210 max_tokens: 16000,
211211 betas: ["mid-conversation-system-clear-at-2026-08-21"],
212212 tools,
213 messages,
213 messages
214214 });
215215 // Append the assistant turn exactly as returned, thinking blocks included.
216216 messages.push({ role: "assistant", content: response.content });
from line 236
236236 type: "tool_result",
237237 tool_use_id: block.id,
238238 content: `File not found: ${path}`,
239 is_error: true,
239 is_error: true
240240 });
241241 continue;
242242 }
from line 243
243243 toolResults.push({
244244 type: "tool_result",
245245 tool_use_id: block.id,
246 content: text,
246 content: text
247247 });
248248 }
249249 // Send the tool results as the user turn, then a fresh copy of the nudge as a
from line 253
253253 messages.push({
254254 role: "system",
255255 content: BATCH_NUDGE,
256 clear_at: "next_user_message",
256 clear_at: "next_user_message"
257257 });
258258 }
259259 

build-with-claude/thinking-steering-and-cost Changed · +3 / -3 lines

from line 571
571571 ))
572572 .addAssistantMessageOfBlockParams(response1.content().stream()
573573 .map(block -> block.toParam())
574 .collect(java.util.stream.Collectors.toList()))
574 .collect(Collectors.toList()))
575575 .addUserMessage("Analyze the characters in this passage.")
576576 .build();
577577 
from line 598
598598 ))
599599 .addAssistantMessageOfBlockParams(response1.content().stream()
600600 .map(block -> block.toParam())
601 .collect(java.util.stream.Collectors.toList()))
601 .collect(Collectors.toList()))
602602 .addUserMessage("Analyze the characters in this passage.")
603603 .addAssistantMessageOfBlockParams(response2.content().stream()
604604 .map(block -> block.toParam())
605 .collect(java.util.stream.Collectors.toList()))
605 .collect(Collectors.toList()))
606606 .addUserMessage("Analyze the setting in this passage.")
607607 .build();
608608 

build-with-claude/vision-coordinates Changed · +1 / -7 lines

from line 276
276276 }
277277 return lo, max(int(math.RoundToEven(float64(lo)/aspectRatio)), 1)
278278 }
279 
280279 ```
281280 
282281 ```java Java
from line 533
534533 maxEdge = 1568,
535534 maxTokens = 1568
536535 ): [number, number] {
537 const [resizedW, resizedH] = resizedSize(
538 originalWidth,
539 originalHeight,
540 maxEdge,
541 maxTokens
542 );
536 const [resizedW, resizedH] = resizedSize(originalWidth, originalHeight, maxEdge, maxTokens);
543537 return [x / resizedW, y / resizedH];
544538 }
545539 

cli-sdks-libraries/cli/apply Changed · +6 / -4 lines

from line 107
107107 
108108Any resource except a skill can be written as YAML, JSON, or Markdown. In Markdown, the frontmatter is the body and the prose fills the kind's text field: an agent's `system`, an environment's or memory store's `description`, a deployment's first message. A vault has no text field, so `ant apply` refuses a vault Markdown file that has prose.
109109 
110Resources refer to each other by path. Wherever the API expects another resource's ID, write the relative path to that resource's file instead. In this project, the reviewer agent lists `../skills/pr-summary` under `skills`, the lead agent lists `./reviewer.md` in its roster, and the deployment names its agent, environment, and memory store by path. `ant apply` creates them in dependency order and fills in the real IDs. The project has six files:
110Resources refer to each other by path. Wherever the API expects another resource's ID, write the relative path to that resource's file instead. In this project, the reviewer agent lists `../skills/pr-summary` under `skills`, the agent in `agents/lead.md` lists `./reviewer.md` under `multiagent.subagents.predefined_agents`, and the deployment names its agent, environment, and memory store by path. `ant apply` creates them in dependency order and fills in the real IDs. A path under `multiagent.subagents.predefined_agents` or `multiagent.workflows.predefined_agents` needs CLI version 1.40.0 or later. The project has six files:
111111 
112112<FileExplorer>
113113 <File filename="agents/reviewer.md">
from line 131
131131 name: Engineering lead
132132 model: claude-opus-5-5
133133 multiagent:
134 type: coordinator
135 agents:
136 - ./reviewer.md
134 type: multiagent_20261001
135 subagents:
136 type: enabled
137 predefined_agents:
138 - ./reviewer.md
137139 ---
138140 
139141 You coordinate engineering work. Delegate code review to the reviewer.

home Changed · +6 / -6 lines

from line 16
1616 </HomeQuickChip>
1717 
1818 <HomeQuickChip icon="Key" href="https://platform.claude.com/settings/keys">
19 Get API key
19 Get API key in Claude Console
2020 </HomeQuickChip>
2121 
2222 <HomeQuickChip icon="CodeBrackets" href="https://platform.claude.com/docs/en/api/overview">
from line 251
251251 </HomeJourneyLink>
252252 
253253 <HomeJourneyLink icon="lock" href="https://platform.claude.com/settings/keys">
254 Get API key
254 Get API key in Claude Console
255255 </HomeJourneyLink>
256256 
257257 <HomeJourneyLink icon="settings" href="https://platform.claude.com/docs/en/models/overview">
from line 263
263263 </HomeJourneyLink>
264264 
265265 <HomeJourneyLink icon="message" href="https://platform.claude.com/playground">
266 Try the API in playground
266 Try the API in Console playground
267267 </HomeJourneyLink>
268268 </HomeJourneyStep>
269269 
from line 337
337337 </HomeJourneyLink>
338338 
339339 <HomeJourneyLink icon="lock" href="https://platform.claude.com/settings/keys">
340 API key management
340 API keys in Claude Console
341341 </HomeJourneyLink>
342342 
343343 <HomeJourneyLink icon="chart" href="https://platform.claude.com/docs/en/manage-claude/usage-cost-api">
from line 357
357357 </HomeJourneyLink>
358358 
359359 <HomeJourneyLink icon="lock" href="https://platform.claude.com/settings/keys">
360 Get API key
360 Get API key in Claude Console
361361 </HomeJourneyLink>
362362 
363363 <HomeJourneyLink icon="message" href="https://platform.claude.com/docs/en/managed-agents/onboarding">
from line 395
395395 </HomeJourneyLink>
396396 
397397 <HomeJourneyLink icon="lock" href="https://platform.claude.com/settings/keys">
398 API key management
398 API keys in Claude Console
399399 </HomeJourneyLink>
400400 
401401 <HomeJourneyLink icon="chart" href="https://platform.claude.com/docs/en/manage-claude/usage-cost-api">

manage-claude/plugins-api Changed · +17 / -17 lines

from line 1032
10321032 
10331033Besides a `400` for an upload that breaks the [upload requirements](https://platform.claude.com/docs/en/manage-claude/plugins-api#upload-requirements) (`413` for a request body over 200 MB) and the shared responses (a `403` when `marketplace_id` is a member's personal marketplace; see [Error responses](https://platform.claude.com/docs/en/manage-claude/plugins-api#error-responses)), a create can fail with:
10341034 
1035| Status | Cause | What to do |
1036| -------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1037| 404 | `marketplace_id` is not a marketplace of your organization. | Take the ID from [List marketplaces](https://platform.claude.com/docs/en/manage-claude/plugins-api#list-marketplaces). |
1038| 400 | The marketplace is synchronized from Git, or already holds 500 plugins and skills. | Upload to a `manual` marketplace, or change the repository instead. |
1039| 409 `plugin_name_taken` | The name is taken in that marketplace. | Continue with `details.plugin_id` (upload a version to it), or change the manifest `name`. |
1040| 409 `skill_name_taken` | The plugin is going into the library marketplace and one of its skills has an organization skill's name. | Rename the skill, or remove the organization skill in claude.ai. |
1041| 409 (no `error_code`) | Another upload with the same name to the same marketplace is still in progress. | Retry shortly. |
1042| 503 `registration_pending` | The plugin was created but its registration did not complete. | Do not resend; upload the same files as a version of `details.plugin_id` (see [Retrying uploads](https://platform.claude.com/docs/en/manage-claude/plugins-api#retrying-uploads)). |
1035| Status | Cause | What to do |
1036| -------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1037| 404 | `marketplace_id` is not a marketplace of your organization. | Take the ID from [List marketplaces](https://platform.claude.com/docs/en/manage-claude/plugins-api#list-marketplaces). |
1038| 400 | The marketplace is synchronized from Git, or already holds 500 plugins and skills. | Upload to a `manual` marketplace, or change the repository instead. |
1039| 409 `plugin_name_taken` | The name is taken in that marketplace. | Upload a version to `details.plugin_id` only if it is the plugin you meant to update, because someone else might have made it. Otherwise, upload under another name (change the manifest `name`). |
1040| 409 `skill_name_taken` | The plugin is going into the library marketplace and one of its skills has an organization skill's name. | Rename the skill, or remove the organization skill in claude.ai. |
1041| 409 (no `error_code`) | Another upload with the same name to the same marketplace is still in progress. | Retry shortly. |
1042| 503 `registration_pending` | The plugin was created but its registration did not complete. | Do not resend; upload the same files as a version of `details.plugin_id` (see [Retrying uploads](https://platform.claude.com/docs/en/manage-claude/plugins-api#retrying-uploads)). |
10431043 
10441044### Get a plugin
10451045 
from line 3178
31783178}
31793179```
31803180 
3181| `error_code` | Status | Meaning and what to do |
3182| ----------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3183| `plugin_name_taken` | 409 | A plugin with this name already exists in the marketplace. `details.plugin_id` is that plugin. If you are retrying a create whose response you lost, continue with that plugin. When `plugin_id` is absent, the name is held by a standalone skill: upload under another name, or delete the skill in claude.ai. |
3184| `skill_name_taken` | 409 | The plugin is in the library marketplace and one of its skills has the same name as an organization skill (a skill an administrator uploaded for the whole organization in claude.ai). `details.skill_name` names it. Rename or remove one of them. |
3185| `registration_pending` | 503 | The files were stored, but the plugin's skills could not yet be made available to members. See [Retrying uploads](https://platform.claude.com/docs/en/manage-claude/plugins-api#retrying-uploads). |
3186| `scan_pending` | 409 | The version's content scan is still running. Retry once it finishes. |
3187| `scan_failed` | 400 | The version's content scan failed, errored, or reached no verdict, so it cannot be served. Choose another version. |
3188| `cmek_key_disabled`, `cmek_key_network_blocked` | 400 | Your organization's customer-managed encryption key is unavailable. See [Customer-managed encryption keys](https://platform.claude.com/docs/en/manage-claude/plugins-api#customer-managed-encryption-keys). |
3181| `error_code` | Status | Meaning and what to do |
3182| ----------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3183| `plugin_name_taken` | 409 | A plugin with this name already exists in the marketplace. `details.plugin_id` is that plugin, and someone else might have made it. To see who, [get the plugin](https://platform.claude.com/docs/en/manage-claude/plugins-api#get-a-plugin) and read its `created_by`, which is `null` when no creator is recorded. Upload versions to it only if it is the plugin you meant to update. Otherwise, upload under another name. When `plugin_id` is absent, the name is held by a standalone skill: upload under another name, or delete the skill in claude.ai. |
3184| `skill_name_taken` | 409 | The plugin is in the library marketplace and one of its skills has the same name as an organization skill (a skill an administrator uploaded for the whole organization in claude.ai). `details.skill_name` names it. Rename or remove one of them. |
3185| `registration_pending` | 503 | The files were stored, but the plugin's skills could not yet be made available to members. See [Retrying uploads](https://platform.claude.com/docs/en/manage-claude/plugins-api#retrying-uploads). |
3186| `scan_pending` | 409 | The version's content scan is still running. Retry once it finishes. |
3187| `scan_failed` | 400 | The version's content scan failed, errored, or reached no verdict, so it cannot be served. Choose another version. |
3188| `cmek_key_disabled`, `cmek_key_network_blocked` | 400 | Your organization's customer-managed encryption key is unavailable. See [Customer-managed encryption keys](https://platform.claude.com/docs/en/manage-claude/plugins-api#customer-managed-encryption-keys). |
31893189 
31903190New codes may be added. Treat a code you do not recognize the way you treat its status.
31913191 
from line 3198
31983198* On `POST /v1/organizations/plugins`, the plugin *was* created, and the response carries `x-should-retry: false`: do not resend the create (a resend returns `409 plugin_name_taken`); instead upload the same files as a version of `details.plugin_id`.
31993199* On `POST /v1/organizations/plugins/{plugin_id}/versions`, the version *was* stored (`details.plugin_version_id`); resend the same request when the response carries `x-should-retry: true`, and do not when it carries `false`.
32003200 
3201If a create's response is lost, retry it: the retry returns `409 plugin_name_taken` with the plugin's ID in `details.plugin_id`, and you continue with that plugin. Retrying a version create whose response was lost stores a second, identical version. To avoid that, record the plugin's `latest_version_id` before each upload; if a response is lost, read the plugin and retry only if `latest_version_id` is unchanged.
3201If a create's response is lost, send the create again. A `409 plugin_name_taken` means either that the first attempt stored the plugin or that the name was already taken. Your lost create made the plugin in `details.plugin_id` only if its `created_by` is an `api_actor` with your key's `api_key_id`. Check that before you upload to it (see `plugin_name_taken` in the preceding table). Retrying a version create whose response was lost stores a second, identical version. To avoid that, record the plugin's `latest_version_id` before each upload; if a response is lost, read the plugin and retry only if `latest_version_id` is unchanged.
32023202 
32033203## Activity Feed events
32043204 

managed-agents/agent-setup Changed · +5 / -5 lines

from line 88
8888 name: "Coding Assistant",
8989 model: "claude-opus-5-5",
9090 system: "You are a helpful coding agent.",
91 tools: [{ type: "agent_toolset_20260401" }],
91 tools: [{ type: "agent_toolset_20260401" }]
9292 });
9393 ```
9494 
from line 263
263263 const agent = await client.beta.agents.create({
264264 name: "Geo-pinned assistant",
265265 model: { id: "claude-opus-5-5", inference_geo: "us" },
266 system: "You are a helpful assistant.",
266 system: "You are a helpful assistant."
267267 });
268268 
269269 console.log(`Inference geo: ${agent.model.inference_geo}`);
from line 396
396396 ```typescript TypeScript
397397 const updatedAgent = await client.beta.agents.update(agent.id, {
398398 version: agent.version,
399 system: "You are a helpful coding agent. Always write tests.",
399 system: "You are a helpful coding agent. Always write tests."
400400 });
401401 
402402 console.log(`New version: ${updatedAgent.version}`);
from line 488
488488 
489489 ```typescript TypeScript
490490 const unconditionalAgent = await client.beta.agents.update(agent.id, {
491 description: "Writes and reviews code.",
491 description: "Writes and reviews code."
492492 });
493493 
494494 console.log(`New version: ${unconditionalAgent.version}`);
from line 619
619619 const clearedAgent = await client.beta.agents.update(agent.id, {
620620 description: null,
621621 metadata: { team: null },
622 multiagent: { type: "multiagent_20261001", workflows: null },
622 multiagent: { type: "multiagent_20261001", workflows: null }
623623 });
624624 
625625 console.log(`Description: ${clearedAgent.description}`);

managed-agents/define-outcomes Changed · +6 / -6 lines

from line 112
112112 await writeFile("/tmp/rubric.md", RUBRIC);
113113 
114114 const rubric = await client.files.upload({
115 file: await toFile(readFile("/tmp/rubric.md"), "/tmp/rubric.md"),
115 file: await toFile(readFile("/tmp/rubric.md"), "/tmp/rubric.md")
116116 });
117117 console.log(`Uploaded rubric: ${rubric.id}`);
118118 ```
from line 367
367367 const session = await client.beta.sessions.create({
368368 agent: agent.id,
369369 environment_id: environment.id,
370 title: "Financial analysis on Costco",
370 title: "Financial analysis on Costco"
371371 });
372372 
373373 // Define the outcome — agent starts working on receipt
from line 378
378378 description: "Build a DCF model for Costco in .xlsx",
379379 rubric: { type: "text", content: RUBRIC },
380380 // or: rubric: { type: "file", file_id: rubric.id },
381 max_iterations: 5, // optional; default 3, max 20
382 },
383 ],
381 max_iterations: 5 // optional; default 3, max 20
382 }
383 ]
384384 });
385385 ```
386386 
from line 746
746746 // scope_id filtering requires the managed-agents beta on the files request
747747 const files = await client.beta.files.list({
748748 scope_id: session.id,
749 betas: ["managed-agents-2026-04-01"],
749 betas: ["managed-agents-2026-04-01"]
750750 });
751751 for (const file of files.data) {
752752 console.log(file.id, file.filename);

managed-agents/dreams Changed · +3 / -5 lines

from line 74
7474 let dream = await client.beta.dreams.create({
7575 inputs: [
7676 { type: "memory_store", memory_store_id: storeId },
77 { type: "sessions", session_ids: [sessionA, sessionB] },
77 { type: "sessions", session_ids: [sessionA, sessionB] }
7878 ],
7979 model: "claude-opus-5-5",
80 instructions: "Focus on coding-style preferences; ignore one-off debugging notes.",
80 instructions: "Focus on coding-style preferences; ignore one-off debugging notes."
8181 });
8282 console.log(dream.id); // drm_01...
8383 ```
from line 347
347347 await client.beta.sessions.create({
348348 agent: agentId,
349349 environment_id: environmentId,
350 resources: [
351 { type: "memory_store", memory_store_id: outputStoreId },
352 ],
350 resources: [{ type: "memory_store", memory_store_id: outputStoreId }]
353351 });
354352 ```
355353 

managed-agents/environments Changed · +3 / -3 lines

from line 69
6969 name: "python-dev",
7070 config: {
7171 type: "cloud",
72 networking: { type: "limited", allow_package_managers: true },
73 },
72 networking: { type: "limited", allow_package_managers: true }
73 }
7474 });
7575 
7676 console.log(`Environment ID: ${environment.id}`);
from line 181
181181 ```typescript TypeScript
182182 const session = await client.beta.sessions.create({
183183 agent: agent.id,
184 environment_id: environment.id,
184 environment_id: environment.id
185185 });
186186 ```
187187 

managed-agents/event-deltas Changed · +11 / -5 lines

from line 131
131131 events=[
132132 {
133133 "type": "user.message",
134 "content": [{"type": "text", "text": "Describe the repo in one sentence."}],
134 "content": [
135 {"type": "text", "text": "Describe the repo in one sentence."}
136 ],
135137 },
136138 ],
137139 )
from line 146
144146 previews[event.event.id] = snapshot
145147 print(f"event_start {event.event.type} {event.event.id}")
146148 case "event_delta":
147 preview = accumulate_managed_agents_event(previews.get(event.event_id), event)
149 preview = accumulate_managed_agents_event(
150 previews.get(event.event_id), event
151 )
148152 if preview is not None:
149153 previews[event.event_id] = preview
150154 text = "".join(block.text for block in preview.content)
from line 155
151155 print(f"event_delta preview: {text!r}")
152156 case "agent.message":
153157 # The buffered event is the record: it replaces and closes the preview
154 preview = accumulate_managed_agents_event(previews.pop(event.id, None), event)
158 preview = accumulate_managed_agents_event(
159 previews.pop(event.id, None), event
160 )
155161 text = "".join(block.text for block in preview.content)
156162 print(f"agent.message {event.id} {text!r}")
157163 case "span.model_request_end":
from line 177
171177 
172178 // Opt in to agent.message previews for this connection only
173179 const stream = await client.beta.sessions.events.stream(session.id, {
174 event_deltas: ["agent.message"],
180 event_deltas: ["agent.message"]
175181 });
176182 await client.beta.sessions.events.send(session.id, {
177183 events: [
from line 642
636642 // session stream.
637643 const stream = await client.beta.sessions.threads.events.stream(childThreadId, {
638644 session_id: session.id,
639 event_deltas: ["agent.message"],
645 event_deltas: ["agent.message"]
640646 });
641647 
642648 threadDeltas: for await (const event of stream) {

managed-agents/events-and-streaming Changed · +27 / -27 lines

from line 566
566566 content: [
567567 {
568568 type: "text",
569 text: "Analyze the performance of the sort function in utils.py",
570 },
571 ],
572 },
573 ],
569 text: "Analyze the performance of the sort function in utils.py"
570 }
571 ]
572 }
573 ]
574574 });
575575 ```
576576 
from line 742
742742 {
743743 type: "user.custom_tool_result",
744744 custom_tool_use_id: event.id,
745 content: [{ type: "text", text: result }],
746 },
747 ],
745 content: [{ type: "text", text: result }]
746 }
747 ]
748748 });
749749 break;
750750 }
from line 977
977977 {
978978 type: "user.tool_confirmation",
979979 tool_use_id: eventId,
980 result: "allow",
981 },
982 ],
980 result: "allow"
981 }
982 ]
983983 });
984984 }
985985 }
from line 1190
11901190 content: [
11911191 {
11921192 type: "text",
1193 text: "Now run the tests against the changes you made earlier.",
1194 },
1195 ],
1196 },
1197 ],
1193 text: "Now run the tests against the changes you made earlier."
1194 }
1195 ]
1196 }
1197 ]
11981198 });
11991199 ```
12001200 
from line 1366
13661366 content: [
13671367 {
13681368 type: "text",
1369 text: "Instead, focus on fixing the bug in line 42.",
1370 },
1371 ],
1372 },
1373 ],
1369 text: "Instead, focus on fixing the bug in line 42."
1370 }
1371 ]
1372 }
1373 ]
13741374 });
13751375 ```
13761376 
from line 1589
15891589 
15901590 ```typescript TypeScript
15911591 const events = await client.beta.sessions.events.list(session.id, {
1592 types: ["agent.tool_use", "agent.tool_result"],
1592 types: ["agent.tool_use", "agent.tool_result"]
15931593 });
15941594 for (const event of events.data) {
15951595 console.log(`[${event.type}] ${event.processed_at}`);
from line 1717
17171717 content: [
17181718 {
17191719 type: "text",
1720 text: "The user's current timezone is America/New_York.",
1721 },
1722 ],
1723 },
1724 ],
1720 text: "The user's current timezone is America/New_York."
1721 }
1722 ]
1723 }
1724 ]
17251725 });
17261726 ```
17271727 

managed-agents/files Changed · +6 / -6 lines

from line 36
3636 
3737 ```typescript TypeScript
3838 const file = await client.files.upload({
39 file: await toFile(readFile("data.csv"), "data.csv", { type: "text/csv" }),
39 file: await toFile(readFile("data.csv"), "data.csv", { type: "text/csv" })
4040 });
4141 console.log(`File ID: ${file.id}`);
4242 ```
from line 144
144144 {
145145 type: "file",
146146 file_id: file.id,
147 mount_path: "/data.csv",
148 },
149 ],
147 mount_path: "/data.csv"
148 }
149 ]
150150 });
151151 ```
152152 
from line 390
390390 ```typescript TypeScript
391391 const resource = await client.beta.sessions.resources.add(session.id, {
392392 type: "file",
393 file_id: file.id,
393 file_id: file.id
394394 });
395395 if (resource.type !== "file") {
396396 throw new Error(`Unexpected resource type: ${resource.type}`);
from line 494
494494 }
495495 
496496 await client.beta.sessions.resources.delete(resource.id, {
497 session_id: session.id,
497 session_id: session.id
498498 });
499499 ```
500500 

managed-agents/github Changed · +18 / -20 lines

from line 102
102102 {
103103 type: "url",
104104 name: "github",
105 url: "https://api.githubcopilot.com/mcp/",
106 },
105 url: "https://api.githubcopilot.com/mcp/"
106 }
107107 ],
108108 tools: [
109109 { type: "agent_toolset_20260401" },
110110 {
111111 type: "mcp_toolset",
112 mcp_server_name: "github",
113 },
114 ],
112 mcp_server_name: "github"
113 }
114 ]
115115 });
116116 ```
117117 
from line 299
299299 type: "github_repository",
300300 url: "https://github.com/org/repo",
301301 mount_path: "/workspace/repo",
302 authorization_token: "ghp_your_github_token",
303 },
304 ],
302 authorization_token: "ghp_your_github_token"
303 }
304 ]
305305 });
306306 ```
307307 
from line 486
486486 type: "github_repository",
487487 url: "https://github.com/org/frontend",
488488 mount_path: "/workspace/frontend",
489 authorization_token: "ghp_your_github_token",
489 authorization_token: "ghp_your_github_token"
490490 },
491491 {
492492 type: "github_repository",
493493 url: "https://github.com/org/backend",
494494 mount_path: "/workspace/backend",
495 authorization_token: "ghp_your_github_token",
496 },
495 authorization_token: "ghp_your_github_token"
496 }
497497 ];
498498 ```
499499 
from line 641
641641 ```typescript TypeScript
642642 // List resources on the session
643643 const listed = await client.beta.sessions.resources.list(session.id);
644 const repoResource = listed.data.find(
645 (entry) => entry.type === "github_repository",
646 );
644 const repoResource = listed.data.find((entry) => entry.type === "github_repository");
647645 if (!repoResource) {
648646 throw new Error("No GitHub repository resource on the session");
649647 }
from line 651
653651 // Rotate the authorization token
654652 await client.beta.sessions.resources.update(repoResourceId, {
655653 session_id: session.id,
656 authorization_token: "ghp_your_new_github_token",
654 authorization_token: "ghp_your_new_github_token"
657655 });
658656 ```
659657 
from line 791
793791 content: [
794792 {
795793 type: "text",
796 text: "Fix the type error in src/utils.ts, commit it to a new branch, and push it.",
797 },
798 ],
799 },
800 ],
794 text: "Fix the type error in src/utils.ts, commit it to a new branch, and push it."
795 }
796 ]
797 }
798 ]
801799 });
802800 ```
803801 

managed-agents/mcp-connector Changed · +5 / -5 lines

from line 98
9898 {
9999 type: "url",
100100 name: "github",
101 url: "https://api.githubcopilot.com/mcp/",
102 },
101 url: "https://api.githubcopilot.com/mcp/"
102 }
103103 ],
104104 tools: [
105105 { type: "agent_toolset_20260401" },
106 { type: "mcp_toolset", mcp_server_name: "github" },
107 ],
106 { type: "mcp_toolset", mcp_server_name: "github" }
107 ]
108108 });
109109 ```
110110 
from line 322
322322 const session = await client.beta.sessions.create({
323323 agent: agent.id,
324324 environment_id: environment.id,
325 vault_ids: [vault.id],
325 vault_ids: [vault.id]
326326 });
327327 ```
328328 

managed-agents/multiagent-orchestration Changed · +14 / -16 lines

from line 221
221221 type: "enabled",
222222 predefined_agents: [
223223 { type: "agent", id: reviewerAgent.id },
224 { type: "agent", id: testWriterAgent.id },
225 ],
226 },
227 },
224 { type: "agent", id: testWriterAgent.id }
225 ]
226 }
227 }
228228 });
229229 ```
230230 
from line 395
395395 ```typescript TypeScript
396396 const session = await client.beta.sessions.create({
397397 agent: leadAgent.id,
398 environment_id: environment.id,
398 environment_id: environment.id
399399 });
400400 ```
401401 
from line 556
556556 const researchAgent = await client.beta.agents.create({
557557 name: "researcher",
558558 model: "claude-haiku-5-5",
559 mcp_servers: [
560 { type: "url", name: "github", url: "https://api.githubcopilot.com/mcp/" },
561 ],
562 tools: [{ type: "mcp_toolset", mcp_server_name: "github" }],
559 mcp_servers: [{ type: "url", name: "github", url: "https://api.githubcopilot.com/mcp/" }],
560 tools: [{ type: "mcp_toolset", mcp_server_name: "github" }]
563561 });
564562 
565563 const leadAgent = await client.beta.agents.create({
from line 568
570568 type: "multiagent_20261001",
571569 subagents: {
572570 type: "enabled",
573 predefined_agents: [{ type: "agent", id: researchAgent.id }],
574 },
575 },
571 predefined_agents: [{ type: "agent", id: researchAgent.id }]
572 }
573 }
576574 });
577575 ```
578576 
from line 807
809807 const session = await client.beta.sessions.create({
810808 agent: leadAgent.id,
811809 environment_id: environment.id,
812 vault_ids: [vault.id],
810 vault_ids: [vault.id]
813811 });
814812 console.log(session.id);
815813 ```
from line 944
946944 system:
947945 "You review contracts. When you're asked to review more than a few contracts, start a workflow run that reads them in parallel and combines the findings. Review one or two contracts yourself, without a run.",
948946 tools: [{ type: "agent_toolset_20260401" }],
949 multiagent: { type: "multiagent_20261001", workflows: { type: "enabled" } },
947 multiagent: { type: "multiagent_20261001", workflows: { type: "enabled" } }
950948 });
951949 ```
952950 
from line 1174
11761174 "You implement backend features end to end. Consult the advisor before major backend design decisions.",
11771175 multiagent: {
11781176 type: "multiagent_20261001",
1179 advisor: { type: "enabled", model: "claude-opus-5-5" },
1180 },
1177 advisor: { type: "enabled", model: "claude-opus-5-5" }
1178 }
11811179 });
11821180 console.log(agent.id);
11831181 ```

managed-agents/quickstart Changed · +10 / -12 lines

from line 34
3434## Prerequisites
3535 
3636* A [Claude Console account](https://platform.claude.com)
37* An [API key](https://platform.claude.com/settings/keys)
37* An [API key](https://platform.claude.com/settings/keys) from the Console
3838 
3939## Install the CLI
4040 
from line 214
214214 name: "Coding Assistant",
215215 model: "claude-opus-5-5",
216216 system: "You are a helpful coding assistant. Write clean, well-documented code.",
217 tools: [
218 { type: "agent_toolset_20260401" },
219 ],
217 tools: [{ type: "agent_toolset_20260401" }]
220218 });
221219 
222220 console.log(`Agent ID: ${agent.id}, version: ${agent.version}`);
from line 431
433431 name: "quickstart-env",
434432 config: {
435433 type: "cloud",
436 networking: { type: "limited", allow_package_managers: true },
437 },
434 networking: { type: "limited", allow_package_managers: true }
435 }
438436 });
439437 
440438 console.log(`Environment ID: ${environment.id}`);
from line 580
582580 const session = await client.beta.sessions.create({
583581 agent: agent.id,
584582 environment_id: environment.id,
585 title: "Quickstart session",
583 title: "Quickstart session"
586584 });
587585 
588586 console.log(`Session ID: ${session.id}`);
from line 697
699697 content: [
700698 {
701699 type: "text",
702 text: "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt",
703 },
704 ],
705 },
706 ],
700 text: "Create a Python script that generates the first 20 Fibonacci numbers and saves them to fibonacci.txt"
701 }
702 ]
703 }
704 ]
707705 });
708706 
709707 // Process streaming events

managed-agents/scheduled-deployments Changed · +8 / -8 lines

from line 103
103103 initial_events: [
104104 {
105105 type: "user.message",
106 content: [{ type: "text", text: "Run the weekly compliance scan." }],
107 },
106 content: [{ type: "text", text: "Run the weekly compliance scan." }]
107 }
108108 ],
109109 schedule: {
110110 type: "cron",
111111 expression: "0 20 * * 5",
112 timezone: "America/New_York",
113 },
112 timezone: "America/New_York"
113 }
114114 });
115115 ```
116116 
from line 335
335335 const updatedDeployment = await client.beta.deployments.update(deployment.id, {
336336 budget: {
337337 type: "limit",
338 max_list_cost: { amount: "2000", currency: "USD" },
339 },
338 max_list_cost: { amount: "2000", currency: "USD" }
339 }
340340 });
341341 console.log(updatedDeployment.budget?.max_list_cost.amount); // 2000
342342 ```
from line 437
437437 
438438 ```typescript TypeScript
439439 for await (const run of client.beta.deploymentRuns.list({
440 deployment_id: deployment.id,
440 deployment_id: deployment.id
441441 })) {
442442 console.log(run.created_at, run.session_id ?? run.error?.type);
443443 }
from line 528
528528 ```typescript TypeScript
529529 for await (const run of client.beta.deploymentRuns.list({
530530 deployment_id: deployment.id,
531 has_error: true,
531 has_error: true
532532 })) {
533533 console.log(run.created_at, run.error?.type, run.error?.message);
534534 }

managed-agents/self-hosted-sandboxes-custom-tools Changed · +5 / -4 lines

from line 172
172172 log.Fatalf("worker: %v", err)
173173 }
174174 }
175 
176175 ```
177176 
178177 <CodeGroupItem language="Java">
from line 222
223222 from anthropic import AsyncAnthropic
224223 from anthropic.types.beta import BetaManagedAgentsCustomToolParams
225224 from mcp import ClientSession, types
225 
226226 # Requires mcp >= 1.24, which renamed streamablehttp_client to streamable_http_client.
227227 from mcp.client.streamable_http import streamable_http_client
228228 
from line 456
456456 }
457457 fmt.Println(agent.ID)
458458 }
459 
460459 ```
461460 
462461 ```java Java
from line 608
609608 from anthropic.lib.tools.agent_toolset import beta_agent_toolset_20260401
610609 from anthropic.lib.tools.mcp import async_mcp_tool
611610 from mcp import ClientSession
611 
612612 # Requires mcp >= 1.24, which renamed streamablehttp_client to streamable_http_client.
613613 from mcp.client.streamable_http import streamable_http_client
614614 
from line 623
623623 # result instead of a stalled call.
624624 async with (
625625 streamable_http_client(MCP_SERVER_URL) as (read, write, _),
626 ClientSession(read, write, read_timeout_seconds=timedelta(seconds=60)) as mcp_session,
626 ClientSession(
627 read, write, read_timeout_seconds=timedelta(seconds=60)
628 ) as mcp_session,
627629 AsyncAnthropic(auth_token=environment_key) as client,
628630 ):
629631 await mcp_session.initialize()
from line 748
746748 log.Fatalf("worker: %v", err)
747749 }
748750 }
749 
750751 ```
751752 
752753 <CodeGroupItem language="Java">

managed-agents/self-hosted-sandboxes-workers Changed · +3 / -4 lines

from line 138
138138 log.Fatalf("worker: %v", err)
139139 }
140140 }
141 
142141 ```
143142 
144143 <CodeGroupItem language="Java">
from line 406
407406 slog.Error("http shutdown", "err", err)
408407 }
409408 }
410 
411409 ```
412410 
413411 <CodeGroupItem language="Java">
from line 706
708706 
709707 
710708 async def main() -> None:
711 async with AsyncAnthropic(auth_token=os.environ["ANTHROPIC_ENVIRONMENT_KEY"]) as client:
709 async with AsyncAnthropic(
710 auth_token=os.environ["ANTHROPIC_ENVIRONMENT_KEY"]
711 ) as client:
712712 worker = EnvironmentWorker(client, workdir="/workspace")
713713 # With no arguments, handle_item() reads the ANTHROPIC_* variables the spawn
714714 # script forwarded, including ANTHROPIC_WORK_SECRET.
from line 780
780780 log.Fatalf("worker: %v", err)
781781 }
782782 }
783 
784783 ```
785784 
786785 <CodeGroupItem language="Java">

managed-agents/session-threads Changed · +9 / -9 lines

from line 135
135135 
136136 ```typescript TypeScript
137137 await client.beta.sessions.events.send(session.id, {
138 events: [{ type: "user.interrupt", session_thread_id: thread.id }],
138 events: [{ type: "user.interrupt", session_thread_id: thread.id }]
139139 });
140140 ```
141141 
from line 221
221221 
222222 ```typescript TypeScript
223223 const archived = await client.beta.sessions.threads.archive(thread.id, {
224 session_id: session.id,
224 session_id: session.id
225225 });
226226 console.log(archived.status, archived.archived_at);
227227 ```
from line 300
300300 
301301 ```typescript TypeScript
302302 await client.beta.sessions.events.send(session.id, {
303 events: [{ type: "user.interrupt", session_thread_id: thread.id }],
303 events: [{ type: "user.interrupt", session_thread_id: thread.id }]
304304 });
305305 const archived = await client.beta.sessions.threads.archive(thread.id, {
306 session_id: session.id,
306 session_id: session.id
307307 });
308308 console.log(archived.status, archived.archived_at);
309309 ```
from line 447
447447 
448448 ```typescript TypeScript
449449 const stream = await client.beta.sessions.threads.events.stream(thread.id, {
450 session_id: session.id,
450 session_id: session.id
451451 });
452452 
453453 loop: for await (const event of stream) {
from line 594
594594 
595595 ```typescript TypeScript
596596 for await (const event of client.beta.sessions.threads.events.list(thread.id, {
597 session_id: session.id,
597 session_id: session.id
598598 })) {
599599 console.log(`[${event.type}] ${event.processed_at}`);
600600 }
from line 712
712712 {
713713 type: "user.tool_confirmation",
714714 tool_use_id: eventId,
715 result: "allow",
716 },
717 ],
715 result: "allow"
716 }
717 ]
718718 });
719719 }
720720 ```

managed-agents/skills Changed · +3 / -3 lines

from line 487
487487 type: "github_repository",
488488 url: "https://github.com/org/repo",
489489 mount_path: "/workspace/repo",
490 authorization_token: "ghp_your_github_token",
491 },
492 ],
490 authorization_token: "ghp_your_github_token"
491 }
492 ]
493493 });
494494 ```
495495 

managed-agents/vaults Changed · +24 / -20 lines

from line 61
6161 ```typescript TypeScript
6262 const vault = await client.beta.vaults.create({
6363 display_name: "Alice",
64 metadata: { external_user_id: "usr_abc123" },
64 metadata: { external_user_id: "usr_abc123" }
6565 });
6666 console.log(vault.id); // "vlt_01ABC..."
6767 ```
from line 213
213213 "client_id": "1234567890.0987654321",
214214 "scope": "channels:read chat:write",
215215 "refresh_token": "xoxe-1-...",
216 "token_endpoint_auth": {"type": "client_secret_post", "client_secret": "abc123..."},
216 "token_endpoint_auth": {
217 "type": "client_secret_post",
218 "client_secret": "abc123...",
219 },
217220 },
218221 },
219222 )
from line 237
234237 refresh_token: "xoxe-1-...",
235238 token_endpoint_auth: {
236239 type: "client_secret_post",
237 client_secret: "abc123...",
238 },
239 },
240 },
240 client_secret: "abc123..."
241 }
242 }
243 }
241244 });
242245 ```
243246 
from line 419
416419 auth: {
417420 type: "static_bearer",
418421 mcp_server_url: "https://mcp.linear.app/mcp",
419 token: "lin_api_your_linear_key",
420 },
422 token: "lin_api_your_linear_key"
423 }
421424 });
422425 ```
423426 
from line 561
558561 )
559562 if env_credential.auth.type == "environment_variable":
560563 location = env_credential.auth.injection_location
561 print(f"header: {location.header}, body: {location.body}") # header: True, body: False
564 print(
565 f"header: {location.header}, body: {location.body}"
566 ) # header: True, body: False
562567 ```
563568 
564569 ```typescript TypeScript
from line 575
570575 secret_value: "ntn_your-secret-here",
571576 networking: {
572577 type: "limited",
573 allowed_hosts: ["api.notion.com"],
578 allowed_hosts: ["api.notion.com"]
574579 },
575 injection_location: { header: true },
576 },
580 injection_location: { header: true }
581 }
577582 });
578583 if (envVarCredential.auth.type === "environment_variable") {
579584 console.log(envVarCredential.auth.injection_location); // { header: true, body: false }
from line 780
775780 agent: agent.id,
776781 environment_id: environment.id,
777782 vault_ids: [vault.id],
778 title: "Alice's Slack digest",
783 title: "Alice's Slack digest"
779784 });
780785 ```
781786 
from line 900
895900 access_token: "xoxp-new-...",
896901 expires_at: "2099-12-31T23:59:59Z",
897902 refresh: {
898 refresh_token: "xoxe-1-new-...",
899 },
900 },
903 refresh_token: "xoxe-1-new-..."
904 }
905 }
901906 });
902907 ```
903908 
from line 1035
10301035 ```
10311036 
10321037 ```typescript TypeScript
1033 const validation = await client.beta.vaults.credentials.mcpOAuthValidate(
1034 credential.id,
1035 { vault_id: vault.id },
1036 );
1038 const validation = await client.beta.vaults.credentials.mcpOAuthValidate(credential.id, {
1039 vault_id: vault.id
1040 });
10371041 console.log(validation.status); // "valid", "invalid", or "unknown"
10381042 ```
10391043 
Feedback