Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: migrate AutoGen provider examples to ag2's LLMConfig API (#3833)

Aditya Painuli1ea8ad9b3ff0
diff --git a/docs/content/docs/providers/autogen.mdx b/docs/content/docs/providers/autogen.mdx
index b7fa7a1ac..90e42517b 100644
--- a/docs/content/docs/providers/autogen.mdx
+++ b/docs/content/docs/providers/autogen.mdx
@@ -1,16 +1,18 @@
---
title: AutoGen
description: Build an agent with AutoGen and enable it to use 1000+ tools with Composio.
-keywords: [autogen, microsoft autogen]
+keywords: [autogen, microsoft autogen, ag2]
---
The AutoGen provider turns Composio tools into AutoGen [`FunctionTool`](https://microsoft.github.io/autogen/) objects and registers them with your agents. You connect an account, fetch the tools, register them with a caller and executor agent, and AutoGen handles the conversation and tool calls.
+The provider runs on the [`ag2`](https://github.com/ag2ai/ag2) distribution, the community-maintained continuation of AutoGen 0.2, so it works for AG2 projects out of the box.
+
<Steps>
<Step>
**Install**
-<PackageInstall ecosystem="python" packages="composio composio_autogen autogen-agentchat" />
+<PackageInstall ecosystem="python" packages="composio composio_autogen 'ag2[openai]'" />
</Step>
<Step>
@@ -30,7 +32,9 @@ OPENAI_API_KEY=xxxxxxxxx
**Create session and run**
```python
-from autogen import AssistantAgent, UserProxyAgent
+import os
+
+from autogen import AssistantAgent, LLMConfig, UserProxyAgent
from composio import Composio
from composio_autogen import AutogenProvider
@@ -43,7 +47,11 @@ tools = session.tools()
chatbot = AssistantAgent(
"chatbot",
system_message="Reply TERMINATE when the task is done or when user's content is empty",
- llm_config={"config_list": [{"model": "gpt-5.2"}]},
+ llm_config=LLMConfig({
+ "api_type": "openai",
+ "model": "gpt-5.2",
+ "api_key": os.environ["OPENAI_API_KEY"],
+ }),
)
user_proxy = UserProxyAgent(
diff --git a/python/providers/autogen/README.md b/python/providers/autogen/README.md
index 50ea562aa..1720c443d 100644
--- a/python/providers/autogen/README.md
+++ b/python/providers/autogen/README.md
@@ -5,7 +5,7 @@ Adapts Composio tools to AutoGen `FunctionTool` objects and registers them with
## Installation
```bash
-pip install composio composio-autogen autogen-agentchat
+pip install composio composio-autogen 'ag2[openai]'
```
Set `COMPOSIO_API_KEY` (from the [dashboard](https://dashboard.composio.dev/settings)) and `OPENAI_API_KEY` in your environment.
@@ -13,7 +13,9 @@ Set `COMPOSIO_API_KEY` (from the [dashboard](https://dashboard.composio.dev/sett
## Quickstart
```python
-from autogen import AssistantAgent, UserProxyAgent
+import os
+
+from autogen import AssistantAgent, LLMConfig, UserProxyAgent
from composio import Composio
from composio_autogen import AutogenProvider
@@ -26,7 +28,11 @@ tools = session.tools()
chatbot = AssistantAgent(
"chatbot",
system_message="Reply TERMINATE when the task is done or when user's content is empty",
- llm_config={"config_list": [{"model": "gpt-5.2"}]},
+ llm_config=LLMConfig({
+ "api_type": "openai",
+ "model": "gpt-5.2",
+ "api_key": os.environ["OPENAI_API_KEY"],
+ }),
)
user_proxy = UserProxyAgent(
diff --git a/python/providers/autogen/autogen_demo.py b/python/providers/autogen/autogen_demo.py
index 867f58fcf..c7be07e55 100644
--- a/python/providers/autogen/autogen_demo.py
+++ b/python/providers/autogen/autogen_demo.py
@@ -1,7 +1,7 @@
import os
import dotenv
-from autogen import AssistantAgent, UserProxyAgent
+from autogen import AssistantAgent, LLMConfig, UserProxyAgent
from composio_autogen import AutogenProvider
from composio import Composio
@@ -20,11 +20,13 @@ def main():
chatbot = AssistantAgent(
"chatbot",
system_message="Reply TERMINATE when the task is done or when user's content is empty",
- llm_config={
- "config_list": [
- {"model": "gpt-5", "api_key": os.environ["OPENAI_API_KEY"]},
- ]
- },
+ llm_config=LLMConfig(
+ {
+ "api_type": "openai",
+ "model": "gpt-5",
+ "api_key": os.environ["OPENAI_API_KEY"],
+ }
+ ),
)
# Create a user proxy agent