Skip to content

Backport pydantic-ai bridge submodule onto 0.6 line#56

Merged
dsfaccini merged 2 commits into
datalayer:release/0.6from
dsfaccini:pydantic-ai-bridge-0.6.1
May 15, 2026
Merged

Backport pydantic-ai bridge submodule onto 0.6 line#56
dsfaccini merged 2 commits into
datalayer:release/0.6from
dsfaccini:pydantic-ai-bridge-0.6.1

Conversation

@dsfaccini
Copy link
Copy Markdown
Collaborator

@dsfaccini dsfaccini commented May 15, 2026

Summary

Adds the fasta2a.pydantic_ai bridge (agent_to_a2a, AgentWorker, worker_lifespan) on top of the pre-A2A-v1-spec line so we can cut a 0.6.1 maintenance release. This gives Pydantic AI 1.x users a real migration target for Agent.to_a2a() before the v2 cut.

The bridge is a near-1:1 port of pydantic_ai._a2a and targets the discriminated TextPart/FilePart/DataPart schema that v0.6.0 ships, so no schema changes are needed here.

Companion change

Pydantic AI side: pydantic/pydantic-ai#5426 (deprecates Agent.to_a2a() with a warning pointing at this package).

Why a 0.6 backport

The A2A v1 spec rewrite landed on main (#46#51) has not yet been validated against a real A2A client, so shipping a 0.6.1 maintenance release with the bridge on the pre-v1-spec base is the conservative path: Pydantic AI 1.x users get a migration target now while main continues to bake.

What's in this PR

  • New: fasta2a/pydantic_ai/__init__.py re-exports
  • New: fasta2a/pydantic_ai/_bridge.py (~240 LOC port of pydantic_ai._a2a)
  • pyproject.toml: new [pydantic-ai] optional extra pinned to pydantic-ai-slim>=1.92; python_version >= '3.10'
  • README.md: 'Using Pydantic AI' section rewritten for the new bridge import path
  • uv.lock regenerated

Verification

Run on commit 43de2e9 locally against a Pydantic AI worktree at #5426's HEAD:

  • scripts/check — clean: ruff format/check, pyright 0/0/0, check-sdist, lock valid
  • scripts/test — 5/5 pass
  • uv build — produces fasta2a-0.6.1.dev3+43de2e9-py3-none-any.whl cleanly
  • Smoke test against the pydantic-ai card-46 deprecation branch:
    • from fasta2a.pydantic_ai import agent_to_a2a works
    • agent_to_a2a(Agent(TestModel())) returns a FastA2A ASGI app
    • Agent card served at /.well-known/agent-card.json
    • JSON-RPC tasks/get for unknown task returns -32001 TaskNotFoundError
    • Agent.to_a2a() back-compat path still works and emits a deprecation warning pointing at datalayer/fasta2a
  • tests/test_a2a.py in the deprecation branch: 11/11 pass with this wheel installed

Release plan

After merge, tag this branch's HEAD as v0.6.1 and push; publish.yml triggers on tag and publishes to PyPI via trusted publisher (the same path used for v0.6.0).

dsfaccini added 2 commits May 14, 2026 14:28
Targets the pre-A2A-v1-spec schema (commit a6d6cf0, last commit before datalayer#46).
Imports + accesses the discriminated TextPart/FilePart/DataPart shape that the
released v0.6.0 ships. Goal: ship a 0.6.1 maintenance release with this bridge
so Pydantic AI 1.x users have a migration target while v0.7 (with the v1-spec
rewrite) is still pre-release.

Includes the same fixes as the main-targeting bridge PR:
- ruff format pass + import sort (I001)
- pydantic-ai optional dep gated to python_version >= '3.10'
- README 'Using Pydantic AI' section rewritten for the new bridge
- pydantic-ai private-import fixes (AgentDepsT from _run_context,
  OutputDataT from output)
- @asynccontextmanager AsyncIterator -> AsyncGenerator (reportDeprecated)

Companion PR on Pydantic AI side: pydantic/pydantic-ai#5426
My ~/.config/uv/uv.toml sets a supply-chain cooldown via `exclude-newer`,
which gets baked into every uv.lock as an `[options]` block on
regeneration. Doesn't belong in an upstream lockfile — strip it here.
@dsfaccini dsfaccini merged commit a6cbd84 into datalayer:release/0.6 May 15, 2026
dsfaccini added a commit to dsfaccini/pydantic-ai that referenced this pull request May 15, 2026
The bridge port landed in fasta2a v0.6.1 (datalayer/fasta2a#56), released
to PyPI. Updated the deprecation surfaces to give users a concrete
migration path:

- Bumped `pydantic-ai-slim[a2a]` floor to `fasta2a>=0.6.1`
- Updated the `Agent.to_a2a()` and `agent_to_a2a` deprecation messages to
  recommend `pip install 'fasta2a[pydantic-ai]>=0.6.1'` and
  `from fasta2a.pydantic_ai import agent_to_a2a`
- Rewrote `docs/a2a.md` to show the new bridge as the recommended path;
  `docs/install.md` annotates the `a2a` extra as deprecated
- Updated the orchestration-and-integrations skill snippet to import from
  the bridge
- Tightened `tests/v2/test_a2a_deprecation.py` regex to match the new
  warning text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant