feat(a2a): add outbound A2A client (CLI + SDK)#60
Open
Nivesh353 wants to merge 3 commits into
Open
Conversation
Configure remote A2A agents under `a2a_agents` in agent.yaml; each remote skill becomes a `<agent>__<skill>` tool. Blocking + streaming, header auth, per-agent timeout. Opt-in, non-fatal, no server started. Wired into both the CLI and the programmatic query() SDK path.
New `a2aAgents` option on query(), merged on top of agent.yaml's `a2a_agents` (code wins on collision). Lets SDK users configure remote agents without a yaml.
shreyas-lyzr
left a comment
Contributor
There was a problem hiding this comment.
Overall the implementation is solid — clean separation into manager/types, good non-fatal error handling, reasonable test coverage. Three issues worth addressing: one correctness bug in the SDK merge logic, one architecture concern about module-scoped cleanup state, and one minor safety gap in the cleanup chain. Details inline.
shreyas-lyzr
approved these changes
Jun 26, 2026
shreyas-lyzr
left a comment
Contributor
There was a problem hiding this comment.
All three comments addressed:
- Operator-precedence fix: the
a2aAgentsmerge now correctly uses{ ...loaded.manifest.a2a_agents, ...options.a2aAgents }guarded by the truthiness check, so the merge is unambiguous. - Module-scoped
a2aCleanupinsrc/index.tsis now nulled out before invoking (const fn = a2aCleanup; a2aCleanup = null; await fn()), preventing double-execution in repeated-call scenarios. - SIGTERM handler now chains
runA2ACleanup()before telemetry shutdown, aligning the two exit paths.
Good to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an A2A (Agent2Agent) client so gitagent can call remote A2A-compatible
agents — built on LangGraph, CrewAI, Google ADK, or any A2A server — and use
their results mid-conversation. Each remote skill shows up as a normal tool, so
delegation looks identical to any other tool call.
Outbound only — no server is started. The feature is fully opt-in: with no
a2a_agentsconfigured, behavior is unchanged and zero network calls are made.Motivation
Today gitagent can't talk to other agents. As teams build specialized agents on
other frameworks, users want gitagent to delegate to them instead of doing
everything itself. A2A is the open, Linux-Foundation interop standard for exactly
this, so it's the natural way to make gitagent interoperable.
How it works
Agent Card (
/.well-known/agent-card.json).<agent>__<skill>(skill-less agents → a single tool named after the agent). Name collisions
are skipped with a warning.
message/send(blocking) ormessage/stream(SSE streaming), flattens thereply to text, and returns it.
Failed/unreachable agents are non-fatal — they warn and are skipped; the rest
of the session works normally.
Configuration
Testing
Unit — test/a2a.test.ts (14 cases): skill→tool mapping + namespacing, zero-skill fallback, name collisions, missing/unreachable agents (non-fatal), blocking, error propagation, streaming + partial updates. Full suite: 41/41 green.
End-to-end — verified against two real A2A servers built for this: a LangGraph agent with tools and a CrewAI multi-agent crew. Confirmed discovery, tool registration, blocking + streaming, bearer-token auth (correct/wrong/missing → connect/skip), and timeout handling — through both the CLI and the SDK.