Skip to content

[MagenticOneGroupChat] MagenticOneGroupChat takes too long to start #7041

@smalltalkman

Description

@smalltalkman

What happened?

Describe the bug
MagenticOneGroupChat takes about a minute to start.

To Reproduce
Modify the code here:

            import time
            start_time = time.perf_counter()
            await self._runtime.send_message(
                GroupChatStart(messages=messages, output_task_messages=output_task_messages),
                recipient=AgentId(type=self._group_chat_manager_topic_type, key=self._team_id),
                cancellation_token=cancellation_token,
            )
            end_time = time.perf_counter()
            print(f"time:{end_time - start_time:.6f} s")

Run:

import asyncio
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import MagenticOneGroupChat
from autogen_agentchat.ui import Console


async def main() -> None:
    model_client = OpenAIChatCompletionClient(
            model="deepseek-chat",
            base_url="https://api.deepseek.com/v1",
          # api_key="your_api_key",
            model_capabilities={
                "vision": False,
                "function_calling": True,
                "json_output": True,
            },
        )

    assistant = AssistantAgent(
        "Assistant",
        model_client=model_client,
    )
    team = MagenticOneGroupChat([assistant], model_client=model_client)
    await Console(team.run_stream(task="Provide a different proof to Fermat last theorem"))


asyncio.run(main())

The output includes:

time:76.192850 s

Expected behavior
shorten the startup time of MagenticOneGroupChat.

Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

AutoGen library version.

Python 0.7.2

Other library version.

No response

Model used

deepseek-chat

Model provider

None

Other model provider

No response

Python version

3.10

.NET version

None

Operating system

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions