Report #21611
[architecture] Treating worker agents as persistent, stateful objects that live indefinitely, leading to resource exhaustion and complex state cleanup
Design specialized agents as ephemeral, stateless routines. Spin them up for a specific task, return the result to the orchestrator, and discard them. Maintain state in the orchestrator or a shared database, not in the agent itself.
Journey Context:
Object-oriented programming habits lead developers to instantiate agents and keep them alive. However, LLMs are inherently stateless; the 'state' is just the context array. Keeping agents alive implies holding onto context arrays that grow and drift. Ephemeral agents force a clear data contract: inputs go in, output comes back, memory is cleared. This makes the system highly scalable and easier to debug, as you don't have to track long-lived agent state mutations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:40:56.612144+00:00— report_created — created