Skip to content

docs: clarify ReAct loop depth controls#4042

Draft
deepujain wants to merge 1 commit into
UKGovernmentBEIS:mainfrom
deepujain:issue-2716-react-loop-depth-docs
Draft

docs: clarify ReAct loop depth controls#4042
deepujain wants to merge 1 commit into
UKGovernmentBEIS:mainfrom
deepujain:issue-2716-react-loop-depth-docs

Conversation

@deepujain
Copy link
Copy Markdown
Contributor

This PR contains:

  • New features
  • Changes to dev-tools e.g. CI config / github tooling
  • Docs
  • Bug fixes
  • Code refactor

What is the current behavior? (You can also link to an open issue here)

The ReAct agent documentation explains continuation handling and the submit tool separately, but it does not give users a direct pattern for bounding a ReAct agent's loop depth. In fixed-turn agent conversations, this makes it hard to tell whether to disable submit(), rely on on_continue, or use sample limits.

Closes #2716.

What is the new behavior?

  • Adds a "Controlling Loop Depth" section to the ReAct agent docs.
  • Shows a fixed-turn client/service-agent pattern that disables the submit tool with submit=False and lets the outer workflow decide turn order with run().
  • Shows how to keep the default submit tool while using an on_continue callback to stop after a bounded number of assistant turns or send a targeted continuation message.
  • Points readers to task-level and scoped message/token/time limits for hard safety bounds.

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No. This is a docs-only change and does not alter runtime behavior.

Other information:

Validation:

  • Targeted:
    • uv run pytest tests/agent/test_agent_react.py -v
      • 21 passed.
      • Exercises the ReAct behaviors described by the new docs section, including submit=False, custom submit tools, string and callable on_continue, retry/refusal handling, and truncation paths.
  • Regression:
    • uv run make check
      • Passed ruff, formatting, tool-support checks, and mypy over 1114 source files.
    • uv run make test
      • Passed the full local pytest suite: 7920 tests collected.

CI/CD coverage expected:

  • Standard Build workflow should cover ruff, mypy, package, and pytest checks.
  • Log Viewer workflow is not expected to require generated artifact changes because this PR only edits docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to control the agent thinking depth

1 participant