Skip to content

Conversation

christian-bromann
Copy link
Member

Adding docs on multi agent.

Copy link

github-actions bot commented Sep 3, 2025

Preview ID generated: preview-cbmult-1756923077-adb1fe2

* Context or memory grows too large for one agent to track effectively.
* Tasks require **specialization** (e.g., a planner, researcher, math expert).

Benefits include:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could potentially cut out the benefits to reduce the amount of text

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, I think these are implicit

3. The **tool agent** returns results to the controller.
4. The **controller** decides the next step or finishes.

✅ Predictable, centralized routing.<br />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove these bullet points -- I don't think they're correct

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also remove emojis

2. It passes control (and state) to the **next agent**.
3. The **new agent** interacts directly with the user until it decides to hand off again or finish.

✅ Flexible, more natural conversational flow between specialists.<br />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove these bullet points -- I don't think they're correct

| ----------------------------------------------------- | ------------ | -------- |
| Need centralized control over workflow? | ✅ Yes | ❌ No |
| Want agents to interact directly with the user? | ❌ No | ✅ Yes |
| Complex, human-like conversation between specialists? | ❌ Limited | ✅ Strong |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the last entry -- let's remove it?


```python
from langgraph.prebuilt import create_react_agent
from langgraph_supervisor import create_supervisor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the prebuilt? I don't think the package adds much value when users need to customize the behavior further -- it introduces it's own abstractions that are difficulty to reason about

In this variant of the supervisor architecture, we define a supervisor agent which is responsible for calling sub-agents. The sub-agents are exposed to the supervisor as tools:

<Tabs>
<Tab title="Supervisor (from scratch)">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Tab title="Supervisor (from scratch)">
<Tab title="Supervisor">


:::

## Multi-agent architectures
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major: Do we need to describe the different architectures? Why can we not focus specifically on tool calling and handoffs and show how to implement the various patterns?

I don't think knowing that the agents are in a "network" adds much utility?

Copy link

github-actions bot commented Sep 3, 2025

Preview ID generated: preview-cbmult-1756924758-fc814ff

You can also combine these patterns — e.g., use a top-level **tool-calling controller** for high-level routing, but allow **handoffs** within a team of related agents for smoother conversation.
</Tip>

## How handoffs work
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing a bit of information about how the "active agent" is tracked

This means that supporting handoffs in your system requires tracking the currently active agent in the shared graph state, so the runtime always knows which agent is “in control.”

We might need a sentence somewhere about the graph state including an active_agent attribute and potentially explanation that when using multi-agent with handoffs the entrypoint into the graph is a routing node.


The most important thing when building multi-agent systems is figuring out how the agents communicate. A common way for agents to communicate is via a shared list of messages in the graph state.

### Context engineering
Copy link
Collaborator

@eyurtsev eyurtsev Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that as a user I'd need to see context engineering examples for both tools and handoffs to be able to understand how to do context engineering in each case.

The ones below are specifically for non-handoff tools (i.e., supervisor).

:::
</Accordion>

<Accordion title="Supervisor" icon="user-crown">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove this example and recommend that users implement supervisor using tools?


* A single agent has too many tools and makes poor decisions about which to use.
* Context or memory grows too large for one agent to track effectively.
* Tasks require **specialization** (e.g., a planner, researcher, math expert).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Tasks require **specialization** (e.g., a planner, researcher, math expert).
* Sub-tasks require **specialization** (e.g., a planner, researcher, math expert).

Comment on lines +30 to +33
| Pattern | How it Works | Control Flow | Example Use Case |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------ |
| **Tool Calling** | A central agent calls other agents as *tools*. The "tool" agents don't talk to the user directly — they just run their task and return results. | Centralized — all routing passes through the calling agent. | Task orchestration, structured workflows. |
| **Handoffs** | The current agent decides to **transfer control** to another agent. The active agent changes, and the user may continue interacting directly with the new agent. | Decentralized — agents can change who is active. | Multi-domain conversations, specialist takeover. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table format does not translate to mobile. Perhaps two accordions with How it Works, Control Flow, and Example as subjeaders

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example subheader could then maybe have code snippet dropdowns? or might become too much content

Copy link

github-actions bot commented Sep 3, 2025

Preview ID generated: preview-cbmult-1756929036-88d1417

Copy link

github-actions bot commented Sep 3, 2025

Preview ID generated: preview-cbmult-1756929388-b5c9326

Copy link

github-actions bot commented Sep 4, 2025

Preview ID generated: preview-cbmult-1757014745-55d972b

@mdrxy mdrxy added the langchain For docs changes to LangChain label Sep 8, 2025
@lnhsingh
Copy link
Collaborator

Should this be closed or adapted to match #418? @christian-bromann @eyurtsev

@eyurtsev
Copy link
Collaborator

Merged in another form

@eyurtsev eyurtsev closed this Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
langchain For docs changes to LangChain
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants