This page contains a collection of notebooks that demonstrate how to use AG2. The notebooks are tagged with the topics they cover. For example, a notebook that demonstrates how to use function calling will be tagged with tool/function.
Complete DevOps Pipeline Orchestration with Apply Patch & Shell Tools
Complete DevOps Pipeline Orchestration with Apply Patch & Shell Tools
DevOps with OpenAI Apply Patch & Shell Tools
devopstoolsbuilt-in-toolopenairesponses
Solving Multiple Tasks in a Sequence of Chats with Different Conversable Agent Pairs
Solving Multiple Tasks in a Sequence of Chats with Different Conversable Agent Pairs
Use AG2 to solve a set of tasks with a sequence of chats.
orchestrationsequential chats
Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering
Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering
Using FalkorGraphRagCapability with agents for GraphRAG Question & Answering
RAGFalkorDB
Image Input/Output with OpenAI V2 Client and AG2 Agents
Image Input/Output with OpenAI V2 Client and AG2 Agents
OpenAI V2 Client
openaiclients
Using ReliableTool to Generate Sub-Questions (Synchronous Version)
Using ReliableTool to Generate Sub-Questions (Synchronous Version)
ReliableTool - Basic Example
tool callingtoolsreliable
Trip planning with a FalkorDB GraphRAG agent using GroupChat
Trip planning with a FalkorDB GraphRAG agent using GroupChat
FalkorDB GraphRAG utilises a knowledge graph and can be added as a capability to agents. Together with a swarm orchestration of agents is highly effective at providing a RAG capability.
RAGtool/functionswarm
Websockets: Streaming input and output using websockets
Websockets: Streaming input and output using websockets
Websockets facilitate real-time, bidirectional communication between web clients and servers, enhancing the responsiveness and interactivity of AG2-powered applications.
websocketsstreaming
Agent Tracking with AgentOps
Agent Tracking with AgentOps
Use AgentOps to simplify the development process and monitor your agents in production.
integrationmonitoringdebugging
Amazon Bedrock V2 Client with AG2
Amazon Bedrock V2 Client with AG2
Amazon Bedrock V2 Client with AG2 - Rich UnifiedResponse and Structured Outputs
Use conversational agents to solve a set of tasks with a sequence of chats.
orchestrationsequential chats
Shell Tool with OpenAI Responses API
Shell Tool with OpenAI Responses API
Use the shell tool with OpenAI's Responses API for filesystem diagnostics, extending capabilities with UNIX utilities, and running multi-step build and test flows.
responsesshellfilesystemautomationcliopenai
Auto Generated Agent Chat: Collaborative Task Solving with Coding and Planning Agent
Auto Generated Agent Chat: Collaborative Task Solving with Coding and Planning Agent
Use planning agent in a function call.
planningorchestrationnested chattool/function
Small, Local Model (IBM Granite) Multi-Agent RAG
Small, Local Model (IBM Granite) Multi-Agent RAG
Optimizing Small, Local LLMs in Multi-Agent RAG Workflows using IBM Granite, Document Retrieval, Web Search, and Ollama
Small LLMsRAGWeb SearchIBM GraniteOllamaPlanningReflection
Using Guidance with AG2
Using Guidance with AG2
Constrained responses via guidance.
guidanceintegrationJSON
Agent Tools and Run Method Examples
Agent Tools and Run Method Examples
Agent Quickstart Examples
agentstoolsquickstartexamplesautogen
Solving Multiple Tasks in a Sequence of Async Chats
Solving Multiple Tasks in a Sequence of Async Chats
Use conversational agents to solve a set of tasks with a sequence of async chats.
orchestrationasyncsequential chats
Managing Multiple MCP Servers with MCPClientSessionManager
Managing Multiple MCP Servers with MCPClientSessionManager
Learn how to use MCPClientSessionManager to dynamically manage multiple MCP server sessions (stdio and SSE) within tool functions for flexible, resource-efficient agent workflows.
This notebook demonstrates a fully autonomous, multi-currency conversion system.
tool callingtoolscurrencygoogle search
WebSurferAgent with Firecrawl Integration
WebSurferAgent with Firecrawl Integration
This notebook demonstrates how to use the WebSurferAgent with the Firecrawl tool for web scraping and crawling.
firecrawltoolscraping
Group Chat with Retrieval Augmented Generation
Group Chat with Retrieval Augmented Generation
Implement and manage a multi-agent chat system using AG2, where AI assistants retrieve information, generate code, and interact collaboratively to solve complex tasks, especially in areas not covered by their training data.
group chatorchestrationRAG
Run a standalone AssistantAgent
Run a standalone AssistantAgent
Run a standalone AssistantAgent, browsing the web using the BrowserUseTool
FSM - User can input speaker transition constraints
FSM - User can input speaker transition constraints
Explore the demonstration of the Finite State Machine implementation, which allows the user to input speaker transition constraints.
group chatfsmorchestration
Anthropic V2 Client with AG2 Agents
Anthropic V2 Client with AG2 Agents
Anthropic V2 Client.
anthropicModelClientV2client
Use ChromaDBQueryEngine to query Markdown files
Use ChromaDBQueryEngine to query Markdown files
ChromaDB Query Engine for document queries
agentsdocumentsRAGdocagentchromachromadb
Web Scraping using Apify Tools
Web Scraping using Apify Tools
Scrapping web pages and summarizing the content using agents with tools.
webapifyintegrationtool/function
Using RetrieveChat for Retrieve Augmented Code Generation and Question Answering
Using RetrieveChat for Retrieve Augmented Code Generation and Question Answering
Explore the use of AG2's RetrieveChat for tasks like code generation from docstrings, answering complex questions with human feedback, and exploiting features like Update Context, custom prompts, and few-shot learning.
RAG
Validating Agent Output With FunctionTarget: A Comprehensive Guide to Custom Validation in Multi-Agent Conversations
Validating Agent Output With FunctionTarget: A Comprehensive Guide to Custom Validation in Multi-Agent Conversations
Group Chat FunctionTarget Examples
group chatfunctiontargetgroupchat
Google Drive Tools
Google Drive Tools
Google Drive Tools
agentstoolsgoogle drive
Grok example with live search
Grok example with live search
Grok example with live search
grokopenai
OpenAI Responses API with function call
OpenAI Responses API with function call
This notebook demonstrates how to use tool calling with OpenAI's Responses API.
tool callingtoolsfunction callingresponses
Solving Complex Tasks with A Sequence of Nested Chats
Solving Complex Tasks with A Sequence of Nested Chats
Solve complex tasks with one or more sequence chats nested as inner monologue.
Auto Generated Agent Chat: Collaborative Task Solving with Multiple Agents and Human Users
Auto Generated Agent Chat: Collaborative Task Solving with Multiple Agents and Human Users
Involve multiple human users via function calls and nested chat.
humantool/function
Maris: Fine-Grained Policy-Guided Safeguards Demo
Maris: Fine-Grained Policy-Guided Safeguards Demo
Maris: Fine-Grained Policy-Guided Safeguards Demo
safeguardmarispolicy-guided
Anthropic Structured Outputs with AG2
Anthropic Structured Outputs with AG2
Anthropic's structured outputs feature provides two powerful modes: JSON Outputs (Get validated JSON responses matching a specific schema) and Strict Tool Use (Guaranteed schema validation for tool inputs).
structured outputanthropic
Wikipedia Agent
Wikipedia Agent
Search Wikipedia with WikipediaAgent
toolswikipediasearch
Tools with Dependency Injection
Tools with Dependency Injection
Tools Dependency Injection
toolsdependency injectionfunction calling
Cross-Framework LLM Tool Integration with AG2
Cross-Framework LLM Tool Integration with AG2
Cross-Framework LLM Tool Integration with AG2
toolslangchainpydanticai
Veronica Core: Circuit Breaker for AG2 Agents
Veronica Core: Circuit Breaker for AG2 Agents
Use veronica-core's CircuitBreakerCapability to add per-agent circuit breakers and system-wide SAFE_MODE to AG2 multi-agent workflows.
toolsveronicacircuit-breakerlocal-llmreliability
Group Chat with Tools
Group Chat with Tools
Group Chat with Tools
agentstoolsgroupchatusersguides
Structured Outputs with Amazon Bedrock in AG2
Structured Outputs with Amazon Bedrock in AG2
Use Amazon Bedrock with AG2 to build applications that return structured data.
Using AG2 with Grok to perform SBOM analysis and security vulnerability scanning on Git repositories
grokopenai
StateFlow: Build Workflows through State-Oriented Actions
StateFlow: Build Workflows through State-Oriented Actions
StateFlow: Build workflows through state-oriented actions.
orchestrationgroup chatstateflowresearch
Agent Chat with Async Human Inputs
Agent Chat with Async Human Inputs
Async human inputs.
asynchuman
Group Chat
Group Chat
Explore the utilization of large language models in automated group chat scenarios, where agents perform tasks collectively, demonstrating how they can be configured, interact with each other, and retrieve specific information from external resources.
orchestrationgroup chatcode generation
Using ReliableTool to Generate Sub-Questions (Synchronous Version)
Using ReliableTool to Generate Sub-Questions (Synchronous Version)
ReliableTool - Google Search Example
tool callingtoolsreliablesearchgoogle
Daytona Executor: Sandbox Code Execution for AG2 Agents
Daytona Executor: Sandbox Code Execution for AG2 Agents
Use AG2 to execute code in secure, isolated Daytona cloud sandboxes
code-executiondaytonasandboxmulti-language
Group Chat with Coder and Visualization Critic
Group Chat with Coder and Visualization Critic
Explore a group chat example using agents such as a coder and visualization agent.
group chatcode generation
Handling errors with the RunResponseProtocol
Handling errors with the RunResponseProtocol
This notebook demonstrates handling errors with the RunResponseProtocol
errorsrunresponseprotocol
Using RetrieveChat Powered by PGVector for Retrieve Augmented Code Generation and Question Answering
Using RetrieveChat Powered by PGVector for Retrieve Augmented Code Generation and Question Answering
Explore the use of AG2's RetrieveChat for tasks like code generation from docstrings, answering complex questions with human feedback, and exploiting features like Update Context, custom prompts, and few-shot learning.
LLM providers offer functionality for defining a structure of the messages generated by LLMs, AG2 enables this functionality by propagating a `response_format`, in the LLM configuration for your agents, to the underlying client.
structured output
RemyxCodeExecutor: Agentic Code Exploration and Execution
RemyxCodeExecutor: Agentic Code Exploration and Execution
AI-guided exploration and execution of research paper codebases using RemyxCodeExecutor
code executiondockerresearchremyx
Auto Generated Agent Chat: Teaching AI New Skills via Natural Language Interaction
Auto Generated Agent Chat: Teaching AI New Skills via Natural Language Interaction
Teach the agent news skills using natural language.
learningteaching
Solving Complex Tasks with Nested Chats
Solving Complex Tasks with Nested Chats
Solve complex tasks with a chat nested as inner monologue.
nested chatreflectionreasoningorchestration
Load the configuration including the response format
Load the configuration including the response format
Agent Quickstart Examples
agentstoolsquickstartexamplesautogen
Structured output from json configuration
Structured output from json configuration
OpenAI offers a functionality for defining a structure of the messages generated by LLMs, AutoGen enables this functionality by propagating response_format passed to your agents to the underlying client.
structured output
Using RetrieveChat Powered by Couchbase Capella for Retrieve Augmented Code Generation and Question Answering
Using RetrieveChat Powered by Couchbase Capella for Retrieve Augmented Code Generation and Question Answering
Explore the use of AG2's RetrieveChat for tasks like code generation from docstrings, answering complex questions with human feedback, and exploiting features like Update Context, custom prompts, and few-shot learning.
RAG
YepCode Executor: Serverless Code Execution for AG2 Agents
YepCode Executor: Serverless Code Execution for AG2 Agents
Use AG2 to execute code with YepCode
llmopenaiyepcode
Perplexity Search Tool
Perplexity Search Tool
Perplexity Search Integration with AG2
toolsperplexityweb-searchsearch
Exploring GPT-5: Comparing Verbosity Levels in AG2 AgentChat
Exploring GPT-5: Comparing Verbosity Levels in AG2 AgentChat
GPT5 verbosity example
gpt5verbosity
Cross-Framework LLM Tool for CaptainAgent
Cross-Framework LLM Tool for CaptainAgent
Cross-Framework LLM Tool for CaptainAgent
toolslangchain
Using ReliableTool to Generate Sub-Questions (Synchronous Version)
Using ReliableTool to Generate Sub-Questions (Synchronous Version)
ReliableTool - Group Chat Example
tool callingtoolsreliable
Language Agent Tree Search
Language Agent Tree Search
Language Agent Tree Search.
LATSsearchreasoningreflection
Task Solving with Provided Tools as Functions (Asynchronous Function Calls)
Task Solving with Provided Tools as Functions (Asynchronous Function Calls)
Learn how to implement both synchronous and asynchronous function calls using AssistantAgent and UserProxyAgent in AutoGen, with examples of their application in individual and group chat settings for task execution with language models.
tool/functionasync
Supercharging Web Crawling with Crawl4AI
Supercharging Web Crawling with Crawl4AI
Supercharging Web Crawling with Crawl4AI
toolsbrowser-usewebscrapingfunction calling
Task Solving with Code Generation, Execution and Debugging
Task Solving with Code Generation, Execution and Debugging
Use conversable language learning model agents to solve tasks and provide automatic feedback through a comprehensive example of writing, executing, and debugging Python code to compare stock price changes.
code generation
OptiGuide with Nested Chats in AG2
OptiGuide with Nested Chats in AG2
This is a nested chat re-implementation of OptiGuide which is an LLM-based supply chain optimization framework.