Skip to content

Smart Agent: avoid repeating exhausted tool calls#82

Open
arnaugrispg wants to merge 5 commits into
mainfrom
arnaugris/sc-15172/smart-agent-prevent-redundant-tool-retries
Open

Smart Agent: avoid repeating exhausted tool calls#82
arnaugrispg wants to merge 5 commits into
mainfrom
arnaugris/sc-15172/smart-agent-prevent-redundant-tool-retries

Conversation

@arnaugrispg

Copy link
Copy Markdown
Contributor

Summary

Prevent the Smart Agent from repeating the same tool call with the same arguments after a previous empty or failed result.

The change applies to both reactive and plan_execute flows:

  • Repeated exhausted tool calls are skipped during execution
  • Exhausted attempts are surfaced to the planner so they do not reappear in later plans
  • Skipped internal retries are kept out of the final answer context

Testing

  • Added a deterministic test for reactive mode to verify identical empty-result tool calls are not executed twice
  • Added a deterministic test for plan_execute mode to verify exhausted attempts are exposed to the planner and not re-planned

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Smart Agent orchestration to avoid repeating identical tool calls once they’ve already returned an empty or error result, and to surface those exhausted attempts to the plan-execute planner so they are not re-planned.

Changes:

  • Track prior tool attempts (tool + arguments) and skip repeated calls after empty/error outcomes during execution.
  • Extend plan-execute planner prompts to include prior tool attempt outcomes in execution history.
  • Add deterministic tests for both reactive and plan_execute modes to validate non-repetition and planner visibility.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
agents/smart/src/hyperforge_smart/agent.py Adds tool-attempt tracking, tool-call keying/normalization, and skip logic for repeated empty/error calls.
agents/smart/src/hyperforge_smart/prompts.py Updates planner guidance and prompt template to show tool attempts in execution history.
agents/smart/tests/test_smart.py Adds deterministic tests validating non-repeated empty tool calls and planner visibility of exhausted attempts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agents/smart/src/hyperforge_smart/agent.py Outdated
Comment thread agents/smart/src/hyperforge_smart/agent.py Outdated
Comment thread agents/smart/tests/test_smart.py Outdated
arnaugrispg and others added 4 commits July 21, 2026 14:44
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

3 participants