The intelligent workers in your AI workflows.
Agent
class.
LLMRules
object to override these rules or provide rules for non-standard providers.
Here is an example of how to tell the agent to use the Anthropic compilation rules with a custom model that can’t be automatically inferred:
interactive=True
. By default, this will let the agent communicate with users on the command line.
To learn more, see the Interactivity guide.
agents
parameter when creating a task. Each task requires at least one assigned agent, and will use a default agent if none are provided. Agents can be assigned to multiple tasks, and tasks can have multiple agents.
controlflow.defaults.agent
).get_agents()
method. This will return a list of all the agents assigned to the task, including any inherited from its environment.
agents
parameter:
run
method to create and run a task in one step:
agents
parameter as a list.
Here, we create two agents and assign them to a task that has them debate each other.
completion_agents
.
completion_agents
will prevent other agents from marking the task as successful or failed. Make sure your completion agents are also assigned to the task!