Notebooks
Auto Generated Agent Chat: Group Chat with GPTAssistantAgent
Use Cases
- Use cases
- Notebooks
- All Notebooks
- AutoBuild
- Tools with Dependency Injection
- Chatting with a teachable agent
- Solving Complex Tasks with Nested Chats
- Agent Tracking with AgentOps
- Config loader utility functions
- Websockets: Streaming input and output using websockets
- A Uniform interface to call different LLMs
- RAG OpenAI Assistants in AG2
- From Dad Jokes To Sad Jokes: Function Calling with GPTAssistantAgent
- Agent Chat with custom model loading
- Agentic RAG workflow on tabular data from a PDF file
- Group Chat with Customized Speaker Selection Method
- RealtimeAgent in a Swarm Orchestration using WebRTC
- Auto Generated Agent Chat: Task Solving with Code Generation, Execution, Debugging & Human Feedback
- Web Scraping using Apify Tools
- Swarm Orchestration with AG2
- Currency Calculator: Task Solving with Provided Tools as Functions
- Agent with memory using Mem0
- RealtimeAgent in a Swarm Orchestration
- Solving Complex Tasks with A Sequence of Nested Chats
- Auto Generated Agent Chat: Teaching AI New Skills via Natural Language Interaction
- (Legacy) Implement Swarm-style orchestration with GroupChat
- Perform Research with Multi-Agent Group Chat
- Usage tracking with AG2
- Auto Generated Agent Chat: Collaborative Task Solving with Coding and Planning Agent
- DeepSeek: Adding Browsing Capabilities to AG2
- Chat with OpenAI Assistant using function call in AG2: OSS Insights for Advanced GitHub Data Analysis
- RealtimeAgent with gemini client
- Solving Multiple Tasks in a Sequence of Async Chats
- Agent with memory using Mem0
- OpenAI Assistants in AG2
- Demonstrating the `AgentEval` framework using the task of solving math problems as an example
- Adding Browsing Capabilities to AG2
- Group Chat with Retrieval Augmented Generation
- Cross-Framework LLM Tool Integration with AG2
- Auto Generated Agent Chat: GPTAssistant with Code Interpreter
- Auto Generated Agent Chat: Task Solving with Langchain Provided Tools as Functions
- Using Neo4j's graph database with AG2 agents for Question & Answering
- Run a standalone AssistantAgent
- StateFlow: Build Workflows through State-Oriented Actions
- Using RetrieveChat for Retrieve Augmented Code Generation and Question Answering
- ReasoningAgent - Advanced LLM Reasoning with Multiple Search Strategies
- Generate Dalle Images With Conversable Agents
- DeepResearchAgent
- Enhanced Swarm Orchestration with AG2
- Structured output from json configuration
- Agent Observability with OpenLIT
- Auto Generated Agent Chat: Solving Tasks Requiring Web Info
- Task Solving with Code Generation, Execution and Debugging
- RealtimeAgent with WebRTC connection
- Solving Multiple Tasks in a Sequence of Chats
- Using RetrieveChat with Qdrant for Retrieve Augmented Code Generation and Question Answering
- Writing a software application using function calls
- Runtime Logging with AG2
- Using RetrieveChat Powered by MongoDB Atlas for Retrieve Augmented Code Generation and Question Answering
- WebSurferAgent
- Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering
- Auto Generated Agent Chat: Task Solving with Provided Tools as Functions
- Preprocessing Chat History with `TransformMessages`
- CaptainAgent
- FSM - User can input speaker transition constraints
- OptiGuide with Nested Chats in AG2
- Group Chat with Coder and Visualization Critic
- Mitigating Prompt hacking with JSON Mode in Autogen
- Translating Video audio using Whisper and GPT-3.5-turbo
- Auto Generated Agent Chat: Group Chat with GPTAssistantAgent
- Interactive LLM Agent Dealing with Data Stream
- Engaging with Multimodal Models: GPT-4V in AG2
- Using Guidance with AG2
- SQL Agent for Spider text-to-SQL benchmark
- Conversational Chess using non-OpenAI clients
- Group Chat
- Auto Generated Agent Chat: Function Inception
- Making OpenAI Assistants Teachable
- Use AG2 in Databricks with DBRX
- Agent Chat with Async Human Inputs
- Using RetrieveChat Powered by PGVector for Retrieve Augmented Code Generation and Question Answering
- Groupchat with Llamaindex agents
- Discord, Slack, and Telegram messaging tools
- Chat Context Dependency Injection
- Structured output
- Trip planning with a FalkorDB GraphRAG agent using a Swarm
- RealtimeAgent in a Swarm Orchestration
- Small, Local Model (IBM Granite) Multi-Agent RAG
- Assistants with Azure Cognitive Search and Azure Identity
- Supercharging Web Crawling with Crawl4AI
- RealtimeAgent with local websocket connection
- Using a local Telemetry server to monitor a GraphRAG agent
- AgentOptimizer: An Agentic Way to Train Your LLM Agent
- Using RetrieveChat Powered by Couchbase Capella for Retrieve Augmented Code Generation and Question Answering
- Using Neo4j's native GraphRAG SDK with AG2 agents for Question & Answering
- Automatically Build Multi-agent System from Agent Library
- Nested Chats for Tool Use in Conversational Chess
- Task Solving with Provided Tools as Functions (Asynchronous Function Calls)
- SocietyOfMindAgent
- Language Agent Tree Search
- Agent Chat with Multimodal Models: LLaVA
- Agent Chat with Multimodal Models: DALLE and GPT-4V
- Auto Generated Agent Chat: Collaborative Task Solving with Multiple Agents and Human Users
- RealtimeAgent in a Swarm Orchestration
- Cross-Framework LLM Tool for CaptainAgent
- Solving Multiple Tasks in a Sequence of Chats with Different Conversable Agent Pairs
- RAG with DocAgent
- Auto Generated Agent Chat: Using MathChat to Solve Math Problems
- Community Gallery
Notebooks
Auto Generated Agent Chat: Group Chat with GPTAssistantAgent
Use GPTAssistantAgent in group chat.
AG2 offers conversable agents powered by LLM, tool or human, which can be used to perform tasks collectively via automated chat. This framework allows tool use and human participation through multi-agent conversation. Please find documentation about this feature here.
In this notebook, we demonstrate how to get multiple GPTAssistantAgent
converse through group chat.
Requirements
AG2 requires Python>=3.9
. To run this notebook example, please
install:
Set your API Endpoint
The
config_list_from_json
function loads a list of configurations from an environment variable or
a json file.
import autogen
from autogen.agentchat import AssistantAgent
from autogen.agentchat.contrib.gpt_assistant_agent import GPTAssistantAgent
config_list_gpt4 = autogen.config_list_from_json(
"OAI_CONFIG_LIST",
filter_dict={
"model": ["gpt-4", "gpt-4-1106-preview", "gpt-4-32k"],
},
)
Learn more about configuring LLMs for agents here.
Define GPTAssistantAgent and GroupChat
# Define user proxy agent
llm_config = {"config_list": config_list_gpt4, "cache_seed": 45}
user_proxy = autogen.UserProxyAgent(
name="User_proxy",
system_message="A human admin.",
code_execution_config={
"last_n_messages": 2,
"work_dir": "groupchat",
"use_docker": False,
}, # Please set use_docker=True if docker is available to run the generated code. Using docker is safer than running the generated code directly.
human_input_mode="TERMINATE",
)
# define two GPTAssistants
coder = GPTAssistantAgent(
name="Coder",
llm_config={
"config_list": config_list_gpt4,
},
instructions=AssistantAgent.DEFAULT_SYSTEM_MESSAGE,
)
analyst = GPTAssistantAgent(
name="Data_analyst",
instructions="You are a data analyst that offers insight into data.",
llm_config={
"config_list": config_list_gpt4,
},
)
# define group chat
groupchat = autogen.GroupChat(agents=[user_proxy, coder, analyst], messages=[], max_round=10)
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)
Initiate Group Chat
Now all is set, we can initiate group chat.
user_proxy.initiate_chat(
manager,
message="Get the number of issues and pull requests for the repository 'ag2ai/ag2' over the past three weeks and offer analysis to the data. You should print the data in csv format grouped by weeks.",
)
# type exit to terminate the chat