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
Passing an existing dataclass instance to a native kernel function annotated with that class fails before the function runs. Passing the equivalent dictionary works. This also breaks passing an object returned by one native function to another.
The second call raises KernelInvokeException, caused by Customer.__init__() missing 1 required positional argument: 'name'. _parse_parameter calls Customer(existing_customer) even though the argument already has the requested type.
A one-field dataclass can silently nest the original object into its field instead. Lists of typed instances also hit the constructor fallback. Passing a dictionary is a workaround.
Platform
Python 3.12.15, Semantic Kernel 1.45.0 on current main 25501830b9483ad6b23955dee340c8590fa54152, Pydantic 2.13.5, macOS ARM. No AI model or service is involved.
Additional context
PR #14466 handles generic/union validation but leaves this concrete-class fallback unchanged. Would preserving already-typed custom instances be the intended behavior? Happy to contribute a fix and regression tests once the approach is agreed.
I'll take on a small fix and regression tests for preserving already-typed concrete arguments. I'll keep Pydantic revalidation and existing dictionary/list conversion behavior intact.
Activity
original4422 commentedon Oct 23, 2026
I'll take on a small fix and regression tests for preserving already-typed concrete arguments. I'll keep Pydantic revalidation and existing dictionary/list conversion behavior intact.
Python: Preserve already-typed native function arguments (microsoft#1…