Event-Driven Task Handling

AI agents built with HelperAI can easily handle event-driven task response flows. Taking the example of daily email communication, if a tool provides both sending and receiving emails as commands, the sending email command belongs to traditional non-event-driven tasks.

Any time an agent understands the user's intention to send an email, it can simply call the send email command to complete the task. However, the receiving email command belongs to event-driven tasks because executing the receiving email command requires waiting for an external event trigger, such as receiving a new email. The agent will then proceed with the next planned actions after receiving the email.

In this case, you can set the isSubscription attribute of the receiving email command in the Tool Manifest to true, making it a subscription-based command.

When the agent sends the receiving email command to the Tool, the Tool can establish a corresponding scheduled processing operation based on the subscriptionId (subscription identifier) of that command. Whenever the Tool detects any new emails, it can call the callback webhook. Please note that when isSubscription = true, a command request can receive multiple callback webhooks. Therefore, the Tool can easily implement mailbox monitoring logic and directly call the callback webhook to notify the Agent whenever a new email arrives.

For more information on defining event-driven task handling tools, please refer to the "subscription-command.md" guide.