Skip to content

Delegate over A2A

Fraud and sanctions screening is somebody else’s job at Borealis: Financial Crime owns it, runs it and answers for it. So the screening agent does not screen for fraud. It asks the Fraud Screener, an A2A 1.0 agent that is its own AI System, and it asks through the gateway:

screening agent ──▶ /v1/proxy/a2a/outbound ──▶ brutor-demo-fraud-screener-agent:9200
(Demo System) grants · guardrails · (Fraud Screener AI System)
signs the delegation chain │ its own model call,
checks the delegate's outcome │ echoing the chain
◀── X-Brutor-Outcome-Id ───────────┘
X-Brutor-Outcome-Conformance

Going through the gateway buys what a direct HTTP call cannot: the caller is authorised against a grant with a depth limit, the call is guardrailed in both directions, the delegate’s own model call joins the caller’s run at depth 1 with a cryptographically verified chain, and the delegate’s answer is checked against the delegate’s contract before the caller acts on it.

setup.py step 8. Start the fraud screener first, then register the card it publishes itself, so the registered card can never drift from the running agent:

  1. Fetch the live card from the agent:

    Terminal window
    curl -s http://127.0.0.1:9200/.well-known/agent-card.json
    {
    "name": "Brutor Demo Fraud Screener",
    "version": "0.1.0",
    "protocolVersion": "1.0",
    "url": "http://brutor-demo-fraud-screener-agent:9200",
    "supportedInterfaces": [{"url": "http://brutor-demo-fraud-screener-agent:9200",
    "protocolBinding": "JSONRPC", "protocolVersion": "1.0"}],
    "capabilities": {"streaming": false},
    "defaultInputModes": ["text"], "defaultOutputModes": ["text"],
    "data_classification": ["PII"],
    "skills": [{"id": "screening.fraud_sanctions", "name": "screening.fraud_sanctions",
    "tags": ["screening", "fraud", "sanctions"],
    "description": "Screen an applicant for sanctions-list matches and fraud indicators. ..."}]
    }

    The card’s version is the screener’s release version, so the card, its X-Brutor-Agent-Version header and its identity’s approved_versions all name the same release.

  2. Register it.

    Terminal window
    curl -X POST http://localhost:5050/v1/admin/agent-cards \
    -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
    -d "$(jq -n --argjson card "$(curl -s http://127.0.0.1:9200/.well-known/agent-card.json)" '{
    name: "brutor-demo-fraud-screener", version: $card.version,
    description: "Fraud & Sanctions Screener: the A2A peer the demo system delegates to.",
    card_json: $card, enabled: true}')"
    {"card": {"id": "agentcard-01M61N3AQMB544RJG0G9G9X4YD",
    "name": "brutor-demo-fraud-screener", "version": "0.1.0", "enabled": true}}

    The id is FRAUD_CARD_ID in the agent’s environment.

  3. Sign it with the tenant’s Ed25519 key, so callers can verify the card they resolve:

    Terminal window
    C=agentcard-01M61N3AQMB544RJG0G9G9X4YD
    curl -X POST http://localhost:5050/v1/admin/agent-cards/$C/sign \
    -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" -d '{}'

    Replacing card_json later (a new release) drops the signature; sign again.

  4. Bind it to the calling AI System. This is a PUT that replaces the system’s full set of agent cards:

    Terminal window
    curl -X PUT http://localhost:5050/v1/admin/resource-groups/$G/agent-cards \
    -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
    -d '{"agent_card_ids": ["agentcard-01M61N3AQMB544RJG0G9G9X4YD"]}'

Admin UI: AI Estate → Resources → Agents → Cards.

AI Estate → Resources → Agents → Cards: the registered agent cards, including brutor-demo-fraud-screener, with the tenant public key and signing controls.

Terminal window
curl -X POST http://localhost:5050/v1/admin/agent-identities/$A/grants \
-H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
-d '{"action_type": "a2a_call", "target": "agentcard-01M61N3AQMB544RJG0G9G9X4YD",
"effect": "allow", "constraints": {"max_delegation_depth": 2}}'

