Migrate to Claude Agent SDK changedagent-sdk/migration-guide
Nearest release: v2.1.296, published 3 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 9 Oct 2026 20:45 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 20 Oct 2026 18:37 UTC.
Upstream edited
Recorded here
Lines+50added
Lines−56removed
From line
18
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits8to this page, all time
The whole hunk
from line 18, old and new numbered
/
from line 18
1818
1919## Migration Steps
2020
21<span id="for-typescript/javascript-projects" />
22
2321### Migrate a TypeScript or JavaScript project
2422
2523**1. Uninstall the old package:**
from line 52
5452
5553Make any code changes needed to complete the migration.
5654
57<span id="for-python-projects" />
58
5955### Migrate a Python project
6056
6157**1. Uninstall the old package:**
from line 88
9288
9389## Breaking changes
9490
95<Warning>
96 To improve isolation and explicit configuration, Claude Agent SDK v0.1.0 introduces breaking changes for users migrating from Claude Code SDK.
97</Warning>
91> [!WARNING]
92>
93> To improve isolation and explicit configuration, Claude Agent SDK v0.1.0 introduces breaking changes for users migrating from Claude Code SDK.
9894
9995### Python: ClaudeCodeOptions renamed to ClaudeAgentOptions
10096
from line 116
120116
121117**Migration:**
122118
123<CodeGroup>
124 ```typescript TypeScript theme={null}
125 import { query } from "@anthropic-ai/claude-agent-sdk";
119```typescript TypeScript theme={null}
120import { query } from "@anthropic-ai/claude-agent-sdk";
126121
127 // BEFORE (v0.0.x) - Used Claude Code's system prompt by default
128 const before = query({ prompt: "Hello" });
122// BEFORE (v0.0.x) - Used Claude Code's system prompt by default
123const before = query({ prompt: "Hello" });
129124
130 // AFTER (v0.1.0) - Uses minimal system prompt by default
131 // To get the old behavior, explicitly request Claude Code's preset:
132 const presetResult = query({
133 prompt: "Hello",
134 options: {
135 systemPrompt: { type: "preset", preset: "claude_code" }
136 }
137 });
125// AFTER (v0.1.0) - Uses minimal system prompt by default
126// To get the old behavior, explicitly request Claude Code's preset:
127const presetResult = query({
128 prompt: "Hello",
129 options: {
130 systemPrompt: { type: "preset", preset: "claude_code" }
131 }
132});
138133
139 // Or use a custom system prompt:
140 const customResult = query({
141 prompt: "Hello",
142 options: {
143 systemPrompt: "You are a helpful coding assistant"
144 }
145 });
146 ```
134// Or use a custom system prompt:
135const customResult = query({
136 prompt: "Hello",
137 options: {
138 systemPrompt: "You are a helpful coding assistant"
139 }
140});
141```
147142
148 ```python Python theme={null}
149 from claude_agent_sdk import query, ClaudeAgentOptions
150 import asyncio
143```python Python theme={null}
144from claude_agent_sdk import query, ClaudeAgentOptions
145import asyncio
151146
152147
153 async def main():
154 # BEFORE (v0.0.x) - Used Claude Code's system prompt by default
155 async for message in query(prompt="Hello"):
156 print(message)
148async def main():
149 # BEFORE (v0.0.x) - Used Claude Code's system prompt by default
150 async for message in query(prompt="Hello"):
151 print(message)
157152
158 # AFTER (v0.1.0) - Uses minimal system prompt by default
159 # To get the old behavior, explicitly request Claude Code's preset:
160 async for message in query(
161 prompt="Hello",
162 options=ClaudeAgentOptions(
163 system_prompt={"type": "preset", "preset": "claude_code"} # Use the preset
164 ),
165 ):
166 print(message)
153 # AFTER (v0.1.0) - Uses minimal system prompt by default
154 # To get the old behavior, explicitly request Claude Code's preset:
155 async for message in query(
156 prompt="Hello",
157 options=ClaudeAgentOptions(
158 system_prompt={"type": "preset", "preset": "claude_code"} # Use the preset
159 ),
160 ):
161 print(message)
167162
168 # Or use a custom system prompt:
169 async for message in query(
170 prompt="Hello",
171 options=ClaudeAgentOptions(system_prompt="You are a helpful coding assistant"),
172 ):
173 print(message)
163 # Or use a custom system prompt:
164 async for message in query(
165 prompt="Hello",
166 options=ClaudeAgentOptions(system_prompt="You are a helpful coding assistant"),
167 ):
168 print(message)
174169
175170
176 asyncio.run(main())
177 ```
178</CodeGroup>
171asyncio.run(main())
172```
179173
180174### Settings sources default
181175
from line 181
187181
188182Isolation is especially important for CI/CD pipelines, deployed applications, test environments, and multi-tenant systems where local customizations should not leak in.
189183
190<Note>
191 Python SDK 0.1.59 and earlier treated an empty list the same as omitting the option, so upgrade before relying on `setting_sources=[]`. See [What settingSources does not control](/docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) for inputs that are read even when `settingSources` is `[]`.
192</Note>
184> [!NOTE]
185>
186> Python SDK 0.1.59 and earlier treated an empty list the same as omitting the option, so upgrade before relying on `setting_sources=[]`. See [What settingSources does not control](/docs/en/agent-sdk/claude-code-features#what-settingsources-does-not-control) for inputs that are read even when `settingSources` is `[]`.
193187
194188## Next Steps
195189
No line in this hunk matches that.