Skip to content

Add AG2 multi-agent example with Mistral models#257

Open
faridun-ag2 wants to merge 2 commits intomistralai:mainfrom
faridun-ag2:add-ag2-multi-agent-example
Open

Add AG2 multi-agent example with Mistral models#257
faridun-ag2 wants to merge 2 commits intomistralai:mainfrom
faridun-ag2:add-ag2-multi-agent-example

Conversation

@faridun-ag2
Copy link
Copy Markdown

@faridun-ag2 faridun-ag2 commented Mar 30, 2026

Summary

  • Adds an AG2 (formerly AutoGen) integration example in third_party/AG2/
  • Demonstrates multi-agent orchestration with Mistral models via three progressive examples
  • Updates root README third-party tools table with AG2 entry

What's included

third_party/AG2/ag2_multi_agent_mistral.ipynb — Colab-compatible notebook with:

  1. Basic two-agent conversationAssistantAgent + UserProxyAgent with Mistral
  2. Function calling — AG2's dual registration pattern (register_for_llm + register_for_execution)
  3. Multi-agent GroupChat — automatic speaker selection with specialist agents

How it differs from MS_Autogen_pgsql

The existing third_party/MS_Autogen_pgsql/ example uses Microsoft AutoGen (the original project).
AG2 is the community-maintained fork with:

  • Active development (500K+ monthly PyPI downloads)
  • Native Mistral support via MistralLLMConfigEntry
  • GroupChat multi-agent orchestration
  • pip install ag2 (separate package from Microsoft's autogen-agentchat)

Test Plan

  • Notebook runs in Google Colab
  • pre-commit run detect-private-key --all-files passes
  • No hardcoded API keys
  • All Mistral API calls use os.getenv("MISTRAL_API_KEY")
  • Pinned package versions
  • Root README table updated
  • Existing examples untouched

Add AG2 integration notebook demonstrating multi-agent orchestration
with Mistral models: basic two-agent chat, function calling with dual
registration, and GroupChat with automatic speaker selection.
@faridun-ag2
Copy link
Copy Markdown
Author

Hey @jaccolor2

This PR adds an AG2 integration example to the cookbook. Here's a quick overview of what's included:

Notebook: third_party/AG2/ag2_multi_agent_mistral.ipynb

Three progressive examples demonstrating AG2 + Mistral:

  1. Basic two-agent conversation — Shows the fundamental AssistantAgent + UserProxyAgent pattern with Mistral via MistralLLMConfigEntry. Minimal setup, instant results.

  2. Function calling — Demonstrates AG2's dual registration pattern: register_for_llm() tells Mistral about the tool schema, register_for_execution() tells the agent how to run it. Uses simulated weather/time tools to keep it self-contained.

  3. Multi-agent GroupChat — AG2's flagship feature: multiple specialist agents (Researcher, Writer, Critic) collaborate in a group chat where Mistral automatically selects the next speaker. No manual routing needed.

Key details:

  • Colab-compatible with pinned dependencies (ag2[openai]==0.11.4, mistralai==2.1.3)
  • No hardcoded keys — all via os.getenv("MISTRAL_API_KEY")
  • Uses AG2's current API: MistralLLMConfigEntry for config, .run().process() for execution
  • Root README table updated with the AG2 entry
  • No existing files modified beyond the README table

AG2 (formerly AutoGen) is a separate project from the existing MS_Autogen_pgsql example — it's the community-maintained fork with native Mistral support and 500K+ monthly PyPI downloads.

Happy to adjust anything as needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant