uAgents icon indicating copy to clipboard operation
uAgents copied to clipboard

feat(core): add conditional callbacks

Open Archento opened this issue 1 year ago • 0 comments
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 str to .on_interval() handler to only trigger that function based on the current agent state
  • add desired state as str to .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

Archento avatar Mar 13 '24 14:03 Archento