uAgents
uAgents copied to clipboard
feat(core): add conditional callbacks
trafficstars
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:
- add agent interface to get/set the current agent state as
str - add desired state as
strto.on_interval()handler to only trigger that function based on the current agent state - add desired state as
strto.on_message()handler to only react to messages based on the current agent state - decorators without the explicit mention of a state will act as usual
If desired we can add an example of state management