-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
needs-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the authorquestionQuestion about using the SDKQuestion about using the SDK
Description
Describe the bug
Agent objects accumulate in memory during long-running workflows because RunItem objects hold strong references that are never released.
Debug information
- Agents SDK version: v0.6.4
- Python version: Python 3.12
Repro steps
Run an agent multiple times in a loop. Agent objects accumulate in memory instead of being garbage collected.
In src/agents/run.py (line 774), lists are cleared without releasing agent references:
turn_result.pre_step_items.clear()
turn_result.new_step_items.clear()
The SDK has a release_agent() method for this, but it's never called.
Expected behavior
Memory should stay constant across multiple runs, not grow indefinitely.
Metadata
Metadata
Assignees
Labels
needs-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the authorquestionQuestion about using the SDKQuestion about using the SDK