Skip to content

Comments

fix: remove Think action and provide error feedback for invalid actions#22

Merged
douglaz merged 1 commit intomasterfrom
fix/remove-think-action-add-error-feedback
Aug 31, 2025
Merged

fix: remove Think action and provide error feedback for invalid actions#22
douglaz merged 1 commit intomasterfrom
fix/remove-think-action-add-error-feedback

Conversation

@douglaz
Copy link
Owner

@douglaz douglaz commented Aug 31, 2025

Summary

This PR improves agent robustness by removing the unused Think action and providing explicit error feedback when actions are malformed.

Changes

  • Remove unused Think action variant from Action enum
  • Replace silent Think fallback with explicit error messages
  • Add error feedback when action format is invalid (e.g., missing use_tool: prefix)
  • Store errors in agent memory for self-correction
  • Add comprehensive tests for invalid action handling

Problem Solved

Previously, when the LLM generated malformed actions (like shell:run_command without the use_tool: prefix), the agent would silently fall back to the Think action which did nothing. This caused the agent to get stuck in confusion loops without understanding what went wrong.

Solution

Now the agent receives clear error messages like:

Invalid action format: 'shell:run_command'. Expected one of: use_tool:<tool>, remember:<key>, explore, wait

These errors are stored in memory as error_<timestamp> entries, allowing the agent to:

  1. See what went wrong in its next observation
  2. Learn from the error
  3. Self-correct by using the proper format

Test Plan

  • Unit tests pass
  • New test added for invalid action error handling
  • Tested with Fedimint challenge - agent receives and learns from errors
  • All formatting and linting checks pass

- Remove unused Think action variant from Action enum
- Replace silent Think fallback with explicit error messages
- Add error feedback when action format is invalid
- Store errors in agent memory for self-correction
- Add comprehensive tests for invalid action handling

This change improves agent robustness by providing clear error feedback
when actions are malformed, allowing the agent to observe errors and
self-correct rather than silently failing with the Think action.
@douglaz douglaz enabled auto-merge (squash) August 31, 2025 02:03
@douglaz douglaz merged commit 272159a into master Aug 31, 2025
4 checks passed
@douglaz douglaz deleted the fix/remove-think-action-add-error-feedback branch August 31, 2025 02:07
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.

1 participant