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 change · claude-code

Agent SDK reference - Python changedagent-sdk/python

Nearest release: v2.1.290, published 2 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 5 Oct 2026 20:58 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 5 Oct 2026 21:07 UTC.

Upstream edited
Recorded here
Lines+23added
Lines−0removed
From line 123 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 123, old and new numbered
/
lines
from line 123
123123 }
124124 ```
125125 
1263. **TypedDict class**: a typed schema whose `NotRequired` keys are left out of `required`.
127 
128 * **Python 3.11 and later**: import `TypedDict` and `NotRequired` from `typing`.
129 * **Python 3.10**: `typing` has no `NotRequired`. Import `TypedDict` and `NotRequired` from `typing_extensions`, which the SDK installs on Python 3.10.
130 
131 ```python theme={null}
132 from typing import Annotated, Any, NotRequired, TypedDict
133 from claude_agent_sdk import tool
134 
135 
136 class ForecastArgs(TypedDict):
137 latitude: Annotated[float, "Latitude coordinate"]
138 hours: NotRequired[Annotated[int, "How many hours of forecast to return"]]
139 
140 
141 @tool("get_forecast", "Get the hourly forecast for a location", ForecastArgs)
142 async def get_forecast(args: dict[str, Any]) -> dict[str, Any]:
143 hours = args.get("hours", 12)
144 return {"content": [{"type": "text", "text": f"{hours}-hour forecast for {args['latitude']}"}]}
145 ```
146 
147In the simple mapping and TypedDict forms, wrap a type in `Annotated[type, "description"]` to set the field's description.
148 
126149#### Returns
127150 
128151A decorator function that wraps the tool implementation and returns an `SdkMcpTool` instance.
Feedback