Skip to content

Commit c456fcd

Browse files
github-actions[bot]claude-yolo[bot]
authored andcommitted
docs: Claude Code v2.1.212 - Agent SDK new fields, remote isolation, Zod schema fix
Co-Authored-By: claude-yolo[bot] <claude-yolo@lroole.com>
1 parent ea01f93 commit c456fcd

85 files changed

Lines changed: 1834 additions & 785 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

content/.metadata.json

Lines changed: 153 additions & 153 deletions
Large diffs are not rendered by default.

content/en/docs/claude-code/agent-sdk/python.md

Lines changed: 274 additions & 87 deletions
Large diffs are not rendered by default.

content/en/docs/claude-code/agent-sdk/structured-outputs.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ Instead of writing JSON Schema by hand, you can use [Zod](https://zod.dev/) (Typ
140140

141141
The example below defines a schema for a feature implementation plan with a summary, list of steps (each with complexity level), and potential risks. The agent plans the feature and returns a typed `FeaturePlan` object. You can then access properties like `plan.summary` and iterate over `plan.steps` with full type safety.
142142

143+
The SDK validates schemas with JSON Schema draft-07, so schemas that declare a newer version are rejected. Zod targets draft 2020-12 by default, so pass `target: "draft-7"` when converting your schema.
144+
143145
<CodeGroup>
144146
```typescript TypeScript theme={null}
145147
import { z } from "zod";
@@ -161,8 +163,8 @@ The example below defines a schema for a feature implementation plan with a summ
161163

162164
type FeaturePlan = z.infer<typeof FeaturePlan>;
163165

164-
// Convert to JSON Schema
165-
const schema = z.toJSONSchema(FeaturePlan);
166+
// Convert to JSON Schema using the draft-07 target the SDK expects
167+
const schema = z.toJSONSchema(FeaturePlan, { target: "draft-7" });
166168

167169
// Use in query
168170
try {
@@ -257,7 +259,7 @@ The example below defines a schema for a feature implementation plan with a summ
257259
The `outputFormat` (TypeScript) or `output_format` (Python) option accepts an object with:
258260

259261
* `type`: Set to `"json_schema"` for structured outputs
260-
* `schema`: A [JSON Schema](https://json-schema.org/understanding-json-schema/about) object defining your output structure. You can generate this from a Zod schema with `z.toJSONSchema()` or a Pydantic model with `.model_json_schema()`
262+
* `schema`: A [JSON Schema](https://json-schema.org/understanding-json-schema/about) object defining your output structure. You can generate this from a Zod schema with `z.toJSONSchema(schema, { target: "draft-7" })` or a Pydantic model with `.model_json_schema()`
261263

262264
The SDK supports standard JSON Schema features including all basic types (object, array, string, number, boolean, null), `enum`, `const`, `required`, nested objects, and `$ref` definitions. For the full list of supported features and limitations, see [JSON Schema limitations](https://platform.claude.com/docs/en/build-with-claude/structured-outputs#json-schema-limitations).
263265

@@ -383,7 +385,7 @@ The schema includes optional fields (`author` and `date`) since git blame inform
383385

384386
## Error handling
385387

386-
Structured output generation can fail when the agent cannot produce valid JSON matching your schema. This typically happens when the schema is too complex for the task, the task itself is ambiguous, or the agent hits its retry limit trying to fix validation errors. It can also happen without any validation failure: a [model fallback](/en/model-config#automatic-model-fallback) can retract an already-completed output mid-stream, and if no retry replaces it the run ends with the same error. Check the `errors` field on the result message to tell the two causes apart before debugging your schema.
388+
Structured output generation can fail when the agent cannot produce valid JSON matching your schema. This typically happens when the schema is too complex for the task, the task itself is ambiguous, or the agent hits its retry limit trying to fix validation errors. It can also happen without any validation failure: a [model fallback](/en/model-config#automatic-model-fallback) can retract an already-completed output mid-stream, and if no retry replaces it the run ends with the same error. Check the `errors` list on the result message to tell the two causes apart before debugging your schema.
387389

388390
When an error occurs, the result message has a `subtype` indicating what went wrong:
389391

@@ -392,7 +394,7 @@ When an error occurs, the result message has a `subtype` indicating what went wr
392394
| `success` | Output was generated and validated successfully |
393395
| `error_max_structured_output_retries` | No valid output remained after multiple attempts (validation failures, or a model-fallback retraction with no successful retry) |
394396

395-
The example below checks the `subtype` field to determine whether the output was generated successfully or if you need to handle a failure:
397+
A result can also end with subtype `success` but no `structured_output` value, for example when the run completes without the agent producing a structured output. Treat that case as a failure as well. The example below treats a result as successful only when the `subtype` is `success` and `structured_output` is present, and handles every other result as a failure:
396398

397399
<CodeGroup>
398400
```typescript TypeScript theme={null}
@@ -423,6 +425,8 @@ The example below checks the `subtype` field to determine whether the output was
423425
console.log(msg.structured_output);
424426
} else if (msg.subtype === "error_max_structured_output_retries") {
425427
console.error("Could not produce valid output");
428+
} else {
429+
console.error("Run ended without a structured output");
426430
}
427431
}
428432
}
@@ -464,6 +468,8 @@ The example below checks the `subtype` field to determine whether the output was
464468
print(message.structured_output)
465469
elif message.subtype == "error_max_structured_output_retries":
466470
print("Could not produce valid output")
471+
else:
472+
print("Run ended without a structured output")
467473
except Exception as error:
468474
# A single-shot query() raises after yielding an error result.
469475
# If the failure was an error result, the subtype branches above

