Skip to content

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

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

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

Conversation

@jordanchendev

@jordanchendev jordanchendev commented Jun 22, 2026

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.

The loaded agent is normalized to the BaseAgent | Workflow shape accepted by
AgentCardBuilder, so App.root_agent is validated before card generation.

Testing

Checked:

uv run mypy . | grep "error:" | sed 's/:\([0-9]\+\):/::/g' | sort > /private/tmp/adk_pr_errors_after.txt || true

Result:

2587 mypy error lines collected from the PR branch.
No fast_api.py AgentCardBuilder arg-type error was present.
No tests/unittests/cli/test_fast_api_a2a.py error was present.

Passed:

uv run 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 pytest tests/unittests/models/test_interactions_utils.py -q

Result:

81 passed, 4 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

Not rerun after rebasing:

tox

I previously ran py312,py313 tox and hit failures in
tests/unittests/models/test_interactions_utils.py on the old base. After
rebasing onto latest origin/main, that previously failing test file now
passes as shown above.

@jordanchendev
jordanchendev marked this pull request as ready for review June 23, 2026 02:44
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Jun 24, 2026
@jordanchendev
jordanchendev force-pushed the fix/2237-infer-agent-card branch from 133fca9 to 89c38c7 Compare June 24, 2026 09:54
@rohityan rohityan self-assigned this Jun 24, 2026
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 force-pushed the fix/2237-infer-agent-card branch from b1c4674 to a26259f Compare June 25, 2026 02:16
@rohityan rohityan added a2a [Component] This issue is related a2a support inside ADK. needs review [Status] The PR/issue is awaiting review from the maintainer and removed core [Component] This issue is related to the core interface and implementation labels Jun 26, 2026
@rohityan
rohityan requested a review from xuanyang15 July 1, 2026 22:14
@rohityan

rohityan commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Hi @jordanchendev , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan

rohityan commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Hi @xuanyang15 , can you please review this.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a2a [Component] This issue is related a2a support inside ADK. core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infer agent-card.json from ADK agent

3 participants