AutoGPT
AutoGPT copied to clipboard
Fix agent key error
Background
If AutoGPT attempted to use message_agent with the key as a string [STRING], the command would return "Error: invalid literal for int() with base 10: '[STRING]'". This confused the AI and could lead to loops or JSON errors.
Changes
Before, the message_agent function in commands.py allowed the key to be a string, generating the error described above. The message_agent function has been modified to only allow the key to be an integer, returning "Invalid key, must be an integer." if it is not.
Documentation
Test Plan
The changes were tested by using human feedback to instruct the agent to use a string as a key, and verifying the command returned "Invalid key, must be an integer." if it was. The agent was then allowed to use an integer as a key, which produced the expected result.
PR Quality Checklist
- [x] My pull request is atomic and focuses on a single change.
- [x] I have thoroughly tested my changes with multiple different prompts.
- [x] I have considered potential risks and mitigations for my changes.
- [x] I have documented my changes clearly and comprehensively.
- [x] I have not snuck in any "extra" small tweaks changes
@nponeccop replacement for #1341
@jacobtohahn There are conflicts now
@nponeccop thanks for the heads up, just resolved them