Add pydantic_ai bridge submodule (port from pydantic-ai _a2a.py)#55
Draft
dsfaccini wants to merge 2 commits intodatalayer:mainfrom
Draft
Add pydantic_ai bridge submodule (port from pydantic-ai _a2a.py)#55dsfaccini wants to merge 2 commits intodatalayer:mainfrom
pydantic_ai bridge submodule (port from pydantic-ai _a2a.py)#55dsfaccini wants to merge 2 commits intodatalayer:mainfrom
Conversation
Port of pydantic-ai's `Agent.to_a2a()` integration into this package, in advance of the v2 deprecation on the pydantic-ai side. This is a near-verbatim port of `pydantic_ai_slim/pydantic_ai/_a2a.py` so the API can be redesigned in-tree if the maintainers prefer a different shape.
The previous >=0.5 floor was a typo from copying the plan-doc — pydantic-ai is on v1.92.0 and the bridge depends on symbols (AbstractAgent, BinaryContent, VideoUrl, …) that don't exist below 1.x.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claude here:
Port of pydantic-ai's
Agent.to_a2a()integration into this package, in advance of the v2 deprecation on the pydantic-ai side (see pydantic/pydantic-ai card 46).Why now
After the FastA2A donation, pydantic-ai is deprecating
Agent.to_a2a(), thepydantic_ai._a2amodule, and thea2ainstall extra in 1.x — to be removed in v2. Users who hit those deprecation warnings need somewhere to land. This PR brings the bridge code into the FastA2A repo so the migration message can simply be 'installfasta2a[pydantic-ai]and importagent_to_a2a'.What's in the diff
fasta2a/pydantic_ai/__init__.py— re-exportsagent_to_a2a,AgentWorker,worker_lifespanfasta2a/pydantic_ai/_bridge.py— 1-to-1 port ofpydantic_ai._a2a(~241 lines). Imports flipped: this submodule imports frompydantic_ai, not the other way around. The body is unchanged so you can see exactly what shipped today.pyproject.toml— addspydantic-ai = ['pydantic-ai-slim>=1.92']optional extra. Pinned to slim to avoid pulling the full LLM-provider matrix into anyone who installsfasta2a[pydantic-ai].Open for redirection — happy to iterate
This is intentionally a near-verbatim port so you can pick the API shape:
agent_to_a2a()function (current) vs. anAgentApplicationclass? Module layoutfasta2a.pydantic_ai(current) vs.fasta2a.bridges.pydantic_aiif you anticipate more bridges?pydantic-ai-slim>=1.92or the fullpydantic-ai? Slim is the conservative pick.tests/test_a2a.py; happy to port subset, or leave to you to test in your style.Sequencing
Marking this PR as draft because the pydantic-ai-side deprecation PR (a
v2:prepPR adding@deprecatedwarnings onAgent.to_a2a()etc.) is held until this one lands or has a confirmed merge ETA — the deprecation message will point users here.Reach out on the donation Slack channel or here — happy to update or hand the PR off.
cc @Kludex