Skip to content

fix(a2a): derive agent card version from package metadata - #100

Merged
randileeharper merged 1 commit into
mainfrom
fix/a2a-agent-card-version
Jun 28, 2026
Merged

fix(a2a): derive agent card version from package metadata#100
randileeharper merged 1 commit into
mainfrom
fix/a2a-agent-card-version

Conversation

@randileeharper

Copy link
Copy Markdown
Owner

Summary

Fixes #88.

Two places hardcoded \"0.1.0\" and could drift from pyproject.toml:

  1. vesper/__init__.py__version__ = \"0.1.0\", a hand-maintained literal duplicated from pyproject.toml.
  2. vesper/a2a.py:415FastAPI(version=\"0.1.0\") bypassed __version__ entirely, even though build_agent_card() on the same module correctly used __version__.

The issue body noted build_agent_card hardcoded the version, but the code already referenced __version__; the actual drift risk was in the __version__ literal itself and the FastAPI() constructor. This PR addresses both.

Changes

  • vesper/__init__.py: derive __version__ from importlib.metadata.version(\"vesper\") with a \"0.1.0\" literal fallback for editable/source-tree runs where the distribution is not installed (PackageNotFoundError). pyproject.toml is now the single source of truth.
  • vesper/a2a.py: use __version__ in the FastAPI() constructor instead of the hardcoded literal.
  • tests/test_a2a.py: add test_agent_card_version_matches_package_metadata, asserting the published agent card version equals vesper.__version__.

Test commands run

.venv/bin/python -m pytest tests/test_a2a.py -q
.venv/bin/python -m pytest -q
.venv/bin/python -m compileall vesper tests

All 254 tests pass; compileall clean.

build_agent_card() already used __version__, but the FastAPI app
constructor on the same module hardcoded version="0.1.0", which could
drift from pyproject.toml. Meanwhile __version__ itself was a hand-maintained
literal duplicated from pyproject.toml.

Make pyproject.toml the single source of truth: derive __version__ from
importlib.metadata.version("vesper") with a literal fallback for
editable/source-tree runs where the distribution is not installed. Use
__version__ in the FastAPI() constructor so both the agent card and the app
advertise the installed package version.

Add a regression test asserting the published agent card version equals
vesper.__version__.
@randileeharper
randileeharper merged commit 38ea2ea into main Jun 28, 2026
1 check passed
@randileeharper
randileeharper deleted the fix/a2a-agent-card-version branch June 28, 2026 17:09
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.

A2A agent card version is hardcoded

1 participant