Bug Description
When running BaseAgent with max_iterations=1 for single-step execution, the internal iterations counter persists across multiple agent_loop() calls. This causes the agent to stop executing after the first turn unless the counter is manually reset to 0 before each turn. Both UserAgent and ProactiveAgent currently use a hacky workaround (self.react_agent.iterations = 0) that violates proper encapsulation and doesn't conform to Meta-ARE standards.
BaseAgent can be reset by passing reset=True, however, this also erases all the logs and history for the agent which causes issues as well.
Steps to Reproduce
- Create a UserAgent with max_iterations=1 (pas/agents/user/agent.py:73)
- Call user_agent.agent_loop() for the first turn
- Agent executes successfully (iterations: 0 → 1)
- Call user_agent.agent_loop() for the second turn without manual reset
- Agent immediately exits because self.react_agent.iterations = 1 already equals max_iterations
- No tool calls execute on turn 2
Expected Behavior
When calling agent_loop() multiple times:
- Each call should execute exactly max_iterations steps (e.g., 1 step for UserAgent)
- The iterations counter should reset automatically between turns
- No manual manipulation of internal BaseAgent state should be required
- The reset parameter in BaseAgent.run() should handle counter resets properly
Actual Behavior
Without the manual workaround:
1. Turn 1: Agent executes 1 step (iterations: 0 → 1) ✓
2. Turn 2: Agent immediately exits (iterations already = 1) ✗
3. Turn 3+: Agent never runs again ✗
Current workaround (pas/agents/user/agent.py:316-318):
# Reset the internal iterations counter, otherwise after first turn, the agent will exit.
# ! FIXME: Find a better solution for this iterations issue.
self.react_agent.iterations = 0
Same workaround in (pas/agents/proactive/agent.py:475-477):
# ! FIXME: Find a better solution for this iterations issue.
self.observe_agent.iterations = 0
Component
Agents
Environment
- OS: macOS 15.6
- Python version: 3.13.2
- PAS version/commit: v0.0.1 (commit 3bc3835)
- Branch: main
- Installed via: uv
Minimal Reproducible Example
Relevant Logs
Additional Context
No response
Pre-submission Checklist
Bug Description
When running BaseAgent with max_iterations=1 for single-step execution, the internal iterations counter persists across multiple agent_loop() calls. This causes the agent to stop executing after the first turn unless the counter is manually reset to 0 before each turn. Both UserAgent and ProactiveAgent currently use a hacky workaround (self.react_agent.iterations = 0) that violates proper encapsulation and doesn't conform to Meta-ARE standards.
BaseAgent can be reset by passing
reset=True, however, this also erases all the logs and history for the agent which causes issues as well.Steps to Reproduce
Expected Behavior
When calling agent_loop() multiple times:
Actual Behavior
Component
Agents
Environment
Minimal Reproducible Example
Relevant Logs
Additional Context
No response
Pre-submission Checklist