The most commonly used agent type. It uses an LLM to generate responses and can call tools.
from autogen_agentchat.agents import AssistantAgentfrom autogen_ext.models.openai import OpenAIChatCompletionClientmodel_client = OpenAIChatCompletionClient(model="gpt-4o")agent = AssistantAgent( name="assistant", model_client=model_client, system_message="You are a helpful assistant.", description="A general-purpose assistant agent", tools=[], # List of tools handoffs=[], # List of agents this agent can hand off to model_client_stream=True, # Enable streaming reflect_on_tool_use=False, # Reflect on tool results before responding max_tool_iterations=10 # Max tool calling rounds)
An agent that encapsulates a team of agents, presenting them as a single agent to the outside.
from autogen_agentchat.agents import SocietyOfMindAgent, AssistantAgentfrom autogen_agentchat.teams import RoundRobinGroupChatfrom autogen_ext.models.openai import OpenAIChatCompletionClientmodel_client = OpenAIChatCompletionClient(model="gpt-4o")# Create inner teamresearcher = AssistantAgent("researcher", model_client=model_client)writer = AssistantAgent("writer", model_client=model_client)inner_team = RoundRobinGroupChat([researcher, writer])# Wrap team as single agentsom_agent = SocietyOfMindAgent( name="research_team", team=inner_team, description="A team that researches and writes reports")# Can now use som_agent as a regular agent in another team
An agent that filters messages based on configurable criteria.
from autogen_agentchat.agents import MessageFilterAgent, PerSourceFilter# Filter to only show messages from specific sourcesfilter_config = PerSourceFilter( allowed_senders=["agent1", "agent2"])agent = MessageFilterAgent( name="filter", filter_config=filter_config, description="Filters messages from specific agents")