Agent SDK reference - Python changedagent-sdk/python
Nearest release: v2.1.307, published under an hour after 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 21 Oct 2026 20:28 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 21 Oct 2026 20:37 UTC.
Upstream edited
Recorded here
Lines+8added
Lines−1removed
From line
2,575
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits61to this page, all time
The whole hunk
from line 2575, old and new numbered
/
from line 2575
25752575 "subagent_type": str | None, # The type of specialized agent to use
25762576 "model": "sonnet" | "opus" | "haiku" | "fable" | None, # Model override for this agent
25772577 "effort": "low" | "medium" | "high" | "xhigh" | "max" | None, # Reasoning effort for this agent
2578 "run_in_background": bool | None, # Agents run in the background by default; set to False to run synchronously
2578 "run_in_background": bool | None, # Default when omitted: your main agent's call runs the new agent in the background, and a subagent's call waits for it
25792579 "name": str | None, # Name for the spawned agent
25802580 "team_name": str | None, # Deprecated; ignored
25812581 "mode": "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan" | None, # Deprecated; ignored. The subagent inheritance rules decide a subagent's permission mode
from line 2584
25842584```
25852585
25862586Launches a new agent to handle complex, multi-step tasks autonomously.
2587
2588When Claude leaves `run_in_background` out of an `Agent` call, by default your main agent doesn't wait for the new agent and a subagent waits:
2589
2590* **From your main agent**: the new agent runs in the background, and the result has `status: "async_launched"`. To make your main agent wait for the new agent instead, see [Choose whether Claude waits for subagents](/docs/en/agent-sdk/subagents#choose-whether-claude-waits-for-subagents).
2591* **From one of your subagents**: the calling subagent [waits for the new agent](/docs/en/sub-agents#let-subagents-spawn-their-own-subagents). The new agent runs in the background instead when its definition sets [`background`](#agentdefinition) to `True`, or when you [turn fork mode off](/docs/en/sub-agents#turn-fork-mode-on-or-off) by setting `CLAUDE_CODE_FORK_SUBAGENT` to `0`.
2592
2593Before Python SDK v0.2.169, agents that your subagents started also ran in the background by default. That release is the first to bundle Claude Code v2.1.302 or later.
25872594
25882595**Output (status: `"completed"`):**
25892596
No line in this hunk matches that.