A curated collection of Jupyter notebooks exploring design patterns for autonomous AI agents using frameworks like Microsoft AutoGen, LangGraph, Taskweaver, CrewAI, and more.
This repository demonstrates how to build, orchestrate, and compose intelligent agents capable of planning, reasoning, code execution, retrieval-augmented generation (RAG), and multi-agent collaboration. Each notebook is self-contained and focused on a specific pattern or use case.
File: agentchat_groupchat_research.ipynb
A multi-agent group chat where specialized agents — Admin, Engineer, Scientist, Planner, Executor, and Critic — collaborate to perform research tasks. Demonstrates the impact of a Critic agent on output quality by comparing results with and without it.
- Task: Find recent LLM papers on arXiv and organize them into a markdown table by domain
- Framework: AutoGen
- Key agents:
UserProxyAgent,AssistantAgent,GroupChatManager
File: Autogen_Data_Analysis_Graphs.ipynb
A group chat between a Coder agent and a Visualization Critic agent. The critic reviews generated plots and suggests improvements, which the coder implements — producing higher-quality visualizations iteratively.
- Tasks: Plot weight vs. horsepower from car data; visualize Seattle weather frequency
- Framework: AutoGen
- Libraries:
matplotlib,seaborn,pandas - Key agents:
UserProxyAgent, CoderAssistantAgent, CriticAssistantAgent
File: Autogen_groupchat_RAG.ipynb
Demonstrates how RetrieveUserProxyAgent overcomes the knowledge limitations of standard LLMs by grounding responses in provided documentation. Compares standard chat (incorrect output) vs. RAG-enabled chat (correct output) for tasks involving post-training API knowledge.
- Framework: AutoGen + ChromaDB
- Use case: Generate valid Spark API code using FLAML documentation
- Key agents:
RetrieveUserProxyAgent, Boss, Boss_Assistant
File: Autogen_planning_with_Agents.ipynb
Shows how an Assistant agent can consult a dedicated Planner agent before executing tasks. The Planner breaks down complex tasks into actionable steps without writing code itself, while the Assistant handles execution.
- Task: Suggest a fix for an open "good first issue" on the FLAML GitHub repo
- Framework: AutoGen
- Pattern:
ask_plannerfunction call between agents - Planner component:
File: Local_RAG_Agent_LLAMA_3.ipynb
An advanced, fully local RAG agent built with LangGraph that combines three research-backed RAG strategies:
| Strategy | Paper | Description |
|---|---|---|
| Adaptive RAG | arXiv 2403.14403 | Routes questions to vectorstore or web search |
| Corrective RAG | arXiv 2401.15884 | Falls back to web search when docs are irrelevant |
| Self-RAG | arXiv 2310.11511 | Self-corrects hallucinations and incomplete answers |
- Framework: LangGraph + LangChain
- LLM: LLaMA 3 (via Ollama — runs fully locally)
- Embeddings: GPT4All
- Vector store: Chroma
- Web search: Tavily
- Pipeline stages: Index → Retrieve → Grade → Generate → Hallucination check → Answer grading
| Pattern | Description |
|---|---|
| Multi-Agent Group Chat | Multiple specialized agents collaborate in a shared conversation |
| Plan & Execute | A Planner decomposes tasks; an Executor implements them |
| RAG with Agents | Agents retrieve and ground responses in external documents |
| Critic/Reflection | A Critic agent reviews outputs and triggers self-improvement |
| Adaptive Routing | An agent routes queries to the best retrieval strategy |
| Self-Correction | Agents detect and fix hallucinations in their own outputs |
- Python 3.9+
- OpenAI API key (for AutoGen notebooks) or Ollama with LLaMA 3 (for local RAG notebook)
pip install pyautogen
pip install pyautogen[retrievechat] # for RAG notebookConfigure your API key in OAI_CONFIG_LIST:
[
{
"model": "gpt-4",
"api_key": "<your OpenAI API key>"
}
]pip install langchain-nomic langchain_community tiktoken langchainhub \
chromadb langchain langgraph tavily-pythonInstall and run Ollama with LLaMA 3:
ollama pull llama3- AutoGen Documentation
- LangGraph Documentation
- Taskweaver by Microsoft
- Adaptive RAG Paper
- Corrective RAG Paper
- Self-RAG Paper
⭐ If you find this repository helpful, please consider giving it a star!
