Agents are a powerful way to extend the capabilities of Flow. They allow you to create custom logic and functionality that can be triggered by workflows and tasks.
The connection of an Agent to Flow is established through a long poll queue endpoint.
To register an Agent, you need to create a new Agent in Flow. This can be done through the Flow UI or by using the API.
When registering an Agent, you will need to provide the following information:
The following optional information can also be provided to help further filter the Workflows and Tasks that the Agent can handle. This allows you to create more specialized Agents that only handle specific types of Workflows and Tasks.
An agent then retrieves the Workflows and Tasks assigned to its queue and needs to execute them and use the API to move the Workflow and Tasks through the lifecycle.
You can read in more detail around all of the Status and Phase combinations in the Status and Phase documentation.
Workflows are retrieved that are either: READY status and PENDING phase, or COMPLETED phase.
The idea here is the agent can set up pre-requisites for the WorkflowRun or perform post-processing after the WorkflowRun has completed.
Tasks are retrieved that are either: READY status and PENDING phase, or COMPLETED phase and CANCELLED or TIMEDOUT status.
The idea here is that when the Task is received in ready, the agent starts executing the Task and then updates the Task status to RUNNING. Once the Task is completed, the agent updates the Task status to SUCCEEDED or FAILED.