content/en/docs/claude-code/agent-sdk/typescript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ type PermissionMode =
804804
| "bypassPermissions" // Bypass permission checks; explicit ask rules still prompt
805805
| "plan" // Planning mode - explore without editing
806806
| "dontAsk" // Don't prompt for permissions, deny if not pre-approved
807-
| "auto"; // Use a model classifier to approve or deny each tool call
807+
| "auto"; // Model classifier approves or denies permission prompts
808808
```
809809
810810
### `CanUseTool`
@@ -1838,7 +1838,7 @@ type AgentInput = {
18381838
run_in_background?: boolean;
18391839
name?: string;
18401840
mode?: "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan";
1841-
isolation?: "worktree";
1841+
isolation?: "worktree" | "remote";
18421842
};
18431843
```
18441844

content/en/docs/claude-code/memory.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ This limit applies only to `MEMORY.md`. CLAUDE.md files are loaded in full regar
383383

384384
Topic files like `debugging.md` or `patterns.md` are not loaded at startup. Claude reads them on demand using its standard file tools when it needs the information.
385385

386+
The main conversation's auto memory isn't loaded into [subagents](/en/sub-agents#what-loads-at-startup); the exception is a [fork](/en/sub-agents#fork-the-current-conversation), which inherits the parent conversation and system prompt. A subagent's own auto memory, enabled with the subagent `memory` field, is a separate directory.
387+
386388
Claude reads and writes memory files during your session. When you see "Writing memory" or "Recalled memory" in the Claude Code interface, Claude is actively updating or reading from `~/.claude/projects/<project>/memory/`.
387389

388390
### Audit and edit your memory

content/en/docs/claude-code/output-styles.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ Output styles directly modify Claude Code's system prompt.
101101
* All output styles trigger reminders for Claude to adhere to the output style instructions during the conversation.
102102
* Custom output styles leave out Claude Code's built-in software engineering instructions, such as how to scope changes, write comments, and verify work, unless `keep-coding-instructions` is set to `true`.
103103

104+
Output styles apply to the main conversation only: a [subagent runs its own system prompt](/en/sub-agents#what-loads-at-startup), so styles don't change how subagents respond. A [fork](/en/sub-agents#fork-the-current-conversation) is the exception, because it inherits the parent's full system prompt.
105+
104106
Token usage depends on the style. Adding instructions to the system prompt increases input tokens, though prompt caching reduces this cost after the first request in a session. The built-in Explanatory and Learning styles produce longer responses than Default by design, which increases output tokens. For custom styles, output token usage depends on what your instructions tell Claude to produce.
105107

106108
## Comparisons to related features

content/en/docs/claude-code/sub-agents.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ Subagents inherit the [internal tools](/en/tools-reference) and MCP tools availa
327327
* `ScheduleWakeup`
328328
* `WaitForMcpServers`
329329

330+
The `Agent` tool itself is inherited, so a subagent can [spawn nested subagents](#spawn-nested-subagents).
331+
330332
To restrict tools, use the `tools` field as an allowlist or the `disallowedTools` field as a denylist. This example uses `tools` to allow only Read, Grep, Glob, and Bash. The subagent can't edit files, write files, or use any MCP tools:
331333

332334
```yaml theme={null}
@@ -855,7 +857,7 @@ A non-fork subagent's initial context contains:
855857

856858
* **System prompt**: the agent's own prompt plus environment details that Claude Code appends, not the full Claude Code system prompt. Custom subagents define theirs in the [markdown body](#write-subagent-files) or `prompt` field. Built-in agents have predefined prompts.
857859
* **Task message**: the delegation prompt Claude writes when it hands off the work.
858-
* **CLAUDE.md and memory**: every level of the [memory hierarchy](/en/memory#how-claude-md-files-load) the main conversation loads, including `~/.claude/CLAUDE.md`, project rules, `CLAUDE.local.md`, and managed policy files. The built-in Explore and Plan agents skip this.
860+
* **CLAUDE.md files**: every level of the [CLAUDE.md hierarchy](/en/memory#how-claude-md-files-load) the main conversation loads, including `~/.claude/CLAUDE.md`, project rules, `CLAUDE.local.md`, and managed policy files. The built-in Explore and Plan agents skip this.
859861
* **Git status**: a snapshot taken at the start of the parent session. Absent when the working directory isn't a Git repository or when [`includeGitInstructions`](/en/settings#available-settings) is `false`. Explore and Plan skip it regardless.
860862
* **Preloaded skills**: full content of any skill named in the agent's [`skills` field](#preload-skills-into-subagents). Built-in agents don't preload skills.
861863
* **Sibling roster**: a system reminder listing `main` and every other named agent in the session, each a valid `to` value for [`SendMessage`](#resume-subagents). {/* min-version: 2.1.206 */}Requires Claude Code v2.1.206 or later. The roster appears only when the subagent's tools include `SendMessage` and at least one other agent has a name, whether Claude named it when spawning it or it runs as an [agent team](/en/agent-teams) teammate. It is a snapshot taken when the subagent starts, so agents named later don't appear.
@@ -864,6 +866,12 @@ Explore and Plan are the only subagents that omit CLAUDE.md and git status. Ther
864866

865867
The main conversation reads Explore and Plan results with full CLAUDE.md context, so most rules don't need to reach the subagent itself. If a rule must, such as "ignore the `vendor/` directory," restate it in the prompt you give Claude when delegating.
866868

869+
Some main-conversation state never reaches a non-fork subagent:
870+
871+
* **Output style**: a subagent runs its own system prompt, so your [output style](/en/output-styles) doesn't shape its responses, except in a [fork](#fork-the-current-conversation).
872+
* **Auto memory**: the main conversation's [auto memory](/en/memory#auto-memory) isn't loaded. To give a subagent persistent memory of its own, use the [`memory` field](#enable-persistent-memory).
873+
* **Context window size**: a subagent's context window is sized by its own model, not the parent's. Delegating to a model with a smaller window gives that subagent the smaller window.
874+
867875
#### Resume subagents
868876

869877
Each subagent invocation creates a new instance with fresh context. To continue an existing subagent's work instead of starting over, ask Claude to resume it.

content/github/anthropic-sdk-typescript/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.112.2 (2026-07-17)
4+
5+
Full Changelog: [sdk-v0.112.1...sdk-v0.112.2](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.112.1...sdk-v0.112.2)
6+
7+
### Chores
8+
9+
* **client:** docs updates ([fdb3a65](https://github.com/anthropics/anthropic-sdk-typescript/commit/fdb3a65501a809b4e949131f2097dc0d84e01cc7))
10+
311
## 0.112.1 (2026-07-16)
412

513
Full Changelog: [sdk-v0.112.0...sdk-v0.112.1](https://github.com/anthropics/anthropic-sdk-typescript/compare/sdk-v0.112.0...sdk-v0.112.1)

content/github/anthropic-sdk-typescript/packages/google-cloud-sdk/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.0.5 (2026-07-17)
4+
5+
Full Changelog: [google-cloud-sdk-v0.0.4...google-cloud-sdk-v0.0.5](https://github.com/anthropics/anthropic-sdk-typescript/compare/google-cloud-sdk-v0.0.4...google-cloud-sdk-v0.0.5)
6+
7+
### Chores
8+
9+
* **internal:** version bump
10+
311
## 0.0.4 (2026-07-16)
412

513
Full Changelog: [google-cloud-sdk-v0.0.3...google-cloud-sdk-v0.0.4](https://github.com/anthropics/anthropic-sdk-typescript/compare/google-cloud-sdk-v0.0.3...google-cloud-sdk-v0.0.4)

content/github/claude-plugins-official/.claude-plugin/marketplace.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@
15961596
"source": {
15971597
"source": "url",
15981598
"url": "https://github.com/heygen-com/hyperframes.git",
1599-
"sha": "08dbb7db377b63ed3525143f5f3bae7fe08c3d90"
1599+
"sha": "0a66671fc576b6b7d4a1b433ff97467dcba20b17"
16001600
},
16011601
"homepage": "https://hyperframes.heygen.com"
16021602
},
@@ -3001,7 +3001,7 @@
30013001
"source": {
30023002
"source": "url",
30033003
"url": "https://github.com/SonarSource/sonarqube-agent-plugins.git",
3004-
"sha": "5e89beacfb725b547c3a9e4bfdc2380ec1809361"
3004+
"sha": "0e502ceb9a2083a586ad2b5ad14cd10174243626"
30053005
},
30063006
"homepage": "https://www.sonarsource.com"
30073007
},
@@ -3061,7 +3061,7 @@
30613061
"url": "https://github.com/stripe/ai.git",
30623062
"path": "providers/claude/plugin",
30633063
"ref": "main",
3064-
"sha": "e238b951665cba5260d70aa80e5021def27a61d3"
3064+
"sha": "61df6113574127536db39738c4aa6fc15d3e2298"
30653065
},
30663066
"homepage": "https://github.com/stripe/ai/tree/main/providers/claude/plugin"
30673067
},

0 commit comments

Comments
 (0)