Agent Swarms (🦠)
An agent swarm is a team of agents that work together to complete a task
.
Core Principle
Agent swarms are defined by their collective ability to successfully complete tasks, rather than by the mere grouping of agents. Swarms enable the creation of specialized workflows that can be deployed to handle complex tasks.
🦾 Agent
An agent is an AI entity equipped with a set of tools and instructions. It represents the who
of a task.
🗒️ Task
A task is a single, well defined unit of work. Typically completed by an agent or a team of agents collaborating with humans. A task represents the what
and how
of AI driven workflows.
🧩 Flows
Flows orchestrate the execution of tasks and interaction of agents allowing the creation of complex adaptive workflows.
Example of an agent swarm in action
This demonstrates a simple workflow that uses a team of agents to complete a task.
Research Workflow
import controlflow as cf
from .tools import (
web_search,
dex_screener_token_pairs,
twitter_search,
wallet_connect_place_order,
datastore_write
)
research_agent = cf.Agent(
name="Research Agent",
instructions="""
Fetch any relevant information on the specified coin and provide a report and recommendation,
""",
tools=[web_search, dex_screener_token_pairs, twitter_search],
)
evaluator_agent = cf.Agent(
name="Evaluator Agent",
instructions="""
You are a trading agent that makes decisions on whether to place trades.
Based on the the research recommendation and internal trading strategy, buy or sell the xx coin
""",
tools=[trading_signals_evaluator],
)
trading_agent = cf.Agent(
name="Trading Agent",
instructions="""
You are a trading agent that handles trading requests and updates the datastore.
If a trade is not required, you should still update the datastore.
""",
tools=[wallet_connect_place_order, datastore_write],
)