> ## Documentation Index
> Fetch the complete documentation index at: https://docs.swarms.world/llms.txt
> Use this file to discover all available pages before exploring further.

# ExpertPanelDiscussion Guide

> Run a moderated panel where experts answer the moderator in turn, and the moderator sums up and asks the next question each round

`ExpertPanelDiscussion` runs a panel like one on a conference stage. A moderator agent opens each round with a question. Every expert answers it in turn. The moderator then sums up the answers and asks a follow-up question, which becomes the topic of the next round. You get back the full transcript.

Use it when you want several specialist views on one topic, steered by a moderator who keeps the discussion moving.

`ExpertPanelDiscussion` is not exported from the top-level `swarms` package. Import it from `swarms.structs.multi_agent_debates`.

Reference: [ExpertPanelDiscussion](https://docs.swarms.world/api/orchestration-methods.md#expertpaneldiscussion).

## 1. Run a panel

Pass at least two experts as `agents` and one `moderator`. `max_rounds` sets the number of rounds; the default is 3. Here one round keeps the run short, and `output_type="list"` returns each message with its speaker.

```python theme={null}
from swarms import Agent
from swarms.structs.multi_agent_debates import ExpertPanelDiscussion

moderator = Agent(
    agent_name="Moderator",
    system_prompt=(
        "You moderate expert panels. Speak only as the moderator: introduce "
        "the topic or sum up, then ask one question. Never answer for the "
        "experts. Keep each message under 80 words."
    ),
    model_name="gpt-5.4-mini",
    max_loops=1,
)
experts = [
    Agent(
        agent_name="Cardiologist",
        system_prompt="You are a cardiologist. Answer in under 80 words.",
        model_name="gpt-5.4-mini",
        max_loops=1,
    ),
    Agent(
        agent_name="Data_Scientist",
        system_prompt="You build clinical machine learning models. Answer in under 80 words.",
        model_name="gpt-5.4-mini",
        max_loops=1,
    ),
    Agent(
        agent_name="Patient_Advocate",
        system_prompt="You speak for patients. Answer in under 80 words.",
        model_name="gpt-5.4-mini",
        max_loops=1,
    ),
]

panel = ExpertPanelDiscussion(
    max_rounds=1,
    agents=experts,
    moderator=moderator,
    output_type="list",
)

messages = panel.run("Should smartwatch heart alerts trigger a doctor visit?")

for message in messages:
    print(f"--- {message['role']}")
    print(message["content"])
```

`run` raises `ValueError` if `agents` has fewer than two experts or `moderator` is not set. The check happens when you call `run`, not when you build the panel.

> [!TIP]
>
> Tell the moderator never to answer for the experts. Without that line, a model asked to "open the round" often writes the experts' answers too.

## 2. How a round works

Before the first round, the panel briefs every agent. The moderator is told who is on the panel. Each expert is told its number, the other experts' names and the moderator's name. These briefing replies are not part of the transcript.

Then, in each round:

1. The moderator gets `Round N: <topic>` and opens the round. The first round's topic is your task.
2. Each expert, in list order, gets `Expert <name>, please respond to: <moderator's message>`. Experts do not see each other's answers from the same round.
3. The moderator gets every expert's answer for the round, as one `name: answer` block per expert, and is asked to sum up and ask a follow-up question.
4. That summary becomes the next round's topic.

Each agent's final answer is what gets recorded and passed on, not its whole conversation. A run makes `1 + N + max_rounds * (N + 2)` agent calls for `N` experts, one after another. The panel in section 1 makes 9.

## 3. Read the transcript

The transcript does not include your task. Its first message is the moderator's opening of round 1. That matters for `output_type`:

| `output_type` | Returns |
| - | - |
| `"str-all-except-first"` (default) | Every message's text except the first, so the moderator's opening is dropped, with no speaker names |
| `"str"` | Every message as `Name: text`, separated by blank lines |
| `"list"` | A list of `{"role", "content"}` dicts, one per message |
| `"final"` | The moderator's last summary and follow-up question |

For a readable record, use `"str"` or `"list"`. Here two rounds run between an economist and a founder:

```python theme={null}
from swarms import Agent
from swarms.structs.multi_agent_debates import ExpertPanelDiscussion


def panelist(name: str, role: str) -> Agent:
    """Build a one-loop panel member with a short-answer prompt."""
    return Agent(
        agent_name=name,
        system_prompt=(
            f"You are {role}. Speak only for yourself, never for other "
            "panelists. Keep every message under 60 words."
        ),
        model_name="gpt-5.4-mini",
        max_loops=1,
    )


panel = ExpertPanelDiscussion(
    max_rounds=2,
    agents=[
        panelist("Economist", "a labour economist"),
        panelist("Founder", "a startup founder"),
    ],
    moderator=panelist("Moderator", "a panel moderator who asks sharp follow-up questions"),
    output_type="str",
)

transcript = panel.run("Will a four-day work week hurt small companies?")
print(transcript)
```

## 4. Run the same panel again

The panel does not reset its agents. Each agent keeps the earlier panel in its memory, so a second topic would be discussed with the first one still in context. Call `reset()` on every agent first, or build new agents. This continues from section 1:

```python theme={null}
for agent in [moderator, *experts]:
    agent.reset()

panel.output_type = "final"
follow_up = panel.run("Should hospitals accept data from consumer wearables?")
print(follow_up)
```

With `output_type="final"`, `run` returns only the moderator's closing summary and question, which is a quick way to see where the panel ended up.

## Tips

* **Keep answers short.** Each round's summary prompt carries every expert's answer, and every agent keeps its full history. A word limit in each system prompt keeps later rounds fast.
* **Give experts distinct roles.** Experts who share a prompt give the moderator little to sum up.
* **Track cost** with `panel.usage`, which sums the token counts of the moderator and every expert.

## Next steps

* [ExpertPanelDiscussion reference](https://docs.swarms.world/api/orchestration-methods.md#expertpaneldiscussion)
* [OneOnOneDebate guide](https://docs.swarms.world/examples/multi-agent/one-on-one-debate-example.md), for two agents and no moderator
* [Group chat guide](https://docs.swarms.world/examples/group-chat-example.md), where agents bid for the next turn
* [Runnable scripts](https://github.com/kyegomez/swarms/tree/master/examples/multi_agent/orchestration_examples)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.