Looking at back_agent/workflow/react_agent_workflow.py:16:
_MAX_REACT_ITERATIONS = 100
That's the cap on the ReAct outer loop in _run_with_tools. With a typical workspace-building task running 5-10 tool calls per agent turn, 100 iterations is roughly thousands of model tokens spent before the loop gives up — at a deepseek-chat-equivalent rate this is non-trivial cost, and at OpenAI rates it could be tens of dollars per stuck request.
I don't see a per-iteration token budget anywhere, and model.chat doesn't expose total tokens to the workflow either. So the only ceiling on a runaway agent today is "100 iterations × max_tokens=8100", which is about 800k output tokens.
Some questions I'd love to understand before suggesting any change:
- Was 100 picked because real workspace-build tasks were occasionally hitting 60-70? Or was it just a safety net far above any observed run?
- Would it make sense to expose this through
ReactAgentWorkflowConfig (currently only flow_type and enable_progressive_skill_disclosure), so deployments can tighten it?
- The loop already accepts an override via
kwargs.pop("max_react_iterations", _MAX_REACT_ITERATIONS) on line 212 — is there a story for plumbing that through to the FastAPI endpoint at back_agent/api.py?
Not flagging this as a bug, just want to make sure the budget reflects an actual policy rather than an unbounded "100 should be enough for anyone".
Looking at
back_agent/workflow/react_agent_workflow.py:16:That's the cap on the ReAct outer loop in
_run_with_tools. With a typical workspace-building task running 5-10 tool calls per agent turn, 100 iterations is roughly thousands of model tokens spent before the loop gives up — at adeepseek-chat-equivalent rate this is non-trivial cost, and at OpenAI rates it could be tens of dollars per stuck request.I don't see a per-iteration token budget anywhere, and
model.chatdoesn't expose total tokens to the workflow either. So the only ceiling on a runaway agent today is "100 iterations ×max_tokens=8100", which is about 800k output tokens.Some questions I'd love to understand before suggesting any change:
ReactAgentWorkflowConfig(currently onlyflow_typeandenable_progressive_skill_disclosure), so deployments can tighten it?kwargs.pop("max_react_iterations", _MAX_REACT_ITERATIONS)on line 212 — is there a story for plumbing that through to the FastAPI endpoint atback_agent/api.py?Not flagging this as a bug, just want to make sure the budget reflects an actual policy rather than an unbounded "100 should be enough for anyone".