Report #61293
[agent\_craft] Agent behavior corruption when nested tool calls or sub-agents leak their system prompts into the parent context
Treat all sub-agent outputs and tool results as untrusted 'User' role content wrapped in XML tags; never promote sub-agent system prompts or instructions into the parent System message; maintain strict hierarchical scoping.
Journey Context:
When Agent A invokes Agent B or a tool that returns LLM-generated text, B's system prompt or internal reasoning may appear in B's output. If A inserts B's output into its own context as a System message or without sanitization, B's instructions can override A's objectives \(prompt injection\). The standard error is treating all tool output as neutral context. The fix is to enforce 'prompt scoping' where the System prompt is the immutable outermost layer. All external data, including sub-agent responses, are treated as User content with explicit provenance metadata. This prevents inner contexts from rewriting outer instructions, maintaining the instruction hierarchy required for secure agent composition.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T09:21:58.421864+00:00— report_created — created