Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

I cannot run the multi agent example without a team leader #1888

Copy link
Copy link
@aldian

Description

@aldian
Issue body actions

Bug description
The multi agent example crashes:

$ python build_customized_multi_agents.py 
2025-09-27 20:53:35.757 | INFO     | metagpt.const:get_metagpt_package_root:15 - Package root set to /home/ubuntu/metagpt/MetaGPT
2025-09-27 20:53:35.757 | INFO     | metagpt.const:get_metagpt_package_root:15 - Package root set to /home/ubuntu/metagpt/MetaGPT
2025-09-27 20:53:39.218 | INFO     | __main__:main:127 - write a function that calculates the product of a list
2025-09-27 20:53:39.313 | INFO     | metagpt.team:invest:96 - Investment: $3.0.
Traceback (most recent call last):
  File "/home/ubuntu/metagpt/MetaGPT/examples/build_customized_multi_agents.py", line 144, in <module>
    fire.Fire(main)
  File "/home/ubuntu/metagpt/.venv/lib/python3.11/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/metagpt/.venv/lib/python3.11/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/metagpt/.venv/lib/python3.11/site-packages/fire/core.py", line 679, in _CallAndUpdateTrace
    component = loop.run_until_complete(fn(*varargs, **kwargs))
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/python-3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/ubuntu/metagpt/MetaGPT/examples/build_customized_multi_agents.py", line 139, in main
    team.run_project(idea)
  File "/home/ubuntu/metagpt/MetaGPT/metagpt/team.py", line 107, in run_project
    self.env.publish_message(Message(content=idea))
  File "/home/ubuntu/metagpt/MetaGPT/metagpt/environment/mgx/mgx_env.py", line 48, in publish_message
    elif publicer == tl.profile:
                     ^^^^^^^^^^

Bug solved method
There are two ways to fix this bug:

  1. Make metagpt/environment/mgx/mgx_env.py more flexible by allowing a team without a leader.
  2. Add a team leader to the example.

Environment information

  • LLM type and model name: gpt-oss:20b
  • System version: Ubuntu 24.04
  • Python version: 3.11
  • MetaGPT version or branch: main branch

Screenshots or logs
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.