Skip to content

Add AG2 (formerly AutoGen) multi-agent examples#15

Open
VasiliyRad wants to merge 4 commits intofetchai:mainfrom
VasiliyRad:vasiliyr/03112026
Open

Add AG2 (formerly AutoGen) multi-agent examples#15
VasiliyRad wants to merge 4 commits intofetchai:mainfrom
VasiliyRad:vasiliyr/03112026

Conversation

@VasiliyRad
Copy link

@VasiliyRad VasiliyRad commented Mar 12, 2026

Adds two standalone AG2 v0.11+ examples to ag2-agents/:

  1. research-synthesis-team/ — GroupChat with 4 specialists wrapped as an A2A executor (Pattern B), exposed to Agentverse. Replaces the outdated pyautogen<0.3 approach.
  2. payment-approval/ — Two-agent workflow (researcher + executor) with human_input_mode="ALWAYS" as an explicit approval gate before Skyfire payment. First example in the repo with human-in-the-loop before a financial action.

Why: The existing autogen-agents/ example uses pyautogen<0.3 — a frozen package from 2023 that is incompatible with the current uAgents/A2A SDK and no longer receives updates. AG2 (formerly AutoGen) is its community-maintained successor and the correct integration target for new work. The research-synthesis-team example follows the same A2A Pattern B already established by LangGraph and ADK examples in this repo, so the wiring is familiar to maintainers. The payment-approval example demonstrates human-in-the-loop before financial execution — the human_input_mode="ALWAYS" pattern is native to AG2 and directly relevant to the payment-protocol examples already present.

Files added: ag2-agents/ (2 subdirectories, ~12 files)
Note: The legacy autogen-agents/ directory is not removed (different pyautogen<0.3 dependency, not compatible with ag2>=0.11.0 in the same venv).

… examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@VasiliyRad
Copy link
Author

@rajashekarcs2023 and @gautammanak1, could you please review this PR? It adds AG2 (formerly AutoGen) multi-agent examples — AG2 is the community-maintained successor to Microsoft's pyautogen.

@gautammanak1
Copy link
Collaborator

Issues Found

Hey @VasiliyRad Thank you for the PR! I've reviewed the PR and found several compatibility issues with the current AG2 API. Please fix these errors before merging:


1. ❌ LLMConfig Import Error

Error:

from autogen import ConversableAgent, LLMConfig
# ImportError: cannot import name 'LLMConfig' from 'autogen'

Issue:
In AG2 0.11+, LLMConfig has been deprecated. The llm_config parameter now accepts a dictionary directly.

Files to Fix:

  • ag2-agents/payment-approval/main.py
  • ag2-agents/research-synthesis-team/main.py
  • ag2-agents/research-synthesis-team/agents.py
  • ag2-agents/research-synthesis-team/workflow.py
  • ag2-agents/research-synthesis-team/agent_executor.py
  • ag2-agents/research-synthesis-team/tests/test_agents.py
  • ag2-agents/research-synthesis-team/tests/test_agent_executor.py

Fix Required:
Replace LLMConfig usage with dictionary-based configuration:

# Remove: from autogen import LLMConfig
# Change: llm_config = LLMConfig({...}, temperature=0.2)
# To: llm_config = {"model": "...", "api_key": "...", "temperature": 0.2}

Also update type hints: llm_config: LLMConfigllm_config: dict


2. ❌ SingleA2AAdapter Parameter Error

Error:

adapter = SingleA2AAdapter(
    ...
    agentverse_url=os.getenv("AGENTVERSE_URL", "https://agentverse.ai"),
    mailbox_api_key=os.getenv("AGENTVERSE_API_KEY", ""),
)
# TypeError: SingleA2AAdapter.__init__() got an unexpected keyword argument 'agentverse_url'

Issue:
SingleA2AAdapter doesn't support agentverse_url or mailbox_api_key parameters.

File to Fix:

  • ag2-agents/research-synthesis-team/main.py

Fix Required:
Remove agentverse_url and mailbox_api_key, and use:

  • mailbox=True to enable mailbox
  • a2a_port for A2A communication port
  • seed for agent identity

3. ❌ DuckDuckGoSearchTool Parameter Error

Error:

search = DuckDuckGoSearchTool(num_results=5)
# TypeError: DuckDuckGoSearchTool.__init__() got an unexpected keyword argument 'num_results'

Issue:
DuckDuckGoSearchTool doesn't accept any initialization parameters in the current AG2 version.

File to Fix:

  • ag2-agents/research-synthesis-team/workflow.py

Fix Required:
Change DuckDuckGoSearchTool(num_results=5) to DuckDuckGoSearchTool()


Additional Suggestions

Payment Approval Agent Enhancement

The Payment Approval agent is currently a standalone AG2 example. You can enhance it by integrating with Fetch.ai's payment protocol to make it a proper uAgent that can be:

  • Discovered on Agentverse
  • Used with ASI:One LLM
  • Connected with other agents in the ecosystem

For reference on how to integrate payment protocol and build uAgents, check the Fetch.ai Innovation Lab documentation.

Action Required

Please fix all the above errors and update the code accordingly. Once fixed, I'll review again and merge.

Thank You
cc: @rajashekarcs2023

@VasiliyRad
Copy link
Author

Comment 1 — LLMConfig:

LLMConfig is not deprecated — it's the recommended pattern in AG2 0.11+. What was removed in 0.11.0 were legacy helpers (config_list= kwarg, context manager, class properties), not the class itself. Our positional-dict usage is correct per current docs. Added a test to cover this.

Comment 2 — SingleA2AAdapter:

Fixed — replaced agentverse_url/mailbox_api_key with a2a_port/mailbox/seed. Added test that constructs the adapter with these params.

Comment 3 — DuckDuckGoSearchTool:

Fixed — removed num_results=5 from constructor. Added test.

Comment 4 — Payment Protocol Enhancement:

Done — refactored payment-approval to use SingleA2AAdapter with payment protocol support. Same architecture as research-synthesis-team. Also added Python 3.13 requirement (uagents/Pydantic v1 incompatible with 3.14+).

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.

2 participants