Describe the bug
Reasoning code mutates a shared system prompt on the agent LLM during planning and execution. In parallel runs, one in-flight reasoning call can overwrite another call’s prompt, causing cross-agent prompt bleed and non-deterministic behavior.
Relevant Files : cot.py ,react.py,reasoning.py
Expected behavior
System prompt should be scoped per generate call, not mutated as shared instance state during concurrent reasoning.
To Reproduce
- Enable parallel stepping with multiple LLM agents.
- Run simulation where multiple agents call planning in same step.
- Observe occasional inconsistent tool choice or plan output that does not match the intended reasoning prompt context.
- Inspect reasoning files and see shared prompt mutation before generate calls.
Describe the bug
Reasoning code mutates a shared system prompt on the agent LLM during planning and execution. In parallel runs, one in-flight reasoning call can overwrite another call’s prompt, causing cross-agent prompt bleed and non-deterministic behavior.
Relevant Files : cot.py ,react.py,reasoning.py
Expected behavior
System prompt should be scoped per generate call, not mutated as shared instance state during concurrent reasoning.
To Reproduce