Skip to content

A2A bridge ​

Purpose ​

Agentweaver keeps the workflow graph, graph-level approval gates, checkpoints, and durable persistence in the orchestration host. It sends each leaf agent turn to AgentHost over A2A HTTP+JSON. Structured run events cross that boundary and are persisted by the caller's event pipeline; pod-local tool approval waits have a separate return path.

RemoteAgentProxy implements the workflow agent surface on the worker. It forwards a turn, receives streamed output and run events, and re-emits them to the local runtime.

AgentHost hosts an A2ATurnBridgeAgent around the provider-backed runtime. It exposes POST /a2a/agent/v1/message:stream and GET /a2a/agent/v1/card on port 8088 by default.

Workflow agents ​

RemoteWorkflowAgentFactory returns RemoteAgentProxy for five workflow agents:

  • worker
  • RAI
  • Rubberduck
  • Build/Test
  • Scribe

The Operator Assistant also uses RemoteAgentProxy, outside IWorkflowAgentFactory.

Turn and event transport ​

The worker sends turn setup as the first A2A DataContent part. This setup contains workspace and repository context, model and system-prompt data, project and agent identity, and revision state.

AgentHost sends assistant updates and structured RunEvent values through the same stream. RunEventDataPartCodec serializes the run events, which the worker appends to its local event pipeline.

See the canonical A2A sequence. Transport EOF alone is not success: the proxy checks the definitive turn-end marker and structured failures.

Warm-pool configuration ​

AgentHost starts in standby without a run identity. When the API claims a warm pod, it makes one POST /configure request. The request includes run, project, agent, and purpose identity; shared and local workspace descriptors; turn authentication; approval settings; and provider configuration.

The provider payload is either copilotCredential or byokProviderConfiguration. Repository, preview, and MCP broker credentials are optional and purpose-scoped.

The claim/configure sequence distinguishes listener liveness from configured readiness. /healthz returns HTTP 200 with standby before configuration and ready afterward. /configure accepts one configuration per pod; a second attempt returns 409. Other nonexempt requests return 503 before setup completes.

Production launch supplies a fresh turn bearer. The A2A middleware compares it when a nonempty token is configured; the optional request field is not unconditional endpoint enforcement. /configure cannot authenticate with the token it delivers. NetworkPolicy and configured transport protections are separate controls; the additive preview ingress range also includes port 8088 (see network-policy limitations).

The claim is also stamped with the active durable run-lease fencing token. After process recovery or child-dispatch takeover increments that token, a new API worker rejects the older claim, stops its pod, and configures a replacement before delivering another turn. This prevents two AgentHost turns from sharing one run identity or publishing competing worktree results.

Security boundary ​

The sandbox pod has no database connection and does not hold an ICheckpointStore. It cannot retrieve ambient user credentials from Key Vault, CSI volumes, shared storage, or host configuration.

The A2A turn token is unique to the run. A token from one pod cannot authorize a turn against another pod.

Source ​

  • apps/Agentweaver.Api/Sandbox/RemoteWorkflowAgentFactory.cs
  • apps/Agentweaver.Api/Sandbox/KubernetesSandboxExecutor.cs
  • apps/Agentweaver.AgentHost/Program.cs
  • apps/Agentweaver.AgentHost/A2ATurnBridgeAgent.cs

Visual model ​

Coordinator-to-agent communication and A2A runtime ​

UML sequence showing a caller starting a parent run, the coordinator persisting intent and a work plan, dependency-ready child work executing in AgentHost, collective review and merge, and durable completion observed by the caller.

Structured source · Editable draw.io

Diagram details and constraints
ElementContract
titleA2A remotes a leaf turn, not the graph
takeawaySetup and task cross to AgentHost; assistant output and structured events return.
Workflow graphWorkflow graph
Workflow graphHost owns gates/checkpoints
Workflow graphFive factory-created leaf types
RemoteAgentProxyRemoteAgentProxy
RemoteAgentProxyBuild setup DataContent
RemoteAgentProxyTask TextContent in same message
AgentHost bridgeAgentHost bridge
AgentHost bridgemessage:stream over HTTP+JSON
AgentHost bridgeApply per-turn context
Caller event pipelineCaller event pipeline
Caller event pipelineDecoded structured events
Caller event pipelineDurable state outside pod
Proxy stream decoderProxy stream decoder
Proxy stream decoderOutput + RunEventDataPart
Proxy stream decoderCheck definitive turn end
Leaf runtimeLeaf runtime
Leaf runtimeExecute provider/tool loop
Leaf runtimeStream updates and events
arrow-1invoke
arrow-2send
arrow-3run
arrow-4stream
arrow-5append
note-0Claim/configure is a separate lifecycle, completed before this exchange.
note-1EOF alone is not successful completion; structured failures remain failures.
notesClaim/configure is a separate lifecycle, completed before this exchange.; EOF alone is not successful completion; structured failures remain failures.
Diagram details and constraints
ElementContract
titleBind, reach standby, configure once
takeawayLiveness precedes configuration; production delivers run credentials out of pod specs.
Prepare launchPrepare launch
Prepare launchResolve provider and run context
Prepare launchMint fresh turn token
Claim warm podClaim warm pod
Claim warm podCreate/adopt; omit spec.env
Claim warm podWait Ready + bound pod name
Resolve and registerResolve and register
Resolve and registerPod mapping / token registry
Resolve and registerResolve actual pod IP
GET /healthzGET /healthz
GET /healthzHTTP 200 standby
GET /healthzListener liveness, not turn ready
POST /configurePOST /configure
POST /configureIdentity / workspace / approvals
POST /configureCopilot capability OR BYOK
AgentHost setupAgentHost setup
AgentHost setupOne-time configuration
AgentHost setupEffective workspace + HOME
Configuration guardsConfiguration guards
Configuration guardsSecond configure: 409
Configuration guardsOther routes: 503 before ready
Register effective endpointRegister effective endpoint
Register effective endpointReturn effective working directory
Register effective endpointShared/local/private fallback
First A2A turnFirst A2A turn
First A2A turnProduction sends turn bearer
First A2A turnEquality guard when nonempty
arrow-1launch
arrow-2bound
arrow-3poll
arrow-4reachable
arrow-5setup
arrow-6ready
arrow-7invoke
note-0Top, middle and bottom rows are successive launch stages.
note-1Repository / preview / broker credentials have separate purposes.
note-2Optional schema fields do not imply unconditional endpoint enforcement.
notesTop, middle and bottom rows are successive launch stages.; Repository / preview / broker credentials have separate purposes.; Optional schema fields do not imply unconditional endpoint enforcement.