mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 13:48:09 +00:00
The process-global event bus recorded every emitted event into a RuntimeState (entity `root` list + `event_record`) on every kickoff, unconditionally and with no eviction. Only the checkpoint/replay machinery ever reads that recorder, so for the common "construct a Flow/Crew, kickoff, discard" pattern it grew ~linearly with kickoff count until a long-lived process (worker, request handler, scheduler) was OOM-killed. Gate recording behind an armed flag: the bus only registers entities and records events once recording is enabled, which happens when a CheckpointConfig is resolved on a Crew/Flow/Agent or when a state is restored via set_runtime_state(). Plain and @persist kickoff loops now record nothing; checkpoint/replay behavior is unchanged. Also expose a public reset_runtime_state() so embedders that checkpoint but never replay in-process can bound memory between runs.