-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core): add conditional callbacks #259
Conversation
await _send_error_message( | ||
context, | ||
sender, | ||
ErrorMessage(error="Agent not in correct state to handle message"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we support custom error messages the developer can provide with the decorator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently if an agent has no handler for a message, it is simply ignored, so I kind of think we should treat being in wrong state to handle a message the same as not having a handler for that message. So for consistency with the current setup, we would ignore that case. However, I can see the case for sending error messages back in both cases, because at the moment I don't think the sending agent gets any feedback when sending an invalid or incorrect message to an agent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I like the idea and the implementation looks good and backwards compatible from the user's side. But given that this is a fundamental change to the framework, let's leave this open for a while longer for others to weigh in on it.
Closing this PR as requirements have changed and the current framework is better kept lean. |
Based on feedback from the community and the opened discussion #249.
Adds conditional functionality to agents callbacks by providing the following capabilities without breaking backwards compatibility:
str
str
to.on_interval()
handler to only trigger that function based on the current agent statestr
to.on_message()
handler to only react to messages based on the current agent stateIf desired we can add an example of state management