|
11 | 11 |
|
12 | 12 | </div>
|
13 | 13 |
|
14 |
| -<div align="center" style="background-color: rgba(255, 235, 59, 0.5); padding: 10px; border-radius: 5px; margin: 20px 0;"> |
15 |
| - <strong>Important:</strong> This is the official project. We are not affiliated with any fork or startup. See our <a href="https://x.com/pyautogen/status/1857264760951296210">statement</a>. |
16 |
| -</div> |
17 |
| - |
18 | 14 | # AutoGen
|
19 | 15 |
|
20 | 16 | **AutoGen** is a framework for creating multi-agent AI applications that can act autonomously or work alongside humans.
|
@@ -55,43 +51,49 @@ async def main() -> None:
|
55 | 51 | asyncio.run(main())
|
56 | 52 | ```
|
57 | 53 |
|
58 |
| -### Web Browsing Agent Team |
59 |
| - |
60 |
| -Create a group chat team with a web surfer agent and a user proxy agent |
61 |
| -for web browsing tasks. You need to install [playwright](https://playwright.dev/python/docs/library). |
| 54 | +### MCP Server |
62 | 55 |
|
63 | 56 | ```python
|
64 |
| -# pip install -U autogen-agentchat autogen-ext[openai,web-surfer] |
65 |
| -# playwright install |
| 57 | +# First run `npm install -g @playwright/mcp@latest` to install the MCP server. |
66 | 58 | import asyncio
|
67 |
| -from autogen_agentchat.agents import UserProxyAgent |
68 |
| -from autogen_agentchat.conditions import TextMentionTermination |
| 59 | +from autogen_agentchat.agents import AssistantAgent |
69 | 60 | from autogen_agentchat.teams import RoundRobinGroupChat
|
| 61 | +from autogen_agentchat.conditions import TextMessageTermination |
70 | 62 | from autogen_agentchat.ui import Console
|
71 | 63 | from autogen_ext.models.openai import OpenAIChatCompletionClient
|
72 |
| -from autogen_ext.agents.web_surfer import MultimodalWebSurfer |
| 64 | +from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams |
| 65 | + |
73 | 66 |
|
74 | 67 | async def main() -> None:
|
75 |
| - model_client = OpenAIChatCompletionClient(model="gpt-4o") |
76 |
| - # The web surfer will open a Chromium browser window to perform web browsing tasks. |
77 |
| - web_surfer = MultimodalWebSurfer("web_surfer", model_client, headless=False, animate_actions=True) |
78 |
| - # The user proxy agent is used to get user input after each step of the web surfer. |
79 |
| - # NOTE: you can skip input by pressing Enter. |
80 |
| - user_proxy = UserProxyAgent("user_proxy") |
81 |
| - # The termination condition is set to end the conversation when the user types 'exit'. |
82 |
| - termination = TextMentionTermination("exit", sources=["user_proxy"]) |
83 |
| - # Web surfer and user proxy take turns in a round-robin fashion. |
84 |
| - team = RoundRobinGroupChat([web_surfer, user_proxy], termination_condition=termination) |
85 |
| - try: |
86 |
| - # Start the team and wait for it to terminate. |
87 |
| - await Console(team.run_stream(task="Find information about AutoGen and write a short summary.")) |
88 |
| - finally: |
89 |
| - await web_surfer.close() |
90 |
| - await model_client.close() |
| 68 | + model_client = OpenAIChatCompletionClient(model="gpt-4.1") |
| 69 | + server_params = StdioServerParams( |
| 70 | + command="npx", |
| 71 | + args=[ |
| 72 | + "@playwright/mcp@latest", |
| 73 | + "--headless", |
| 74 | + ], |
| 75 | + ) |
| 76 | + async with McpWorkbench(server_params) as mcp: |
| 77 | + agent = AssistantAgent( |
| 78 | + "web_browsing_assistant", |
| 79 | + model_client=model_client, |
| 80 | + workbench=mcp, # For multiple MCP servers, put them in a list. |
| 81 | + model_client_stream=True, |
| 82 | + max_tool_iterations=10, |
| 83 | + ) |
| 84 | + team = RoundRobinGroupChat( |
| 85 | + [agent], |
| 86 | + termination_condition=TextMessageTermination(source="web_browsing_assistant"), |
| 87 | + ) |
| 88 | + await Console(team.run_stream(task="Find out how many contributors for the microsoft/autogen repository")) |
| 89 | + |
91 | 90 |
|
92 | 91 | asyncio.run(main())
|
93 | 92 | ```
|
94 | 93 |
|
| 94 | +> **Warning**: Only connect to trusted MCP servers as they may execute commands |
| 95 | +> in your local environment or expose sensitive information. |
| 96 | +
|
95 | 97 | ### AutoGen Studio
|
96 | 98 |
|
97 | 99 | Use AutoGen Studio to prototype and run multi-agent workflows without writing code.
|
@@ -132,17 +134,16 @@ With AutoGen you get to join and contribute to a thriving ecosystem. We host wee
|
132 | 134 |
|
133 | 135 | <div align="center">
|
134 | 136 |
|
135 |
| -| | [](./python) | [](./dotnet) | [](./python/packages/autogen-studio) | |
136 |
| -| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | |
137 |
| -| Installation | [](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/installation.html) | [](https://microsoft.github.io/autogen/dotnet/dev/core/installation.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/installation.html) | |
138 |
| -| Quickstart | [](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/quickstart.html#) | [](https://microsoft.github.io/autogen/dotnet/dev/core/index.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html#) | |
139 |
| -| Tutorial | [](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/index.html) | [](https://microsoft.github.io/autogen/dotnet/dev/core/tutorial.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html#) | |
140 |
| -| API Reference | [](https://microsoft.github.io/autogen/stable/reference/index.html#) | [](https://microsoft.github.io/autogen/dotnet/dev/api/Microsoft.AutoGen.Contracts.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html) | |
141 |
| -| Packages | [](https://pypi.org/project/autogen-core/) <br> [](https://pypi.org/project/autogen-agentchat/) <br> [](https://pypi.org/project/autogen-ext/) | [](https://www.nuget.org/packages/Microsoft.AutoGen.Contracts/) <br> [](https://www.nuget.org/packages/Microsoft.AutoGen.Core/) <br> [](https://www.nuget.org/packages/Microsoft.AutoGen.Core.Grpc/) <br> [](https://www.nuget.org/packages/Microsoft.AutoGen.RuntimeGateway.Grpc/) | [](https://pypi.org/project/autogenstudio/) | |
| 137 | +| | [](./python) | [](./dotnet) | [](./python/packages/autogen-studio) | |
| 138 | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 139 | +| Installation | [](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/installation.html) | [](https://microsoft.github.io/autogen/dotnet/dev/core/installation.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/installation.html) | |
| 140 | +| Quickstart | [](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/quickstart.html#) | [](https://microsoft.github.io/autogen/dotnet/dev/core/index.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html#) | |
| 141 | +| Tutorial | [](https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/index.html) | [](https://microsoft.github.io/autogen/dotnet/dev/core/tutorial.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html#) | |
| 142 | +| API Reference | [](https://microsoft.github.io/autogen/stable/reference/index.html#) | [](https://microsoft.github.io/autogen/dotnet/dev/api/Microsoft.AutoGen.Contracts.html) | [](https://microsoft.github.io/autogen/stable/user-guide/autogenstudio-user-guide/usage.html) | |
| 143 | +| Packages | [](https://pypi.org/project/autogen-core/) <br> [](https://pypi.org/project/autogen-agentchat/) <br> [](https://pypi.org/project/autogen-ext/) | [](https://www.nuget.org/packages/Microsoft.AutoGen.Contracts/) <br> [](https://www.nuget.org/packages/Microsoft.AutoGen.Core/) <br> [](https://www.nuget.org/packages/Microsoft.AutoGen.Core.Grpc/) <br> [](https://www.nuget.org/packages/Microsoft.AutoGen.RuntimeGateway.Grpc/) | [](https://pypi.org/project/autogenstudio/) | |
142 | 144 |
|
143 | 145 | </div>
|
144 | 146 |
|
145 |
| - |
146 | 147 | Interested in contributing? See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to get started. We welcome contributions of all kinds, including bug fixes, new features, and documentation improvements. Join our community and help us make AutoGen better!
|
147 | 148 |
|
148 | 149 | Have questions? Check out our [Frequently Asked Questions (FAQ)](./FAQ.md) for answers to common queries. If you don't find what you're looking for, feel free to ask in our [GitHub Discussions](https://github.com/microsoft/autogen/discussions) or join our [Discord server](https://aka.ms/autogen-discord) for real-time support. You can also read our [blog](https://devblogs.microsoft.com/autogen/) for updates.
|
|
0 commit comments