Skip to content

Add AG2 framework integration guide#887

Open
faridun-ag2 wants to merge 1 commit intoArcadeAI:mainfrom
faridun-ag2:add-ag2-framework-guide
Open

Add AG2 framework integration guide#887
faridun-ag2 wants to merge 1 commit intoArcadeAI:mainfrom
faridun-ag2:add-ag2-framework-guide

Conversation

@faridun-ag2
Copy link
Copy Markdown

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

Summary

  • Adds documentation for using Arcade tools with AG2 (formerly AutoGen), an open-source multi-agent framework
  • Includes quick start example with AssistantAgent + ConversableAgent pattern and register_for_llm/register_for_execution tool registration
  • Adds AG2 to the agent frameworks overview page, landing page, and navigation

Changes

  • app/en/get-started/agent-frameworks/ag2/ — new guide with _meta.tsx and use-arcade-tools/page.mdx
  • app/_components/agent-framework-tabs.tsx — AG2 card in Python tab
  • app/en/get-started/agent-frameworks/_meta.tsx — AG2 nav entry
  • app/en/home/landing-page.tsx — AG2 in frameworks list and "Power Your Agent" card
  • public/images/icons/ag2.svg — AG2 logo icon

Test plan

  • Verify AG2 guide page renders at /en/get-started/agent-frameworks/ag2/use-arcade-tools
  • Verify AG2 card appears in Python tab on agent frameworks overview
  • Verify AG2 appears in "Power Your Agent" card on landing page
  • Verify AG2 dropdown in sidebar navigation
  • Verify icon displays correctly in both light and dark themes
  • Verify all external links resolve (ag2.ai, docs.ag2.ai, build-with-ag2)

Adds documentation for using Arcade tools with AG2 (formerly AutoGen),
an open-source multi-agent framework. Includes quick start example with
AssistantAgent + ConversableAgent pattern and register_for_llm/register_for_execution
tool registration.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

@faridun-ag2 is attempting to deploy a commit to the Arcade AI Team on Vercel.

A member of the Team first needs to authorize it.

@faridun-ag2
Copy link
Copy Markdown
Author

Hey @torresmateo 👋

We're from the AG2 team — AG2 (formerly AutoGen) is an open-source framework for building multi-agent AI systems.

We've been working on an integration with Arcade and put together this guide showing how to use Arcade tools with AG2 agents. The guide covers:

  • Setting up AssistantAgent + ConversableAgent with Arcade tool calling
  • JIT authorization flow via the arcadepy client
  • register_for_llm / register_for_execution pattern for tool registration
  • A working Gmail assistant example

We also have more examples in our build-with-ag2 repo.

Would love your feedback on the guide — happy to adjust anything to match your docs standards!

Comment on lines +160 to +222
AG2 registers tools as typed Python functions. Define a wrapper for each Arcade tool you want the agent to use. Each function calls the `call_arcade_tool` helper with the appropriate tool name and inputs.

```python filename="main.py"
def list_emails(max_results: int = 10, is_unread: bool = False) -> dict:
"""List emails from Gmail inbox.
- max_results: maximum number of emails to return (default 10)
- is_unread: if True, return only unread emails
"""
return call_arcade_tool(
"Gmail.ListEmails",
{"max_results": max_results, "is_unread": is_unread},
)


def send_email(to: str, subject: str, body: str) -> dict:
"""Send a new email.
- to: recipient email address
- subject: email subject line
- body: plain-text email body
"""
return call_arcade_tool(
"Gmail.SendEmail",
{"recipient": to, "subject": subject, "body": body},
)


def reply_to_email(email_id: str, body: str) -> dict:
"""Reply to an email by message ID.
- email_id: ID of the message to reply to
- body: plain-text reply body
"""
return call_arcade_tool(
"Gmail.ReplyToEmail",
{"reply_to_message_id": email_id, "body": body, "reply_to_whom": "ONLY_THE_SENDER"},
)
```

### Create the agents and register the tools

Create the `AssistantAgent` and `ConversableAgent`, then register each tool function using the `register_for_llm` and `register_for_execution` pattern. This tells the assistant which tools it can call and the user proxy how to execute them.

```python filename="main.py"
assistant = AssistantAgent(
name="GmailAssistant",
llm_config=llm_config,
system_message="You are a helpful Gmail assistant. Use the provided tools to help the user manage their email.",
)

user_proxy = ConversableAgent(
name="User",
human_input_mode="ALWAYS",
is_termination_msg=lambda msg: "TERMINATE" in (msg.get("content") or ""),
)

# Register tools: each function is registered for both LLM (caller) and execution (executor)
for func, description in [
(list_emails, "List emails from Gmail inbox. Filter by unread status and max results."),
(send_email, "Send a new email to a recipient with subject and body."),
(reply_to_email, "Reply to an email by message ID with a body."),
]:
user_proxy.register_for_execution()(func)
assistant.register_for_llm(description=description)(func)
```
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see how this may work, but I don't want to encourage "masking" of Arcade's own tool definitions in a "get started" tutorial. I like the overall pattern though, and I think it's very easy to turn this into a dynamic function builder. I think a better pattern is:

  • defining which tools will be retrieved from Arcade
  • get the tool definitions
  • use the tool definitions to generate compatible callables for the framework

example: https://docs.arcade.dev/en/get-started/agent-frameworks/langchain/use-arcade-with-langchain-py#write-a-helper-function-to-convert-arcade-tools-to-langchain-tools

In this case, it seems that we need simple python functions, so the structure of the "generator" could be to programmatically assemble the callable based on the tool definition.

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