A2A Topology Reference

Agent-to-Agent protocol support in adk-fluent — local, remote, and hybrid topologies

Local vs Remote Agents comparison

Local Agent — same process

Process Agent A coordinator Agent B sub-agent
.sub_agent() .agent_tool()
  • Shared session state
  • Shared memory service
  • Zero network latency
# Local: same process, direct call
coordinator.sub_agent(local_agent)

Remote Agent — A2A protocol

Process A Process B Agent A caller Agent B remote HTTP A2A
RemoteAgent(url=...)
  • Separate session state
  • HTTP/A2A transport layer
  • Network latency overhead
# Remote: separate process, A2A protocol
RemoteAgent(name="helper", url="http://...")

A2A Mesh Topology architecture

A2AServer exposes local agents to remote callers :8080 writer local agent analyzer local agent summarizer local agent A2AServer exposes research-svc remote agent HTTP/A2A data-svc remote agent HTTP/A2A ext-caller remote agent HTTP/A2A RemoteAgent connects to Legend Local (solid, green) Remote (dashed, blue)

State Bridging data flow

Local Session State state["document"] state["preferences"] state["analysis"] state["confidence"] .sends() A2A Message serialized JSON payload HTTP transport .receives() Remote Session State state["document"] state["preferences"] state["analysis"] state["confidence"]
# State bridging: explicit send/receive contract
remote = (
    RemoteAgent(name="analyzer", url="http://analyzer:8080")
    .sends("document", "preferences")    # local → remote
    .receives("analysis", "confidence")   # remote → local
)

Resilience Patterns middleware

M.a2a_retry(max=3)

#1 1s #2 2s #3

Retry failed A2A calls with exponential backoff. Each attempt waits progressively longer before the next retry.

M.a2a_circuit_breaker(threshold=5)

CLOSED normal 5 fails OPEN reject all timer HALF-OPEN probe success: reset

Stop calling a failing remote agent after N consecutive failures. Automatically resets after a cooldown period.

M.a2a_timeout(seconds=30)

30s deadline < 30s OK > 30s FAIL

Time limit for remote agent responses. Raises a timeout error if the remote agent does not reply within the deadline.

M.a2a_cache(ttl=300)

req #1 CACHE ttl=300 MISS remote LLM req #2 HIT → instant

Cache remote responses to reduce network calls. Identical requests within the TTL window return the cached result.

Composition Example hybrid

from adk_fluent import Agent, RemoteAgent

# A local agent — runs in the same process
local_writer = (
    Agent("writer", "gemini-2.5-flash")
    .instruct("Write content based on research.")
    .isolate()
)

# A remote agent — communicates over A2A protocol
remote_researcher = (
    RemoteAgent(name="researcher", url="http://research-service:8080")
    .sends("topic")
    .receives("findings")
)

# Coordinator mixes local + remote seamlessly
coordinator = (
    Agent("coordinator", "gemini-2.5-flash")
    .instruct("Coordinate research and writing.")
    .sub_agent(local_writer)
    .sub_agent(remote_researcher)
    .middleware(M.a2a_retry(max=3) | M.a2a_timeout(seconds=30))
)

Discovery Methods connectivity

1
Direct URL
RemoteAgent(url="http://agent-service:8080")
2
Service Registry
RemoteAgent.discover(registry_url="http://registry:9090")
3
Agent Card
RemoteAgent.from_card(card)