camel
camel copied to clipboard
feat(agents): Implement conditional message recording in chat agent
Description
Enhance the flexibility of the ChatAgent memory by introducing a record_message_condition parameter. This allows for more granular control over the storage of messages in business logic.
- Added a
record_message_conditionparameter to thestepmethod. - Moved the
record_input_messagemethod to execute after the model's result, allowing therecord_message_conditionreturn value to decide if messages should be saved. - Controlled the storage of tool records through
record_message_condition. - Added some test case
Fixes #1889
Checklist
Go over all the following points, and put an x in all the boxes that apply.
- [x] I have read the CONTRIBUTION guide (required)
- [x] I have linked this PR to an issue using the Development section on the right sidebar or by adding
Fixes #issue-numberin the PR description (required) - [ ] I have checked if any dependencies need to be added or updated in
pyproject.tomlanduv lock - [ ] I have updated the tests accordingly (required for a bug fix or a new feature)
- [ ] I have updated the documentation if needed:
- [ ] I have added examples if this is a new feature
If you are unsure about any of these, don't hesitate to ask. We are here to help!