max_delegation_depth bounds how deep a chain that starts with this agent may go. The AI System carries the same bound (a2a_global_limits.chain.max_delegation_depth: 2), the operating envelope a third (max_delegation_depth_per_run), and a continuous check raises a critical finding if a run ever goes deeper.

The Demo System cannot decide a loan without the screener’s verdict, and that verdict can force a decline. That makes the screener part of the high-risk system, whatever its own risk tier says. Declare it, so the platform renders the composite system, carries the screener’s contract into the caller’s, and evaluates the screener’s obligations at the caller’s tier:

Terminal window
curl -X POST http://localhost:5050/v1/admin/ai-systems/$G/dependencies \
-H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
-d '{
"role": "shared_service",
"depends_on_system_id": "group-01M61N37B05BXZ6H95P9NSAXXB",
"agent_card_id": "agentcard-01M61N3AQMB544RJG0G9G9X4YD",
"criticality": "critical",
"contributes_to_decision": true,
"contract_pin": null,
"supplier_legal_entity": null,
"expected_outcomes": ["screening_completed.clear",
"screening_completed.hit",
"screening_completed.review"]
}'
Field Value Meaning
role shared_service The screener is its own AI System, serving this one
criticality critical The caller cannot do its job without it
contributes_to_decision true Its output drives the decision, so it inherits the caller’s effective risk tier (high)
contract_pin null Follow the screener’s active contract rather than one pinned version
supplier_legal_entity null Same legal entity, so no Art 25(4) supplier agreement is needed
expected_outcomes the three verdicts Any other answer is an unexpected_delegate_outcome finding on the caller

The expected outcomes come from the screening agent’s own outcomes.json (dependencies[].expected_outcomes), the same file the agent validates against at runtime. The screener’s side accepts the caller through intended_client_systems on its AI System. The declared dependencies are rendered on the system’s Composition tab, carried into its contract, and listed in the Assurance Report’s composition section (Health & the Assurance Report).

The Composition tab of the Brutor Demo System: the system inside Borealis Consumer Finance AB, owner Anna Berg, stage Active, risk high, and its graph of models, MCP servers and the Fraud Screener delegate through the Brutor Gateway.

screening_agent/gateway.py
def a2a_delegate(self, card_id, capability, payload, *, expected_outcomes=None,
step_id=None, step_name=None, turn=None, node=None) -> DelegateAnswer:
hdr = self.headers(step_id, step_name, turn=turn) # run, step, turn, release
hdr["Content-Type"] = "application/json"
body = {
"target_card_id": card_id,
"capability": capability, # screening.fraud_sanctions
"message": {
"messageId": str(uuid.uuid4()),
"role": "user",
"parts": [{"kind": "text", "text": json.dumps(payload)}],
},
}
response = self.http.post(f"{self.base}/v1/proxy/a2a/outbound", json=body, headers=hdr)
out = self._parse_body(response)
self._raise_for_status(response, out)
task = out.get("task") or out.get("result") or {}
state = str((task.get("status") or {}).get("state", "")).upper()
if any(s in state for s in ("FAILED", "REJECTED", "CANCELED", "CANCELLED")):
raise DelegateFailed(f"a2a task ended {state}", body=out)
outcome_id, conformance = self._delegate_outcome(response, task, out)
if conformance != "declared":
raise DelegateDeviated(f"the delegate's outcome {outcome_id!r} is {conformance}")
if expected_outcomes is not None and outcome_id not in expected_outcomes:
raise DelegateDeviated(f"the delegate answered {outcome_id!r}")
...

The request, as it reaches the gateway:

{
"target_card_id": "agentcard-01M61N3AQMB544RJG0G9G9X4YD",
"capability": "screening.fraud_sanctions",
"message": {
"messageId": "6f1c0d2e-4f43-4e0b-9c9a-0d6a8c1f7b21",
"role": "user",
"parts": [{"kind": "text",
"text": "{\"applicant_id\": \"CUST-1001\", \"full_name\": \"Maja Lindholm\", \"date_of_birth\": \"1987-04-12\", \"country\": \"SE\", \"purpose\": \"Kitchen renovation\", \"amount_eur\": 12000, \"bureau\": {\"inquiries_6m\": 1, \"delinquencies_24m\": 0, \"open_credit_lines\": 2}}"}]
}
}

