Skip to content

fix(adk): stop embedding the system prompt in the pod agent card - #2843

Open
TigerkidYang wants to merge 2 commits into
kagent-dev:mainfrom
TigerkidYang:fix/agent-card-no-instructions
Open

TigerkidYang wants to merge 2 commits into
kagent-dev:mainfrom
TigerkidYang:fix/agent-card-no-instructions

Conversation

@TigerkidYang

@TigerkidYang TigerkidYang commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Problem

The agent pod's /.well-known/agent-card.json embeds the agent's entire system prompt: EnrichAgentCard unconditionally replaces the curated card's skills with adka2a.BuildAgentSkills(agent), and adk-go's buildDescriptionFromInstructions joins the agent description with the full instruction into the first skill's description. Anyone who can discover the agent can read how it is instructed to behave (fee policies, escalation rules, …), and the pod card diverges from the curated card the controller serves. The reporter re-confirmed this on 0.10.0 stable.

Fix

EnrichAgentCard no longer touches skills at all. The compiler-generated card is authoritative (it is also what the a2a-gateway serves from the pinned runtime revision), so the pod card now carries exactly the skills the compiler put there and nothing built from the ADK agent. The function still fills a missing description, the HITL extension and the default interface. adka2a is no longer imported here.

The pod still serves /.well-known/agent-card.json to direct-to-pod callers (the reporter's agentgateway setup, and the 0.10.x line), which is where this closes the leak.

Delegation is not affected: the remote-A2A tools in both runtimes (go/adk/pkg/tools/remote_a2a_tool.go, kagent-adk/_remote_a2a_tool.py) read only the card Description, and the reporter confirmed empirically that routing between sub-agents never depended on skills.

Tests

agentcard_test.go: an agent with an instruction and a sub-agent. A card without skills stays without skills and no instruction text reaches it; compiler-generated skills and description are kept verbatim; the description / HITL / default-interface enrichment still applies. go vet, go test -run TestEnrichAgentCard ./adk/pkg/a2a/ and go test ./adk/pkg/app/ pass.

Backport

The same function exists unchanged on release/v0.10.x, where gateway-fronted callers hit the pod card directly; happy to open the backport once this lands.

Fixes #2549


Prepared with Claude Code assistance; the diff was reviewed and the tests above were run locally before opening the PR.

🤖 Generated with Claude Code

EnrichAgentCard replaced the curated card's skills with adka2a.BuildAgentSkills,
whose first skill joins the agent description with the full instruction. The
pod's /.well-known/agent-card.json therefore exposed the system prompt to
anyone who could discover the agent, and diverged from the curated card the
controller serves.

Keep the curated skills verbatim whenever the card carries a skills field
(an explicit empty list means none). Only when the field is absent derive
skills, and then from agent and sub-agent names and descriptions only,
never from instructions. Delegation is unaffected: the remote A2A tools in
both runtimes read only the card description.

Fixes kagent-dev#2549

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: MichaelRunchangYang <[email protected]>
@github-actions github-actions Bot added the bug Something isn't working label Sep 16, 2026

@supreme-gg-gg supreme-gg-gg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The a2a-gateway now serves the public Agent Card from the pinned runtime revision and invokes the Actor directly over gRPC without discovering its card. I think we should we remove runtime skill enrichment instead of maintaining a custom deriveAgentSkills implementation. It appears unnecessary on this path and loses upstream support for workflow/custom agents and tool-derived skills. The compiler-generated card should remain authoritative.

Comment thread go/adk/pkg/a2a/agentcard.go Outdated

// deriveAgentSkills builds a skill list from the agent's own description and
// its sub-agents. It deliberately ignores instructions and tools: the former
// is the system prompt, the latter is already reachable through tool listing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's "tool listing"? I don't recall such a mechanism in A2A

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, A2A has no such mechanism. The wording was inaccurate, and that code is gone now (see below).

Per review: the a2a-gateway serves the public card from the pinned runtime
revision, so the compiler-generated card is authoritative and a custom
skill derivation is not worth maintaining. EnrichAgentCard no longer
touches skills; it only fills a missing description, the HITL extension
and the default interface.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Signed-off-by: MichaelRunchangYang <[email protected]>
@TigerkidYang

Copy link
Copy Markdown
Contributor Author

Thanks @supreme-gg-gg, agreed. With the gateway serving the card from the pinned revision, the compiler-generated card should stay authoritative, and a custom deriveAgentSkills is not worth maintaining. Pushed 1 commit that drops skill enrichment entirely: EnrichAgentCard no longer touches skills and only fills a missing description, the HITL extension and the default interface.

The pod still serves /.well-known/agent-card.json to direct-to-pod callers (the reporter's agentgateway setup, and 0.10.x), so this is what closes the leak there. Tests now assert that a card without skills stays without skills and that compiler-generated skills are kept verbatim. PR description updated to match.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent pod serves ADK-generated agent card embedding the full system prompt, diverging from the curated a2aConfig card

2 participants