Skip to content

LearnAI and LLM

Agent-to-agent delegation review

Brief

When an orchestrator agent hands a task to another agent, the second one often runs as the orchestrator's service identity, with the whole conversation attached and its answer trusted as if the user had typed it. The review inventories every handoff and checks identity, forwarded context, result handling and logging with two test accounts, with the fix beside each.

Stage
Escalation
Reviewed
On this page
  1. Check first
  2. Which agents hand work to which, and how?
  3. What identity does the receiving agent run as, and whose permissions apply?
  4. What context is forwarded, and does anything travel that should not?
  5. How is the receiving agent's result trusted?
  6. What does the trace record for one delegated task?
  7. The defender sees
  8. Done when
  9. Not covered
  10. Tools
  11. Related research
  12. Reviewed

All commands

Situation
An agent system named in the scope letter where one agent calls another, either in process or over a protocol such as A2A, with the orchestrator's agent and handoff configuration, access to its trace store, and test accounts in two roles with test data on each side. Each conversation uses a harmless marker string, never a real secret, and only test objects are named. Nothing is sent to an agent outside the client's environment.
Goal
A delegation table: each handoff, the identity the receiving agent runs as, whose permissions apply, what context is forwarded, how the result is used, and what the trace records.
Outputs
Representative examples on placeholder hosts, trimmed to the lines that matter. Not captured from a public fixture yet.

Check first

  • Every agent in the system and which ones can hand work to which, from configuration rather than from asking the model.
  • How each handoff travels: a function call inside one process, a queue, or an HTTP call to a remote agent.
  • The credential each receiving agent uses for its own tools and data.
  • Where traces go, and whether a delegated task keeps the user's id and one trace id across agents.
  • Two test accounts in different roles, with a test object only the higher role may read.

Steps

Which agents hand work to which, and how?

curl -s https://agents.example.com/.well-known/agent-card.json \
  | jq -c '{name, url, schemes: (.securitySchemes // {} | keys), skills: [.skills[].id]}'
grep -rn -E 'handoffs?|sub_?agents?|remote_agent' orchestrator/config/ | cut -c1-120

Expected output

{"name":"records-agent","url":"https://agents.example.com/a2a","schemes":[],"skills":["lookup_customer","export_records"]}   # <- a remote agent that declares no authentication
orchestrator/config/agents.yaml:14:  handoffs: [records-agent, billing-agent]
orchestrator/config/agents.yaml:31:  sub_agents: [summariser]

The configuration names each handoff; the Agent Card of each remote agent says how a caller must authenticate. A remote agent that declares no scheme takes tasks from anything that can reach it.

Negative result. Every remote agent declares a scheme and refuses an unauthenticated task; every handoff in code is in the configuration.

Fix. Require authentication on every remote agent, restrict who can reach it on the network, and list allowed callers per agent.

What identity does the receiving agent run as, and whose permissions apply?

jq -r '.spans[] | select(.name == "handoff.records-agent") | .attributes["auth.token_claims"] | fromjson | {sub, azp, act, scp}' trace-tester-a.json

Expected output

{"sub":"svc-orchestrator","azp":"orchestrator","act":null,"scp":"records.read.all"}   # <- the orchestrator's service identity, no user, every record

In this client's tracing, the span holds the decoded claims of the token sent with the handoff, never the token itself. Here the receiving agent runs as the orchestrator with a scope over every record, so the user's role does not apply. We confirm it with two test accounts: tester-a, a viewer, asks for the test object only the admin role may read, and gets it.

Negative result. The token's subject is the user, with the orchestrator in act or azp (an on-behalf-of or token exchange token), and the viewer's request is refused.

Fix. Pass the user's identity down every handoff with a delegated token (on-behalf-of in Entra ID, token exchange elsewhere), and give each agent's own identity only what it needs when no user is present.

What context is forwarded, and does anything travel that should not?

jq -r '.spans[] | select(.name | startswith("handoff.")) | .attributes["handoff.payload"] | fromjson
  | [paths(scalars) | map(tostring) | join(".")] | .[]' trace-tester-a.json | sort -u | grep -E 'history|env|header|memory'
grep -c 'atzmk-b-3e1' trace-tester-a.json

Expected output

context.env.CRM_API_KEY   # <- the name of a secret travels in the handoff; its value is not printed
context.history.0.content
context.memory.shared_notes
2   # <- tester-b's marker appears in tester-a's handoff

We list the paths in each handoff payload, never the values, and search for a marker tester-b wrote in their own conversation earlier. Its presence in tester-a's handoff means shared memory or history crosses users.

Negative result. The payload holds the task and the fields the receiving agent needs, no environment names, and no other user's marker.

Fix. Forward a task description built for the receiving agent, not the conversation; keep secrets in the receiving agent's own store; scope memory per user.

How is the receiving agent's result trusted?

grep -n -E 'treat_as|result_schema|tools_allowed' orchestrator/config/agents.yaml

Expected output

36:    treat_as: instructions   # <- the sub-agent's answer is fed back as instructions the orchestrator may act on

A result is data from another system. If it is fed back as instructions, any text that reaches the receiving agent can steer the orchestrator's tools, which is where the prompt injection page takes over.

Negative result. Results are validated against a schema and handled as data, and actions they suggest need the user's confirmation.

Fix. Define a result schema per handoff, reject anything outside it, and never let a result add tools or change the plan without a confirmation.

What does the trace record for one delegated task?

jq -c '[.spans[] | {name, user: .attributes["enduser.id"], trace: .trace_id}]' trace-tester-a.json

Expected output

[{"name":"orchestrator.turn","user":"tester-a","trace":"4bf92f35"},{"name":"handoff.records-agent","user":null,"trace":"4bf92f35"}]   # <- the user drops out at the handoff

Negative result. Every span carries the user, the agent and one trace id.

Fix. Propagate the user and trace id across every handoff and log the receiving agent's credential subject beside them.

The defender sees

Our two test accounts' conversations, the handoffs they caused, and reads of configuration and traces. A trace that keeps the user through each handoff lets the client see that a viewer's request reached admin-only data; one that drops the user shows only the orchestrator's service identity reading records, which looks normal. That gap goes in the report.

Done when

Every handoff is listed from configuration, each receiving agent's credential is classed as the user's, delegated or its own, the two-account check has run on each, forwarded context has been checked for the marker and for secret names, result handling is recorded, and one delegated task has been traced end to end.

Not covered

Making an agent delegate through injected text (see prompt injection testing), the MCP servers agents call (see MCP server trust review), and model vendor controls; the outputs shown are representative examples on placeholder hosts, not captured runs.