Renamed TeamOne to MagenticOne (#6)

* Renamed TeamOne to MagenticOne

* Updated uv.lock

* Fixed workflows.
This commit is contained in:
afourney 2024-10-01 15:59:03 -07:00 committed by GitHub
parent 499b3fcbbf
commit 50ed0978b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
53 changed files with 149 additions and 301 deletions

View File

@ -48,7 +48,7 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/team-one",
"./packages/autogen-magentic-one",
"./packages/agbench",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
@ -74,7 +74,7 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/team-one",
"./packages/autogen-magentic-one",
"./packages/agbench",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
@ -99,7 +99,7 @@ jobs:
package:
[
"./packages/autogen-core",
"./packages/team-one",
"./packages/autogen-magentic-one",
"./packages/autogen-ext",
"./packages/autogen-agentchat",
]

View File

@ -11,11 +11,11 @@ from autogen_core.application import SingleThreadedAgentRuntime
from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import AgentId, AgentProxy
from autogen_core.components.code_executor import CodeBlock, DockerCommandLineCodeExecutor
from team_one.agents.coder import Coder, Executor
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.user_proxy import UserProxy
from team_one.messages import RequestReplyMessage
from team_one.utils import LogHandler, create_completion_client_from_env
from autogen_magentic_one.agents.coder import Coder, Executor
from autogen_magentic_one.agents.orchestrator import RoundRobinOrchestrator
from autogen_magentic_one.agents.user_proxy import UserProxy
from autogen_magentic_one.messages import RequestReplyMessage
from autogen_magentic_one.utils import LogHandler, create_completion_client_from_env
async def confirm_code(code: CodeBlock) -> bool:

View File

@ -8,11 +8,11 @@ import logging
from autogen_core.application import SingleThreadedAgentRuntime
from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import AgentId, AgentProxy
from team_one.agents.file_surfer import FileSurfer
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.user_proxy import UserProxy
from team_one.messages import RequestReplyMessage
from team_one.utils import LogHandler, create_completion_client_from_env
from autogen_magentic_one.agents.file_surfer import FileSurfer
from autogen_magentic_one.agents.orchestrator import RoundRobinOrchestrator
from autogen_magentic_one.agents.user_proxy import UserProxy
from autogen_magentic_one.messages import RequestReplyMessage
from autogen_magentic_one.utils import LogHandler, create_completion_client_from_env
async def main() -> None:

View File

@ -12,11 +12,11 @@ from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import AgentId, AgentProxy
# from typing import Any, Dict, List, Tuple, Union
from team_one.agents.coder import Coder
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.user_proxy import UserProxy
from team_one.messages import RequestReplyMessage
from team_one.utils import LogHandler, create_completion_client_from_env
from autogen_magentic_one.agents.coder import Coder
from autogen_magentic_one.agents.orchestrator import RoundRobinOrchestrator
from autogen_magentic_one.agents.user_proxy import UserProxy
from autogen_magentic_one.messages import RequestReplyMessage
from autogen_magentic_one.utils import LogHandler, create_completion_client_from_env
async def main() -> None:

View File

@ -10,11 +10,11 @@ import os
from autogen_core.application import SingleThreadedAgentRuntime
from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import AgentId, AgentProxy
from team_one.agents.multimodal_web_surfer import MultimodalWebSurfer
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.user_proxy import UserProxy
from team_one.messages import RequestReplyMessage
from team_one.utils import LogHandler, create_completion_client_from_env
from autogen_magentic_one.agents.multimodal_web_surfer import MultimodalWebSurfer
from autogen_magentic_one.agents.orchestrator import RoundRobinOrchestrator
from autogen_magentic_one.agents.user_proxy import UserProxy
from autogen_magentic_one.messages import RequestReplyMessage
from autogen_magentic_one.utils import LogHandler, create_completion_client_from_env
# NOTE: Don't forget to 'playwright install --with-deps chromium'

View File

@ -3,8 +3,8 @@ requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "team-one"
version = "0.1.0dev0"
name = "autogen-magentic-one"
version = "0.0.1"
description = ''
readme = "readme.md"
requires-python = ">=3.10"
@ -68,7 +68,7 @@ include = [
]
[tool.ruff.lint.per-file-ignores]
"src/team_one/utils.py" = ["T20"]
"src/autogen_magentic_one/utils.py" = ["T20"]
[tool.pyright]

View File

@ -1,19 +1,19 @@
# Team-One
Team-One is a generalist multi-agent softbot that utilizes a combination of five agents, including LLM and tool-based agents, to tackle intricate tasks. For example, it can be used to solve general tasks that involve multi-step planning and action in the real-world.
# Magentic-One
Magentic-One is a generalist multi-agent softbot that utilizes a combination of five agents, including LLM and tool-based agents, to tackle intricate tasks. For example, it can be used to solve general tasks that involve multi-step planning and action in the real-world.
> *Example*: Suppose a user requests to conduct a survey of AI safety papers published in the last month and create a concise presentation on the findings. Team-One will use the following process to handle this task. The orchestrator agent will break down the task into subtasks and assign them to the appropriate agents. Such as the web surfer agent to search for AI safety papers, the file surfer agent to extract information from the papers, the coder agent to create the presentation, and the computer terminal agent to execute the code. The orchestrator agent will coordinate the agents, monitor progress, and ensure the task is completed successfully.
> *Example*: Suppose a user requests to conduct a survey of AI safety papers published in the last month and create a concise presentation on the findings. Magentic-One will use the following process to handle this task. The orchestrator agent will break down the task into subtasks and assign them to the appropriate agents. Such as the web surfer agent to search for AI safety papers, the file surfer agent to extract information from the papers, the coder agent to create the presentation, and the computer terminal agent to execute the code. The orchestrator agent will coordinate the agents, monitor progress, and ensure the task is completed successfully.
## Architecture
<center>
<img src="./imgs/team-one-landing.png" alt="drawing" style="width:350px;"/>
<img src="./imgs/autogen-magentic-one-landing.png" alt="drawing" style="width:350px;"/>
</center>
Team-One uses agents with the following personas and capabilities:
Magentic-One uses agents with the following personas and capabilities:
- Orchestrator: The orchestrator agent is responsible for planning, managing subgoals, and coordinating the other agents. It can break down complex tasks into smaller subtasks and assign them to the appropriate agents. It also keeps track of the overall progress and takes corrective actions if needed (such as reassigning tasks or replanning when stuck).
@ -25,19 +25,19 @@ Team-One uses agents with the following personas and capabilities:
- File Surfer: The file surfer agent specializes in navigating files such as pdfs, powerpoints, WAV files, and other file types. It can search, read, and extract information from files.
We created Team-One with one agent of each type because their combined abilities help tackle tough benchmarks. By splitting tasks among different agents, we keep the code simple and modular, like in object-oriented programming. This also makes each agent's job easier since they only need to focus on specific tasks. For example, the websurfer agent only needs to navigate webpages and doesn't worry about writing code, making the team more efficient and effective.
We created Magentic-One with one agent of each type because their combined abilities help tackle tough benchmarks. By splitting tasks among different agents, we keep the code simple and modular, like in object-oriented programming. This also makes each agent's job easier since they only need to focus on specific tasks. For example, the websurfer agent only needs to navigate webpages and doesn't worry about writing code, making the team more efficient and effective.
### Planning and Tracking Task Progress
<center>
<img src="./imgs/team-one-arch.png" alt="drawing" style="width:600px;"/>
<img src="./imgs/autogen-magentic-one-arch.png" alt="drawing" style="width:600px;"/>
</center>
The figure illustrates the workflow of an orchestrator managing a multi-agent setup, starting with an initial prompt or task. The orchestrator creates or updates a ledger with gathered information, including verified facts, facts to look up, derived facts, and educated guesses. Using this ledger, a plan is derived, which consists of a sequence of steps and task assignments for the agents. Before execution, the orchestrator clears the agents' contexts to ensure they start fresh. The orchestrator then evaluates if the request is fully satisfied. If so, it reports the final answer or an educated guess.
If the request is not fully satisfied, the orchestrator assesses whether the work is progressing or if there are significant barriers. If progress is being made, the orchestrator orchestrates the next step by selecting an agent and providing instructions. If the process stalls for more than two iterations, the ledger is updated with new information, and the plan is adjusted. This cycle continues, iterating through steps and evaluations, until the task is completed. The orchestrator ensures organized, effective tracking and iterative problem-solving to achieve the prompt's goal.
Note that many parameters such as terminal logic and maximum number of stalled iterations are configurable. Also note that the orchestrator cannot instantiate new agents. This is possible but not implemented in Team-One.
Note that many parameters such as terminal logic and maximum number of stalled iterations are configurable. Also note that the orchestrator cannot instantiate new agents. This is possible but not implemented in Magentic-One.
## Table of Definitions:
@ -45,39 +45,39 @@ Note that many parameters such as terminal logic and maximum number of stalled i
| Term | Definition |
|---------------|-------------------------------------------------|
| Agent | A component that can (autonomously) act based on observations. Different agents may have different functions and actions. |
| Planning | The process of determining actions to achieve goals, performed by the Orchestrator agent in Team-One. |
| Ledger | A record-keeping component used by the Orchestrator agent to track the progress and manage subgoals in Team-One. |
| Stateful Tools | Tools that maintain state or data, such as the web browser and markdown-based file browser used by Team-One. |
| Tools | Resources used by Team-One for various purposes, including stateful and stateless tools. |
| Stateless Tools | Tools that do not maintain state or data, like the commandline executor used by Team-One. |
| Planning | The process of determining actions to achieve goals, performed by the Orchestrator agent in Magentic-One. |
| Ledger | A record-keeping component used by the Orchestrator agent to track the progress and manage subgoals in Magentic-One. |
| Stateful Tools | Tools that maintain state or data, such as the web browser and markdown-based file browser used by Magentic-One. |
| Tools | Resources used by Magentic-One for various purposes, including stateful and stateless tools. |
| Stateless Tools | Tools that do not maintain state or data, like the commandline executor used by Magentic-One. |
## Capabilities and Performance
### Capabilities
- Planning: The Orchestrator agent in Team-One excels at performing planning tasks. Planning involves determining actions to achieve goals. The Orchestrator agent breaks down complex tasks into smaller subtasks and assigns them to the appropriate agents.
- Planning: The Orchestrator agent in Magentic-One excels at performing planning tasks. Planning involves determining actions to achieve goals. The Orchestrator agent breaks down complex tasks into smaller subtasks and assigns them to the appropriate agents.
- Ledger: The Orchestrator agent in Team-One utilizes a ledger, which is a record-keeping component. The ledger tracks the progress of tasks and manages subgoals. It allows the Orchestrator agent to monitor the overall progress of the system and take corrective actions if needed.
- Ledger: The Orchestrator agent in Magentic-One utilizes a ledger, which is a record-keeping component. The ledger tracks the progress of tasks and manages subgoals. It allows the Orchestrator agent to monitor the overall progress of the system and take corrective actions if needed.
- Acting in the Real World: Team-One is designed to take action in the real world based on observations. The agents in Team-One can autonomously perform actions based on the information they observe from their environment.
- Acting in the Real World: Magentic-One is designed to take action in the real world based on observations. The agents in Magentic-One can autonomously perform actions based on the information they observe from their environment.
- Adaptation to Observation: The agents in Team-One can adapt to new observations. They can update their knowledge and behavior based on the information they receive from their environment. This allows Team-One to effectively handle dynamic and changing situations.
- Adaptation to Observation: The agents in Magentic-One can adapt to new observations. They can update their knowledge and behavior based on the information they receive from their environment. This allows Magentic-One to effectively handle dynamic and changing situations.
- Stateful Tools: Team-One utilizes stateful tools such as a web browser and a markdown-based file browser. These tools maintain state or data, which is essential for performing complex tasks that involve actions that might change the state of the environment.
- Stateful Tools: Magentic-One utilizes stateful tools such as a web browser and a markdown-based file browser. These tools maintain state or data, which is essential for performing complex tasks that involve actions that might change the state of the environment.
- Stateless Tools: Team-One also utilizes stateless tools such as a command-line executor. These tools do not maintain state or data.
- Stateless Tools: Magentic-One also utilizes stateless tools such as a command-line executor. These tools do not maintain state or data.
- Coding: The Coder agent in Team-One is highly skilled in programming languages and is responsible for writing code. This capability enables Team-One to create and execute code to accomplish various tasks.
- Coding: The Coder agent in Magentic-One is highly skilled in programming languages and is responsible for writing code. This capability enables Magentic-One to create and execute code to accomplish various tasks.
- Execution of Code: The Computer Terminal agent in Team-One acts as an interface that can execute code written by the Coder agent. This capability allows Team-One to execute the code and perform actions in the system.
- Execution of Code: The Computer Terminal agent in Magentic-One acts as an interface that can execute code written by the Coder agent. This capability allows Magentic-One to execute the code and perform actions in the system.
- File Navigation and Extraction: The File Surfer agent in Team-One specializes in navigating and extracting information from various file types such as PDFs, PowerPoints, and WAV files. This capability enables Team-One to search, read, and extract relevant information from files.
- File Navigation and Extraction: The File Surfer agent in Magentic-One specializes in navigating and extracting information from various file types such as PDFs, PowerPoints, and WAV files. This capability enables Magentic-One to search, read, and extract relevant information from files.
- Web Interaction: The Web Surfer agent in Team-One is proficient in web-related tasks. It can browse the internet, retrieve information from websites, and interact with web-based applications. This capability allows Team-One to handle interactive web pages, forms, and other web elements.
- Web Interaction: The Web Surfer agent in Magentic-One is proficient in web-related tasks. It can browse the internet, retrieve information from websites, and interact with web-based applications. This capability allows Magentic-One to handle interactive web pages, forms, and other web elements.
### What Team-One Cannot Do
### What Magentic-One Cannot Do
- **Video Scrubbing:** The agents are unable to navigate and process video content.
- **User in the Loop Optimization:** The system does not currently incorporate ongoing user interaction beyond the initial task submission.
@ -109,7 +109,7 @@ Note that many parameters such as terminal logic and maximum number of stalled i
### Performance
Team-One currently achieves the following performance on complex agent benchmarks.
Magentic-One currently achieves the following performance on complex agent benchmarks.
#### GAIA
@ -123,7 +123,7 @@ In order to solve this task, the orchestrator begins by outlining the steps need
Next, the orchestrator assigns the assistant agent to use this data to perform the necessary calculations. The assistant converts Kipchoge's marathon time to hours (2.0275 hours) and calculates his speed (approximately 20.81 km/h). It then calculates the total time to run the distance to the Moon (17,130.13 hours), rounding it to the nearest thousand hours, resulting in approximately 17,000 thousand hours. The orchestrator then confirms and reports this final result.
Here is the performance of Team-One on a GAIA development set.
Here is the performance of Magentic-One on a GAIA development set.
| Level | Task Completion Rate* |
|-------|---------------------|
@ -155,24 +155,24 @@ Once on Waoonet's profile, the agents focused on counting the comments that had
### Logging in Team One Agents
Team One agents can emit several log events that can be consumed by a log handler (see the example log handler in [utils.py](src/team_one/utils.py)). A list of currently emitted events are:
Team One agents can emit several log events that can be consumed by a log handler (see the example log handler in [utils.py](src/autogen_magentic_one/utils.py)). A list of currently emitted events are:
- OrchestrationEvent : emitted by a an [Orchestrator](src/team_one/agents/base_orchestrator.py) agent.
- WebSurferEvent : emitted by a [WebSurfer](src/team_one/agents/multimodal_web_surfer/multimodal_web_surfer.py) agent.
- OrchestrationEvent : emitted by a an [Orchestrator](src/autogen_magentic_one/agents/base_orchestrator.py) agent.
- WebSurferEvent : emitted by a [WebSurfer](src/autogen_magentic_one/agents/multimodal_web_surfer/multimodal_web_surfer.py) agent.
In addition, developers can also handle and process logs generated from the AutoGen core library (e.g., LLMCallEvent etc). See the example log handler in [utils.py](src/team_one/utils.py) on how this can be implemented. By default, the logs are written to a file named `log.jsonl` which can be configured as a parameter to the defined log handler. These logs can be parsed to retrieved data agent actions.
In addition, developers can also handle and process logs generated from the AutoGen core library (e.g., LLMCallEvent etc). See the example log handler in [utils.py](src/autogen_magentic_one/utils.py) on how this can be implemented. By default, the logs are written to a file named `log.jsonl` which can be configured as a parameter to the defined log handler. These logs can be parsed to retrieved data agent actions.
# Setup
You can install the Team-One package using pip and then run the example code to see how the agents work together to accomplish a task.
You can install the Magentic-One package using pip and then run the example code to see how the agents work together to accomplish a task.
1. Clone the code.
```bash
# clone autogen_core
cd python/teams/team-one
cd python/teams/autogen-magentic-one
pip install -e .
```

View File

@ -0,0 +1 @@
ABOUT = "This is Magentic-One."

View File

@ -6,17 +6,17 @@ from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import MessageContext
from autogen_core.components import RoutedAgent, message_handler
from team_one.messages import (
from autogen_magentic_one.messages import (
AgentEvent,
BroadcastMessage,
DeactivateMessage,
RequestReplyMessage,
ResetMessage,
TeamOneMessages,
MagenticOneMessages,
)
class TeamOneBaseAgent(RoutedAgent):
class MagenticOneBaseAgent(RoutedAgent):
"""An agent that optionally ensures messages are handled non-concurrently in the order they arrive."""
def __init__(
@ -31,7 +31,7 @@ class TeamOneBaseAgent(RoutedAgent):
if not self._handle_messages_concurrently:
# TODO: make it possible to stop
self._message_queue = asyncio.Queue[tuple[TeamOneMessages, MessageContext, asyncio.Future[Any]]]()
self._message_queue = asyncio.Queue[tuple[MagenticOneMessages, MessageContext, asyncio.Future[Any]]]()
self._processing_task = asyncio.create_task(self._process())
async def _process(self) -> None:

View File

@ -8,10 +8,10 @@ from autogen_core.components.models import AssistantMessage, LLMMessage, UserMes
from ..messages import BroadcastMessage, OrchestrationEvent, RequestReplyMessage, ResetMessage
from ..utils import message_content_to_str
from .base_agent import TeamOneBaseAgent
from .base_agent import MagenticOneBaseAgent
class BaseOrchestrator(TeamOneBaseAgent):
class BaseOrchestrator(MagenticOneBaseAgent):
def __init__(
self,
agents: List[AgentProxy],

View File

@ -7,7 +7,7 @@ from autogen_core.components.models import (
UserMessage,
)
from team_one.messages import (
from autogen_magentic_one.messages import (
BroadcastMessage,
RequestReplyMessage,
ResetMessage,
@ -15,11 +15,11 @@ from team_one.messages import (
)
from ..utils import message_content_to_str
from .base_agent import TeamOneBaseAgent
from .base_agent import MagenticOneBaseAgent
class BaseWorker(TeamOneBaseAgent):
"""Base agent that handles the TeamOne worker behavior protocol."""
class BaseWorker(MagenticOneBaseAgent):
"""Base agent that handles the MagenticOne worker behavior protocol."""
def __init__(
self,

View File

@ -38,7 +38,7 @@ class OrchestrationEvent:
message: str
TeamOneMessages = RequestReplyMessage | BroadcastMessage | ResetMessage | DeactivateMessage
MagenticOneMessages = RequestReplyMessage | BroadcastMessage | ResetMessage | DeactivateMessage
@dataclass

View File

@ -101,7 +101,7 @@ def message_content_to_str(
raise AssertionError("Unexpected response type.")
# TeamOne log event handler
# MagenticOne log event handler
class LogHandler(logging.FileHandler):
def __init__(self, filename: str = "log.jsonl") -> None:
super().__init__(filename)

View File

@ -2,7 +2,7 @@
import os
import pytest
from team_one.markdown_browser import BingMarkdownSearch
from autogen_magentic_one.markdown_browser import BingMarkdownSearch
skip_all = False

View File

@ -5,7 +5,7 @@ import shutil
import pytest
import requests
from team_one.markdown_browser import MarkdownConverter
from autogen_magentic_one.markdown_browser import MarkdownConverter
skip_all = False

View File

@ -8,7 +8,7 @@ import re
import pytest
import requests
from team_one.markdown_browser import BingMarkdownSearch, RequestsMarkdownBrowser
from autogen_magentic_one.markdown_browser import BingMarkdownSearch, RequestsMarkdownBrowser
BLOG_POST_URL = "https://microsoft.github.io/autogen/blog/2023/04/21/LLM-tuning-math"
BLOG_POST_TITLE = "Does Model and Inference Parameter Matter in LLM Applications? - A Case Study for MATH | AutoGen"
@ -30,7 +30,7 @@ PDF_STRING = "Figure 1: AutoGen enables diverse LLM-based applications using mul
DIR_TEST_STRINGS = [
"# Index of ",
"[.. (parent directory)]",
"/python/packages/team-one/tests/browser_utils",
"/python/packages/autogen-magentic-one/tests/browser_utils",
]
LOCAL_FILE_TEST_STRINGS = [

View File

@ -17,8 +17,8 @@ from autogen_core.components.models import (
from autogen_core.components.tools._base import ToolSchema
from conftest import MOCK_CHAT_COMPLETION_KWARGS, reason
from openai import AuthenticationError
from team_one.agents.multimodal_web_surfer import MultimodalWebSurfer
from team_one.agents.multimodal_web_surfer.tool_definitions import (
from autogen_magentic_one.agents.multimodal_web_surfer import MultimodalWebSurfer
from autogen_magentic_one.agents.multimodal_web_surfer.tool_definitions import (
TOOL_PAGE_DOWN,
TOOL_PAGE_UP,
TOOL_READ_PAGE_AND_ANSWER,
@ -26,10 +26,10 @@ from team_one.agents.multimodal_web_surfer.tool_definitions import (
TOOL_VISIT_URL,
TOOL_WEB_SEARCH,
)
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.user_proxy import UserProxy
from team_one.messages import BroadcastMessage
from team_one.utils import (
from autogen_magentic_one.agents.orchestrator import RoundRobinOrchestrator
from autogen_magentic_one.agents.user_proxy import UserProxy
from autogen_magentic_one.messages import BroadcastMessage
from autogen_magentic_one.utils import (
ENVIRON_KEY_CHAT_COMPLETION_KWARGS_JSON,
ENVIRON_KEY_CHAT_COMPLETION_PROVIDER,
create_completion_client_from_env,

View File

@ -1,71 +0,0 @@
"""This example demonstrates a human user interacting with a coder agent and a executor agent
to generate and execute code snippets. An ledger orchestrator agent orchestrates the interaction
between the user, coder, and executor agents.
At each step, the orchestrator agent decides which user or agent to perform the next action.
The code snippets are executed inside a docker container."""
import asyncio
import logging
from autogen_core.application import SingleThreadedAgentRuntime
from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import AgentId, AgentProxy
from autogen_core.components.code_executor import CodeBlock, DockerCommandLineCodeExecutor
from team_one.agents.coder import Coder, Executor
from team_one.agents.orchestrator import LedgerOrchestrator
from team_one.agents.user_proxy import UserProxy
from team_one.messages import RequestReplyMessage
from team_one.utils import LogHandler, create_completion_client_from_env
async def confirm_code(code: CodeBlock) -> bool:
response = await asyncio.to_thread(
input,
f"Executor is about to execute code (lang: {code.language}):\n{code.code}\n\nDo you want to proceed? (yes/no): ",
)
return response.lower() == "yes"
async def main() -> None:
# Create the runtime.
runtime = SingleThreadedAgentRuntime()
async with DockerCommandLineCodeExecutor() as code_executor:
# Register agents.
await Coder.register(runtime, "Coder", lambda: Coder(model_client=create_completion_client_from_env()))
coder = AgentProxy(AgentId("Coder", "default"), runtime)
await Executor.register(
runtime,
"Executor",
lambda: Executor("A agent for executing code", executor=code_executor, confirm_execution=confirm_code),
)
executor = AgentProxy(AgentId("Executor", "default"), runtime)
await UserProxy.register(
runtime,
"UserProxy",
lambda: UserProxy(description="The current user interacting with you."),
)
user_proxy = AgentProxy(AgentId("UserProxy", "default"), runtime)
# TODO: doesn't work for more than default key
await LedgerOrchestrator.register(
runtime,
"orchestrator",
lambda: LedgerOrchestrator(
model_client=create_completion_client_from_env(), agents=[coder, executor, user_proxy]
),
)
runtime.start()
await runtime.send_message(RequestReplyMessage(), user_proxy.id)
await runtime.stop_when_idle()
if __name__ == "__main__":
logger = logging.getLogger(EVENT_LOGGER_NAME)
logger.setLevel(logging.INFO)
log_handler = LogHandler()
logger.handlers = [log_handler]
asyncio.run(main())

View File

@ -1,46 +0,0 @@
"""This example demonstrates three mock agents taking turn to reflect recieved message
by publishing it verbatim. The agents are orchestrated by a round-robin orchestrator agent."""
import asyncio
import logging
from autogen_core.application import SingleThreadedAgentRuntime
from autogen_core.application.logging import EVENT_LOGGER_NAME
from autogen_core.base import AgentId, AgentProxy
from autogen_core.components import DefaultTopicId
from autogen_core.components.models import UserMessage
from team_one.agents.orchestrator import RoundRobinOrchestrator
from team_one.agents.reflex_agents import ReflexAgent
from team_one.messages import BroadcastMessage
from team_one.utils import LogHandler
async def main() -> None:
runtime = SingleThreadedAgentRuntime()
await ReflexAgent.register(runtime, "fake_agent_1", lambda: ReflexAgent("First reflect agent"))
fake1 = AgentProxy(AgentId("fake_agent_1", "default"), runtime)
await ReflexAgent.register(runtime, "fake_agent_2", lambda: ReflexAgent("Second reflect agent"))
fake2 = AgentProxy(AgentId("fake_agent_2", "default"), runtime)
await ReflexAgent.register(runtime, "fake_agent_3", lambda: ReflexAgent("Third reflect agent"))
fake3 = AgentProxy(AgentId("fake_agent_3", "default"), runtime)
await RoundRobinOrchestrator.register(
runtime, "orchestrator", lambda: RoundRobinOrchestrator([fake1, fake2, fake3])
)
task_message = UserMessage(content="Test Message", source="User")
runtime.start()
await runtime.publish_message(BroadcastMessage(content=task_message), topic_id=DefaultTopicId())
await runtime.stop_when_idle()
if __name__ == "__main__":
logger = logging.getLogger(EVENT_LOGGER_NAME)
logger.setLevel(logging.INFO)
log_handler = LogHandler()
logger.handlers = [log_handler]
asyncio.run(main())

View File

@ -1 +0,0 @@
ABOUT = "This is team one."

View File

@ -1,28 +0,0 @@
from autogen_core.base import MessageContext, TopicId
from autogen_core.components import RoutedAgent, default_subscription, message_handler
from autogen_core.components.models import UserMessage
from ..messages import BroadcastMessage, RequestReplyMessage
@default_subscription
class ReflexAgent(RoutedAgent):
def __init__(self, description: str) -> None:
super().__init__(description)
@message_handler
async def handle_incoming_message(self, message: BroadcastMessage, ctx: MessageContext) -> None:
"""Handle an incoming message."""
pass
@message_handler
async def handle_request_reply_message(self, message: RequestReplyMessage, ctx: MessageContext) -> None:
name = self.metadata["type"]
response_message = UserMessage(
content=f"Hello, world from {name}!",
source=name,
)
topic_id = TopicId("default", self.id.key)
await self.publish_message(BroadcastMessage(content=response_message), topic_id=topic_id)

View File

@ -1,7 +0,0 @@
import team_one
def test_about() -> None:
about = team_one.ABOUT
assert isinstance(about, str)

136
python/uv.lock generated
View File

@ -27,8 +27,8 @@ members = [
"autogen-agentchat",
"autogen-core",
"autogen-ext",
"autogen-magentic-one",
"autogenstudio",
"team-one",
]
requirements = [
{ name = "cookiecutter" },
@ -489,6 +489,73 @@ requires-dist = [
{ name = "langchain", marker = "extra == 'langchain'", specifier = ">=0.3.1" },
]
[[package]]
name = "autogen-magentic-one"
version = "0.0.1"
source = { editable = "packages/autogen-magentic-one" }
dependencies = [
{ name = "aiofiles" },
{ name = "autogen-core" },
{ name = "beautifulsoup4" },
{ name = "mammoth" },
{ name = "markdownify" },
{ name = "numpy" },
{ name = "openpyxl" },
{ name = "pandas" },
{ name = "pathvalidate" },
{ name = "pdfminer-six" },
{ name = "playwright" },
{ name = "puremagic" },
{ name = "pydantic" },
{ name = "pydub" },
{ name = "python-pptx" },
{ name = "requests" },
{ name = "speechrecognition" },
{ name = "youtube-transcript-api" },
]
[package.dev-dependencies]
dev = [
{ name = "aiofiles" },
{ name = "azure-identity" },
{ name = "openpyxl" },
{ name = "types-aiofiles" },
{ name = "types-pillow" },
{ name = "types-requests" },
]
[package.metadata]
requires-dist = [
{ name = "aiofiles" },
{ name = "autogen-core", editable = "packages/autogen-core" },
{ name = "beautifulsoup4" },
{ name = "mammoth" },
{ name = "markdownify" },
{ name = "numpy" },
{ name = "openpyxl" },
{ name = "pandas" },
{ name = "pathvalidate" },
{ name = "pdfminer-six" },
{ name = "playwright" },
{ name = "puremagic" },
{ name = "pydantic", specifier = ">=2.0.0,<3.0.0" },
{ name = "pydub" },
{ name = "python-pptx" },
{ name = "requests" },
{ name = "speechrecognition" },
{ name = "youtube-transcript-api" },
]
[package.metadata.requires-dev]
dev = [
{ name = "aiofiles" },
{ name = "azure-identity" },
{ name = "openpyxl" },
{ name = "types-aiofiles" },
{ name = "types-pillow" },
{ name = "types-requests" },
]
[[package]]
name = "autogenstudio"
version = "0.1.6"
@ -4543,73 +4610,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/b3/04/13e657e010a1257c56a2e52a0032ce1abd993b75553ddf838b26d7abe75c/tavily_python-0.4.0-py3-none-any.whl", hash = "sha256:b3fd0d7102bb34f0dfb0fd24378e2029504a9836ffe7f07c013824105d9f6a5a", size = 13850 },
]
[[package]]
name = "team-one"
version = "0.1.0.dev0"
source = { editable = "packages/team-one" }
dependencies = [
{ name = "aiofiles" },
{ name = "autogen-core" },
{ name = "beautifulsoup4" },
{ name = "mammoth" },
{ name = "markdownify" },
{ name = "numpy" },
{ name = "openpyxl" },
{ name = "pandas" },
{ name = "pathvalidate" },
{ name = "pdfminer-six" },
{ name = "playwright" },
{ name = "puremagic" },
{ name = "pydantic" },
{ name = "pydub" },
{ name = "python-pptx" },
{ name = "requests" },
{ name = "speechrecognition" },
{ name = "youtube-transcript-api" },
]
[package.dev-dependencies]
dev = [
{ name = "aiofiles" },
{ name = "azure-identity" },
{ name = "openpyxl" },
{ name = "types-aiofiles" },
{ name = "types-pillow" },
{ name = "types-requests" },
]
[package.metadata]
requires-dist = [
{ name = "aiofiles" },
{ name = "autogen-core", editable = "packages/autogen-core" },
{ name = "beautifulsoup4" },
{ name = "mammoth" },
{ name = "markdownify" },
{ name = "numpy" },
{ name = "openpyxl" },
{ name = "pandas" },
{ name = "pathvalidate" },
{ name = "pdfminer-six" },
{ name = "playwright" },
{ name = "puremagic" },
{ name = "pydantic", specifier = ">=2.0.0,<3.0.0" },
{ name = "pydub" },
{ name = "python-pptx" },
{ name = "requests" },
{ name = "speechrecognition" },
{ name = "youtube-transcript-api" },
]
[package.metadata.requires-dev]
dev = [
{ name = "aiofiles" },
{ name = "azure-identity" },
{ name = "openpyxl" },
{ name = "types-aiofiles" },
{ name = "types-pillow" },
{ name = "types-requests" },
]
[[package]]
name = "tenacity"
version = "8.5.0"