Skip to content

feat(a2a): Infer agent cards from ADK agents#6180

Open
jordanchendev wants to merge 1 commit into
google:mainfrom
jordanchendev:fix/2237-infer-agent-card
Open

feat(a2a): Infer agent cards from ADK agents#6180
jordanchendev wants to merge 1 commit into
google:mainfrom
jordanchendev:fix/2237-infer-agent-card

Conversation

@jordanchendev

Copy link
Copy Markdown
Contributor

Summary

Fixes #2237.

This lets get_fast_api_app(..., a2a=True) expose standard ADK agent
directories even when they do not include an explicit agent.json. Existing
agent.json files still take precedence; otherwise the loaded ADK agent is
used to build an AgentCard.

Testing

Passed:

uv run python -m pytest tests/unittests/cli/test_fast_api_a2a.py tests/unittests/cli/test_fast_api.py -k a2a tests/unittests/a2a/utils/test_agent_card_builder.py tests/unittests/a2a/utils/test_agent_to_a2a.py -q

Result:

113 passed, 75 deselected, 61 warnings

Passed:

uv run pre-commit run --all-files

Result:

check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
pyproject-fmt............................................................Passed
ruff (legacy alias)......................................................Passed
isort....................................................................Passed
pyink....................................................................Passed
addlicense...............................................................Passed
Check new Python files have _ prefix.....................................Passed
mdformat.................................................................Passed

Attempted tox:

env PATH=/opt/homebrew/bin:/Users/jordanchen/.local/bin:/usr/bin:/bin:/usr/sbin:/sbin uv run tox -r -e py312,py313

Result:

py312: 11 failed, 7473 passed, 19 skipped, 31 xfailed, 9 xpassed
py313: 11 failed, 7473 passed, 19 skipped, 31 xfailed, 9 xpassed

The tox failures are all in tests/unittests/models/test_interactions_utils.py
and fail because the installed google.genai.interactions.FunctionCallStep
does not expose the signature attribute expected by
src/google/adk/models/interactions_utils.py. The A2A and CLI tests touched by
this PR pass in the same environment.

Allow A2A setup in get_fast_api_app to serve ADK agent directories without a checked-in agent.json by building the AgentCard from the loaded ADK agent.

Fixes google#2237

Tests:

uv run python -m pytest tests/unittests/cli/test_fast_api_a2a.py tests/unittests/cli/test_fast_api.py -k a2a tests/unittests/a2a/utils/test_agent_card_builder.py tests/unittests/a2a/utils/test_agent_to_a2a.py -q

uv run pre-commit run --files src/google/adk/cli/fast_api.py tests/unittests/cli/test_fast_api_a2a.py
@jordanchendev jordanchendev marked this pull request as ready for review June 23, 2026 02:44
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.

Infer agent-card.json from ADK agent

1 participant