Preserve `tool_kind` in Vercel AI and AG-UI message round-trips
Merged
AD
5mo ago+1400+1400+0123456789012345678901234567890123456789-69-69-01234567890123456789
Closes #5846
Typed tool parts (LoadCapabilityCallPart/ReturnPart, NativeToolSearchCallPart/ReturnPart) lost their tool_kind discriminator through UI adapter round-trips, so a resuming agent forgot its loaded capabilities and discovered tools.
- Vercel AI:
tool_kindrides in thepydantic_aiprovider_metadataon dump and in streamed chunks; load feeds it tonarrow_type, which is now best-effort and degrades to the plain part on validation failure instead of raising. - AG-UI:
tool_kindrides inToolCall/ToolMessageencrypted_valueand is streamed viaReasoningEncryptedValueEvent(subtype='tool-call'), gated on ag-ui-protocol >= 0.1.13 (skipped on older versions). Returns fall back to the paired call's claim since streamed results have no metadata slot;errorresults stay untyped.
Checklist
- Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
- No breaking changes in accordance with the version policy.
- PR title is fit for the release changelog.