All posts

Agent security

What Are the Security Risks of AI Sub-agents? A Permissions-Handoff Case Study

Review subagent tools, inherited credentials and parent-worker handoffs. Use a synthetic case to inspect authority, returned evidence and external recipients.

Harden cover: Subagent Handoffs. A right-column parent to worker to tools diagram illustrates the workflow. Conceptual editorial artwork; no measured result is depicted.

Executive summary

Subagents introduce security risk when delegated work gains more authority than the parent task, returns untrusted instructions as trusted conclusions, or loses the evidence connecting a result to its actions. Review each handoff as a permissions boundary. Our illustrative case follows a parent agent assigning a repository investigation to a worker. It is a constructed design review, not a disclosed incident or a measured claim about every multi-agent framework.

The assignment starts with one legitimate job

An engineer asks a parent agent to explain a failing staging checkout test and propose a patch. The parent delegates dependency inspection to a worker. That worker needs repository reads and perhaps a constrained test command. The assignment does not authorize production access, new external recipients, or changes to release credentials.

Write the delegated job explicitly. Include the expected output, permitted tools, reachable resources, and actions that require a separate decision. “Investigate everything needed” makes it difficult to distinguish a useful discovery from an unauthorized expansion of scope.

The worker may be another local context, a remote agent, or an external service. Identify which one. A separate context window is not proof of a separate process, operating-system sandbox, or credential boundary. The execution architecture determines which controls can enforce the delegation.

Check what the worker actually inherits

Claude Code's subagent documentation describes tool access, permission behavior, and configuration for its subagents. Those are product-specific details. Inspect the installed version and selected agent definition rather than carrying its behavior into another framework.

For the illustrative worker, record the active identity, working directory, environment variables, mounted files, network access, and available tools. Compare those facts with the intended assignment. A “read-only reviewer” label is insufficient if a helper tool holds a write-capable credential.

Review inheritance and explicit additions separately. A parent may already have broad authority that the worker should not receive. A worker definition may add a tool or service the parent did not use. Both can expand the effective access of the delegated task.

Treat resource ownership as part of the boundary. A worker inspecting one repository should not automatically reach sibling repositories or a developer's home directory. A remote worker should receive the smallest necessary input rather than an archive of the entire workspace.

Follow a suspicious handoff

Suppose the worker reads a dependency note containing an instruction to upload diagnostic files to an unfamiliar service. The note can provide information about the package. It cannot grant authority to choose a new recipient or disclose unrelated files.

The worker's next proposed action is the useful inspection point. Which files would be read? Which credential would authenticate the request? What destination would receive the content? Is that transfer part of the engineer's staging investigation?

Now consider the return path. The worker might send the parent a summary saying that the upload is required to fix the test. The parent should treat that as a claim requiring evidence. Delegation does not transform repository text into an authorized instruction.

Require consequential recommendations to identify their source and proposed effect. The parent can inspect the relevant evidence, reject the unrelated transfer, and continue the legitimate investigation. Keeping the task useful matters; the desired response is a bounded continuation, not an unexplained failure.

Keep authority separate from confidence

Two agents agreeing on an action does not authorize that action. They may rely on the same poisoned note, share the same assumption, or inherit the same overpowered credential. Agreement can organize review, but it is not independent evidence of permission.

Likewise, a worker's specialized role does not automatically make its output trustworthy. A security-review worker can propose a harmful command, and a documentation worker can encounter sensitive files. Inspect the operation and source context instead of assigning trust from the role name.

Use structured handoffs where they improve clarity. A worker can return the finding, source location, proposed change, affected resource, required authority, and uncertainty. The parent then has enough information to decide whether the next operation stays inside the assignment.

Avoid copying unnecessary sensitive material into every return message. A reference to a restricted evidence record may be more appropriate than reproducing a credential or full customer row. The handoff itself is another data transfer to review.

Test the parent and worker as one path

In a disposable environment, create a harmless repository note and a second synthetic note that proposes an unrelated upload. Use a controlled recipient and synthetic sensitive markers. Do not retrieve or run an actual malicious dependency for the exercise.

Record the parent assignment, worker definition, tool configuration, proposed transfer, decision, and observed effect. Then inspect what the parent did with the worker's return value. The exercise should cover both the outbound action and the possibility that the parent repeats the recommendation through another tool.

Test an allowed handoff too. The worker should be able to inspect the approved fixture and return a useful diagnosis. A control that prohibits all delegation may avoid the synthetic transfer while failing the engineering requirement.

Keep the result scoped. One passing parent-worker example does not establish arbitrary nesting, external agents, or every tool route. Add cases for the actual architecture before expanding authority, and repeat relevant checks when worker definitions or credentials change.

Put a control and an owner at the handoff

Use native tool restrictions, scoped credentials, execution isolation, and recipient policy where applicable. Identify who approves worker definitions and who responds when a delegated action exceeds the task. An unexplained gap between parent and worker ownership can leave both teams assuming the other enforced the boundary.

Harden evaluates supported agent calls before execution using relevant task context and policy. For delegated workflows, verify which worker calls pass through the configured integration and whether the necessary context is available. Do not infer coverage of external agents or independent processes from a successful parent-agent check.

Our subagent security guide provides the maintained handoff checklist. Bring the parent-worker route to Control, or Book a Call with one legitimate delegation and one prohibited variation to evaluate.

FAQs

Can two individually restricted agents create a risky workflow?

They can combine access or pass information in a way neither isolated review considered. Inspect the composed path, including which agent reads data and which can transmit or modify it. Separate assessments do not establish the authority of the combined workflow.

Does a separate context window isolate credentials?

A context window describes model input separation. Credential isolation depends on the runtime, tools, environment, and identity. Verify those boundaries directly. Do not treat a new conversation or worker name as proof that operating-system or service privileges have changed.

Should subagents always have fewer tools?

Give the worker the tools required for its assignment and verify their effective authority. A smaller list can still include a broadly privileged tool. Review resources, operations, and credentials as well as tool count, then test that the legitimate delegated job still works.

How should the parent validate a worker's recommendation?

Ask for the evidence, affected resource, proposed effect, and authority required. Inspect consequential recommendations before execution. A worker summary can assist the parent, but it should not grant permission to change production or disclose data outside the original assignment.

Can we block communication with unapproved external agents?

Define the permitted recipients and enforce the restriction at the relevant network, tool, or service boundary. Inventory actual routes, including helper processes. A prompt telling the worker to stay internal does not by itself remove access to an external service.