You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP 692 Unpack TypedDict kwargs fail tool schema generation #4859
function_schema() does not handle the standard PEP 692 form **kwargs: Unpack[TypedDict].
The VAR_KEYWORD path currently wraps every annotation as dict[str, ann]. With Unpack[Options], that becomes a dictionary whose value type is Unpack[...], and Pydantic raises PydanticSchemaGenerationError before the tool can be created.
On current main, this raises while Pydantic tries to generate a schema for typing_extensions.Unpack[Options].
Expected behavior
PEP 692 Unpack[TypedDict] should describe the collected **kwargs mapping itself. The generated tool schema should validate that mapping using the TypedDict fields, and to_call_args() should expand the validated mapping into ordinary keyword arguments.
Ordinary **kwargs: T behavior should remain unchanged. Unsupported Unpack[...] forms should fail with a clear SDK UserError rather than leaking Pydantic's internal schema-generation exception.
A typed wrapper that accepts a TypedDict and forwards its fields already supports the described operation. The report does not establish a requirement to preserve the original Unpack keyword signature. I recommend closing this extension rather than adding another annotation-resolution contract.
Activity
seratch commentedon Sep 5, 2026
A typed wrapper that accepts a TypedDict and forwards its fields already supports the described operation. The report does not establish a requirement to preserve the original Unpack keyword signature. I recommend closing this extension rather than adding another annotation-resolution contract.