The response is the delegate’s final Task, plus two headers the gateway adds:

HTTP/1.1 200 OK
X-Brutor-Outcome-Id: screening_completed.clear
X-Brutor-Outcome-Conformance: declared
{"task": {"id": "b9a3...", "contextId": "1d07...",
"status": {"state": "TASK_STATE_COMPLETED",
"message": {"role": "ROLE_AGENT",
"parts": [{"kind": "text",
"text": "{\"verdict\": \"clear\", \"sanctions_match\": false, \"reasons\": [\"no sanctions match\", \"no velocity flags\"], \"model_used\": \"gpt-5.2\"}"}]}},
"metadata": {"brutor.outcome.id": "screening_completed.clear"}}}

Branch on the checked outcome, not the body

Section titled “Branch on the checked outcome, not the body”

The delegate reports its outcome; the gateway decides whether that outcome is one the delegate’s contract declares, and says so in X-Brutor-Outcome-Conformance:

Conformance Meaning The screening agent
declared The outcome is in the delegate’s active contract Accepts it, if it is also one of its expected_outcomes
undeclared The delegate reported an outcome its contract does not declare DelegateDeviated: the run errors
unreported The delegate reported nothing DelegateDeviated: the run errors

The checked pair arrives on two carriers, the response headers (synchronous calls) and the final Task’s metadata (streamed or asynchronous tasks); when both are present they must agree. The graph then branches on the variant of the checked outcome, never on the verdict field of the body:

screening_agent/graph.py — the fraud_screen node
answer = gw.a2a_delegate(settings.fraud_card_id, settings.fraud_capability, payload,
expected_outcomes=fraud_expected, **hdr("fraud_screen"))
head, _, v = answer.outcome_id.partition(".") # screening_completed . clear
if head != "screening_completed" or v not in ("clear", "review", "hit"):
raise DelegateDeviated(f"fraud screener outcome {answer.outcome_id!r} names no verdict")
verdict = dict(answer.verdict)
if str(verdict.get("verdict", "")).lower() != v:
log.warning("the body says %r, the checked outcome says %r; the outcome wins", ...)
verdict["verdict"] = v

That is the point of declared outcomes across a delegation: the body is the delegate’s word, the outcome is a fact the gateway checked against what Financial Crime approved. A delegate that starts answering something nobody approved fails the caller’s run, like an unreachable delegate does, instead of silently changing lending decisions.

The screener’s code is given, but these four rules are what make the delegation show up as one run, and they apply to any agent you put behind A2A:

  1. Echo the chain. The gateway signs the delegation into x-brutor-delegation-root, -parent, -depth, -sig (and -actor, -subject for an agent caller). On its own model call the delegate copies every x-brutor-delegation-* header unchanged. The HMAC would not verify if a value were rewritten.
  2. Send no run id. The signed chain places the delegate’s call in the caller’s run at depth 1 with trace_continuity=verified. An asserted x-brutor-run-id would at best be ignored.
  3. Declare a turn, not a step. X-Brutor-Turn-Id and X-Brutor-Turn-Seq: 1 are fine. Steps are the orchestrator’s phases; a delegate cannot know which phase it serves, and a delegate step would inflate the caller’s step count.
  4. Use its own key, and report its outcome. The delegate authenticates as itself, so its model call is attributed to the Fraud Screener AI System (which then appears in the caller run’s via_system_ids), and it returns X-Brutor-Outcome-Id and metadata["brutor.outcome.id"] on every completed task.

A completed screening run therefore reads 3 steps, 3 turns and 9 actions: eight from the screening agent and one, the screener’s model call, at depth 1. The chain must be fresh (about 11 minutes) and the gateway’s outbound timeout is 30 s, so the delegate answers promptly. The full protocol is in A2A agents.

Composition with one run overlaid: the graph of the nine actions and, beside it, the sequence grouped by step — Gather the application facts (applications_get, bureau_verify_identity, bureau_get_report, the affordability-check skill), Assess risk and fraud (gpt-5.2, the A2A call screening.fraud_sanctions and, as 6a, the Fraud Screener’s own gpt-5.2 call), and Decide and record (gpt-5.5, applications_set_recommendation).

Next: the graph that ties the steps into one run.