Garbage collection (GC) is an automatic memory management process that identifies and reclaims memory occupied by objects that are no longer in use by the program, preventing memory leaks. In agentic systems, GC is critical for managing the ephemeral state within a working set, such as intermediate reasoning steps or obsolete conversation context, ensuring efficient use of limited context windows. It operates by tracing object reachability from root references, like active agent variables or session data.
