Skip to content

feat(ag2): upgrade to v0.11.4 and rewrite all examples with 7 new additions#26

Open
martimfasantos wants to merge 1 commit intomainfrom
task/update-ag2
Open

feat(ag2): upgrade to v0.11.4 and rewrite all examples with 7 new additions#26
martimfasantos wants to merge 1 commit intomainfrom
task/update-ag2

Conversation

@martimfasantos
Copy link
Copy Markdown
Owner

Summary

  • Upgrade AG2 from 0.9.1.post0 to 0.11.4 — rewrite all 5 existing examples for the new API and add 7 new examples, bringing the total to 12 hands-on examples
  • All examples follow repo conventions (zero-padded filenames, dashed-border docstrings, section headers, settings-based config)
  • Includes verified OUTPUTS.md with captured output for all 12 examples

Examples

# File Feature
00 00_simple_agent.py Basic ConversableAgent, run() / process(), LLMConfig
01 01_agent_with_tools.py functions= parameter, tool registration, multi-tool agents
02 02_structured_outputs.py Pydantic response_format, schema-conforming JSON responses
03 03_human_in_the_loop.py Simulated human approval, register_reply(), conversation flow
04 04_multi_agent.py AutoPattern, initiate_group_chat(), multi-agent collaboration
05 05_sequential_chat.py initiate_chats() pipeline, carryover summaries, specialist agents
06 06_nested_chat.py register_nested_chats(), encapsulated workflows, inner delegation
07 07_code_execution.py LocalCommandLineCodeExecutor, code writer/executor agent pattern
08 08_guardrails.py Safeguard policies (Maris), regex filtering, inter-agent safeguards
09 09_mcp_tools.py create_toolkit(), stdio_client, FastMCP server integration
10 10_observability.py runtime_logging to SQLite, event capture, post-hoc analysis
11 11_a2a.py A2aAgentServer, A2aRemoteAgent, distributed agents over HTTP

Key API changes (0.9.x → 0.11.4)

  • LLMConfig now takes a positional dict: LLMConfig({"model": name}) instead of keyword args
  • New agent.run() / result.process() pattern replaces direct initiate_chat() for simple cases
  • functions= parameter on ConversableAgent for inline tool registration
  • Group chat uses AutoPattern + initiate_group_chat() (old GroupChat/GroupChatManager still supported)
  • Guardrails (Maris) via apply_safeguard_policy() with regex-based inter-agent safeguards
  • A2A protocol support with A2aAgentServer and A2aRemoteAgent
  • MCP integration requires async a_initiate_chat() to avoid blocking the stdio transport event loop

Configuration

  • All examples use OpenAI (gpt-4o-mini) via settings.py
  • Dependencies: ag2[openai,mcp,a2a]>=0.11.4, mcp>=1.9.2, pydantic-settings, uvicorn
  • Managed with uv package manager

Testing

All 12 examples ran successfully with exit code 0 and produced feature-showcasing output (see OUTPUTS.md for full details).

…itions

- Upgrade AG2 from 0.9.1.post0 to 0.11.4 with new API patterns (LLMConfig dict, run()/process())
- Rewrite 5 existing examples (simple agent, tools, structured outputs, human-in-the-loop, multi-agent)
- Add 7 new examples: sequential chat, nested chat, code execution, guardrails (Maris), MCP tools, observability, A2A protocol
- Clean pyproject.toml to ag2[openai,mcp,a2a] with direct deps only
- Add OUTPUTS.md with captured outputs from all 12 examples
- Update root README.md version to 0.11.4
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