Skip to content

A2a client#534

Open
Greyeye wants to merge 4 commits into
mainfrom
a2a-client
Open

A2a client#534
Greyeye wants to merge 4 commits into
mainfrom
a2a-client

Conversation

@Greyeye

@Greyeye Greyeye commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

feat(a2askills): Dynamic A2A skill discovery for AI review

Summary

Adds pkg/a2askills — a generic A2A protocol client
that connects to external skill agents at startup, discovers their capabilities from the
agent's published AgentCard, and registers each skill as a tool available to the AI reviewer.

kubechecks' AI reviewer already has strong access to what changed (diffs, rendered manifests)
and live cluster state (via ArgoCD). What it lacks is the team's accumulated knowledge —
conventions, patterns, and incident learnings. a2askills bridges that gap without coupling
kubechecks to any specific agent's internal schema.

What changed

pkg/a2askills (new package)

  • Client interface with Discover(ctx) and Call(ctx, skill, params) — generic,
    no knowledge-engine-specific types
  • AgentClient implementation dials any A2A-compatible agent over gRPC
  • Discover() fetches skills via GetExtendedAgentCard at startup; each skill's name,
    description, and tags come from the agent card — nothing hardcoded in kubechecks
  • Call() accepts map[string]any params; the LLM constructs them guided by the skill
    description, so kubechecks never needs to know the agent's internal schema
  • Mockery-generated MockClient for tests (mocks/a2askills/)
  • Table-driven unit tests covering Discover and Call success/error paths

pkg/aireview/tools/skills.go (new)

  • A2ASkillTool(client, skill, timeout) — generic tool factory that builds an
    aireview.Tool directly from an a2a.AgentSkill. Tool name, description, and tag
    hints all come from the agent card.

pkg/checks/aireview/check.go

  • skillAgents []skillAgent replaces the old knowledgeClient / knowledgeSkills fields
  • WithSkillAgent(client, skills, timeout) option — can be called multiple times to
    attach skills from different agents
  • Tool registration iterates over all agents and all their skills dynamically

pkg/aireview/prompt.go

  • BuildSystemPrompt now takes []a2a.AgentSkill instead of a knowledgeEnabled bool
  • The "Agent Skills" section in the system prompt is generated from actual card data:
    each skill's name, ID, and description — not a hardcoded knowledge-engine reference

Configuration

KUBECHECKS_SKILL_AGENT_ADDRS=agent1:50051,agent2:50051
KUBECHECKS_SKILL_AGENT_TIMEOUT=3s

Design decisions

Why agent card discovery over hardcoded skill names?
The agent publishes what it supports. kubechecks reads it. Adding a new skill to the agent
automatically makes it available to the reviewer — no kubechecks code change needed.

…eview

Add pkg/a2askills — a generic A2A client that discovers skills at startup
from any compatible agent's AgentCard and registers them as aireview tools.
No proprietary schemas or engine-specific types in kubechecks.

How it works:
- NewAgentClient dials any A2A-compatible agent over gRPC
- Discover() fetches skills via GetExtendedAgentCard at startup
- Each skill becomes an aireview.Tool using the card's name/description/tags
- A2ASkillTool accepts free-form map[string]any params; the LLM constructs
  them guided by the skill description
- BuildSystemPrompt receives []a2a.AgentSkill and generates the Agent Skills
  section from actual card data, not hardcoded assumptions
- Multiple agents supported: each address in SKILL_AGENT_ADDRS is dialed
  independently; all discovered skills are registered as review tools

Config (presence of any address enables the feature, no boolean flag):
  KUBECHECKS_SKILL_AGENT_ADDRS=agent1:50051,agent2:50051
  KUBECHECKS_SKILL_AGENT_TIMEOUT=3s

Files:
- pkg/a2askills/client.go: Client interface (Discover+Call), AgentClient
- pkg/a2askills/client_test.go: table-driven tests via mockery MockClient
- pkg/a2askills/README.md: package documentation
- pkg/aireview/tools/skills.go: A2ASkillTool generic tool factory
- pkg/checks/aireview/check.go: skillAgents []skillAgent, WithSkillAgent
- pkg/aireview/prompt.go: BuildSystemPrompt takes []a2a.AgentSkill
- mocks/a2askills/: mockery-generated MockClient
- cmd/processors.go: iterate SKILL_AGENT_ADDRS, discover and register each
- docs/usage.md: document SKILL_AGENT_ADDRS and SKILL_AGENT_TIMEOUT flags
Comment thread pkg/aireview/tools/skills.go Fixed
fmt.Sprintf into a raw JSON string literal is unsafe — tag names
containing quotes or backslashes would produce invalid JSON.
json.Marshal handles escaping correctly and is the idiomatic approach.
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Temporary Helm chart (version 0.0.0-pr534) available:

Install directly:

helm install kubechecks oci://ghcr.io/zapier/charts/kubechecks --version 0.0.0-pr534

Pull to inspect:

helm pull oci://ghcr.io/zapier/charts/kubechecks --version 0.0.0-pr534

Note: OCI charts don't use helm repo add - use the chart URL directly.

Greyeye and others added 2 commits June 4, 2026 21:58
ToolInputSchemaParam uses omitzero via its embedded paramObj — when Properties
and Required are both nil, the entire input_schema field is omitted from the
JSON, causing Anthropic to reject with "input_schema: Field required".

This happens for A2A skill tools whose schema uses additionalProperties without
a properties key (e.g. knowledge_search's free-form params schema).

Fix: default Properties to an empty map when nil, and forward
additionalProperties through ExtraFields so free-form schemas round-trip
correctly.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants