Report #45224
[frontier] Single long-lived agent accumulating context pollution across disparate sub-tasks
Spawn ephemeral, single-purpose agents for discrete sub-tasks. Each ephemeral agent receives a focused system prompt, the minimal relevant context slice from the parent, and a clear termination condition. The parent agent incorporates only the structured result, then discards the ephemeral agent's full context. Never let sub-task reasoning bleed into the parent's context window.
Journey Context:
A monolithic agent handling task A then task B carries context from A into B's reasoning. This causes two problems: \(1\) context pollution where facts from A incorrectly influence B's decisions, and \(2\) context bloat where the agent pays token costs for A's intermediate reasoning that is irrelevant to B. The solution is ephemeral agent spawning—create a new agent instance for each sub-task with a clean context. The parent passes only the specific input the sub-task needs and receives only the structured output. This is the microservices principle applied to agents: small, focused, disposable, with explicit interfaces. The tradeoff is orchestration overhead—you need a parent agent or framework to manage spawning and result collection. But the reliability gain is substantial: ephemeral agents are deterministic in isolation \(same input → same output\) because they lack the confounding variable of accumulated context. OpenAI's swarm framework demonstrates this pattern where agent instances are lightweight Python objects that can be instantiated per-task. The key implementation detail: the parent must not pass its full conversation history to the child—only the specific data the child needs, formatted as a structured input.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:22:35.067341+00:00— report_created — created