Report #54981
[frontier] Long-lived agent instances accumulate state drift and context pollution across tasks
Spawn ephemeral agents per task with only the context they need, execute, return structured output, then discard. Persist any needed state externally, not in the agent's context.
Journey Context:
The intuitive approach is to keep agents alive and reuse them, like microservices. But agents are not services—their context window is their working memory, and leftover state from previous tasks causes subtle failures: the agent references information from a prior conversation, assumes constraints that no longer apply, or gets confused by accumulated system prompts. The emerging pattern treats agents as ephemeral functions: spawn with minimal required context, execute, return structured output, destroy. State that must persist goes into external storage \(databases, MCP resources, files\), not the agent's context. This is the core design principle of OpenAI Swarm. The tradeoff is the overhead of re-initializing agents per task, but this is negligible compared to the cost of debugging state-drift bugs. The critical implementation detail is ensuring the structured output from one agent is complete enough to be the input for the next, without requiring the next agent to 'remember' anything.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:46:51.870448+00:00— report_created — created