_build_input_schema returns {"type": "object", "properties": {}} for any input_schema that is neither a dict nor a class is_typeddict accepts (claude_agent_sdk/__init__.py lines 428 to 430 at 0.2.160). The tool then registers with no parameters and no warning.
On Python 3.11 and later the SDK imports is_typeddict from the standard library (lines 19 to 21), which does not recognize a class built on typing_extensions.TypedDict. Observed on Python 3.11.16 with claude-agent-sdk 0.2.160 and typing_extensions 4.16.0: a typing_extensions.TypedDict class with one NotRequired key gives {"properties": {}, "type": "object"}, while the same class built on typing.TypedDict gives the full schema with required: ["latitude"]. On 3.10 the typing_extensions branch (lines 22 to 26) recognizes both.
Expected: either recognize typing_extensions.TypedDict on every version (typing_extensions.is_typeddict accepts both metaclasses), or raise a TypeError for an unrecognized input_schema instead of registering an empty one.
Minimal repro:
import json, sys, typing
import typing_extensions as te
import claude_agent_sdk as sdk
from claude_agent_sdk import tool
class TeArgs(te.TypedDict):
latitude: te.Annotated[float, "Latitude coordinate"]
hours: te.NotRequired[te.Annotated[int, "How many hours of forecast to return"]]
class StdArgs(typing.TypedDict):
latitude: typing.Annotated[float, "Latitude coordinate"]
hours: te.NotRequired[typing.Annotated[int, "How many hours of forecast to return"]]
for cls in (TeArgs, StdArgs):
@tool("probe", "probe", cls)
async def probe(args):
return {"content": [{"type": "text", "text": str(args)}]}
print(sys.version.split()[0], cls.__name__, sdk.is_typeddict(cls),
json.dumps(sdk._build_input_schema(probe), sort_keys=True))
Output on 3.11.16 / 0.2.160 / typing_extensions 4.16.0:
3.11.16 TeArgs False {"properties": {}, "type": "object"}
3.11.16 StdArgs True {"properties": {"hours": {"description": "How many hours of forecast to return", "type": "integer"}, "latitude": {"description": "Latitude coordinate", "type": "number"}}, "required": ["latitude"], "type": "object"}
_build_input_schemareturns{"type": "object", "properties": {}}for anyinput_schemathat is neither a dict nor a classis_typeddictaccepts (claude_agent_sdk/__init__.pylines 428 to 430 at 0.2.160). The tool then registers with no parameters and no warning.On Python 3.11 and later the SDK imports
is_typeddictfrom the standard library (lines 19 to 21), which does not recognize a class built ontyping_extensions.TypedDict. Observed on Python 3.11.16 with claude-agent-sdk 0.2.160 and typing_extensions 4.16.0: atyping_extensions.TypedDictclass with oneNotRequiredkey gives{"properties": {}, "type": "object"}, while the same class built ontyping.TypedDictgives the full schema withrequired: ["latitude"]. On 3.10 the typing_extensions branch (lines 22 to 26) recognizes both.Expected: either recognize
typing_extensions.TypedDicton every version (typing_extensions.is_typeddictaccepts both metaclasses), or raise aTypeErrorfor an unrecognizedinput_schemainstead of registering an empty one.Minimal repro:
Output on 3.11.16 / 0.2.160 / typing_extensions 4.16.0: