langgraph-swarm and langgraph-supervisor cannot be used with createAgent from v1 #370

Open
opened 2026-02-15 18:16:18 -05:00 by yindo · 6 comments
Owner

Originally created by @baptistejamin on GitHub (Oct 19, 2025).

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).

Example Code

 // Create agents with handoff tools
    const alice = createAgent({
      llm: model,
      tools: [add, createHandoffTool({ agentName: "Bob" })],
      name: "Alice",
      prompt: "You are Alice, an addition expert.",
    });

    const bob = createAgent({
      llm: model,
      tools: [
        createHandoffTool({
          agentName: "Alice",
          description: "Transfer to Alice, she can help with math",
        }),
      ],
      name: "Bob",
      prompt: "You are Bob, you speak like a pirate.",
    });

    // Create swarm workflow
    const checkpointer = new MemorySaver();
    const workflow = createSwarm({
      agents: [alice, bob],
      defaultActiveAgent: "Alice",
    });

Error Message and Stack Trace (if applicable)

@langchain/langgraph-swarm:test:  FAIL   unit  src/swarm.test.ts > Swarm > should run in basic case
@langchain/langgraph-swarm:test: Error: Please specify a name when you create your agent, either via `createAgent({ ..., name: agentName })` or via `graph.compile({ name: agentName })`.
@langchain/langgraph-swarm:test:  ❯ createSwarm src/swarm.ts:124:13
@langchain/langgraph-swarm:test:     122|   for (const agent of agents) {
@langchain/langgraph-swarm:test:     123|     if (!agent.name || agent.name === "LangGraph") {
@langchain/langgraph-swarm:test:     124|       throw new Error(
@langchain/langgraph-swarm:test:        |             ^
@langchain/langgraph-swarm:test:     125|         "Please specify a name when you create your agent, either via `createReactAgent({ ..., name: agentName })` " +
@langchain/langgraph-swarm:test:     126|           "or via `graph.compile({ name: agentName })`."
@langchain/langgraph-swarm:test:  ❯ src/swarm.test.ts:146:22
@langchain/langgraph-swarm:test:
@langchain/langgraph-swarm:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

Description

Hello, and thank you for deploying v1 :)

Since createReactAgent was deprecated, I tried to replace it with a createAgent, and I noted two things:

  • agents: [] in the createSwarm are not recognized with a proper type
  • running yarn turbo run test --filter=./libs/langgraph-swarm by replacing createReactAgent with createReactAgent does:
@langchain/langgraph-swarm:test:
@langchain/langgraph-swarm:test:  FAIL   unit  src/swarm.test.ts > Swarm > should run in basic case
@langchain/langgraph-swarm:test: Error: Please specify a name when you create your agent, either via `createAgent({ ..., name: agentName })` or via `graph.compile({ name: agentName })`.
@langchain/langgraph-swarm:test:  ❯ createSwarm src/swarm.ts:124:13
@langchain/langgraph-swarm:test:     122|   for (const agent of agents) {
@langchain/langgraph-swarm:test:     123|     if (!agent.name || agent.name === "LangGraph") {
@langchain/langgraph-swarm:test:     124|       throw new Error(
@langchain/langgraph-swarm:test:        |             ^
@langchain/langgraph-swarm:test:     125|         "Please specify a name when you create your agent, either via `createAgent({ ..., name: agentName })` " +
@langchain/langgraph-swarm:test:     126|           "or via `graph.compile({ name: agentName })`."
@langchain/langgraph-swarm:test:  ❯ src/swarm.test.ts:146:22
@langchain/langgraph-swarm:test:
@langchain/langgraph-swarm:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

It seems langgraph-swarm (and likely supervisor) have been marked as v1 compatible without being forward compatible.

System Info

langgraph 1.0.0 (HEAD / master)

Originally created by @baptistejamin on GitHub (Oct 19, 2025). ### Checked other resources - [x] I added a very descriptive title to this issue. - [x] I searched the LangGraph.js documentation with the integrated search. - [x] I used the GitHub search to find a similar question and didn't find it. - [x] I am sure that this is a bug in LangGraph.js rather than my code. - [x] The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package). ### Example Code ``` // Create agents with handoff tools const alice = createAgent({ llm: model, tools: [add, createHandoffTool({ agentName: "Bob" })], name: "Alice", prompt: "You are Alice, an addition expert.", }); const bob = createAgent({ llm: model, tools: [ createHandoffTool({ agentName: "Alice", description: "Transfer to Alice, she can help with math", }), ], name: "Bob", prompt: "You are Bob, you speak like a pirate.", }); // Create swarm workflow const checkpointer = new MemorySaver(); const workflow = createSwarm({ agents: [alice, bob], defaultActiveAgent: "Alice", }); ``` ### Error Message and Stack Trace (if applicable) ``` @langchain/langgraph-swarm:test: FAIL unit src/swarm.test.ts > Swarm > should run in basic case @langchain/langgraph-swarm:test: Error: Please specify a name when you create your agent, either via `createAgent({ ..., name: agentName })` or via `graph.compile({ name: agentName })`. @langchain/langgraph-swarm:test: ❯ createSwarm src/swarm.ts:124:13 @langchain/langgraph-swarm:test: 122| for (const agent of agents) { @langchain/langgraph-swarm:test: 123| if (!agent.name || agent.name === "LangGraph") { @langchain/langgraph-swarm:test: 124| throw new Error( @langchain/langgraph-swarm:test: | ^ @langchain/langgraph-swarm:test: 125| "Please specify a name when you create your agent, either via `createReactAgent({ ..., name: agentName })` " + @langchain/langgraph-swarm:test: 126| "or via `graph.compile({ name: agentName })`." @langchain/langgraph-swarm:test: ❯ src/swarm.test.ts:146:22 @langchain/langgraph-swarm:test: @langchain/langgraph-swarm:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ ``` ### Description Hello, and thank you for deploying v1 :) Since createReactAgent was deprecated, I tried to replace it with a createAgent, and I noted two things: - agents: [] in the createSwarm are not recognized with a proper type - running `yarn turbo run test --filter=./libs/langgraph-swarm` by replacing createReactAgent with createReactAgent does: ``` @langchain/langgraph-swarm:test: @langchain/langgraph-swarm:test: FAIL unit src/swarm.test.ts > Swarm > should run in basic case @langchain/langgraph-swarm:test: Error: Please specify a name when you create your agent, either via `createAgent({ ..., name: agentName })` or via `graph.compile({ name: agentName })`. @langchain/langgraph-swarm:test: ❯ createSwarm src/swarm.ts:124:13 @langchain/langgraph-swarm:test: 122| for (const agent of agents) { @langchain/langgraph-swarm:test: 123| if (!agent.name || agent.name === "LangGraph") { @langchain/langgraph-swarm:test: 124| throw new Error( @langchain/langgraph-swarm:test: | ^ @langchain/langgraph-swarm:test: 125| "Please specify a name when you create your agent, either via `createAgent({ ..., name: agentName })` " + @langchain/langgraph-swarm:test: 126| "or via `graph.compile({ name: agentName })`." @langchain/langgraph-swarm:test: ❯ src/swarm.test.ts:146:22 @langchain/langgraph-swarm:test: @langchain/langgraph-swarm:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ ``` It seems langgraph-swarm (and likely supervisor) have been marked as v1 compatible without being forward compatible. ### System Info langgraph 1.0.0 (HEAD / master)
Author
Owner

@MartijnLeplae commented on GitHub (Oct 29, 2025):

@baptistejamin , seems like in the v1, the concept of using a supervisor seems to be simplified now when looking at the docs: https://docs.langchain.com/oss/python/langchain/supervisor & https://docs.langchain.com/oss/python/langchain/multi-agent. It can't seem to find mentions of swarm.

The way the original supervisor was implemented (with handoffs), does seem to lack docs at this moment for v1: https://docs.langchain.com/oss/python/langchain/multi-agent#handoffs

@MartijnLeplae commented on GitHub (Oct 29, 2025): @baptistejamin , seems like in the v1, the concept of using a supervisor seems to be simplified now when looking at the docs: https://docs.langchain.com/oss/python/langchain/supervisor & https://docs.langchain.com/oss/python/langchain/multi-agent. It can't seem to find mentions of swarm. The way the original supervisor was implemented (with handoffs), does seem to lack docs at this moment for v1: https://docs.langchain.com/oss/python/langchain/multi-agent#handoffs
Author
Owner

@davidgovea commented on GitHub (Nov 18, 2025):

Also experiencing this with createSupervisor

@davidgovea commented on GitHub (Nov 18, 2025): Also experiencing this with createSupervisor
Author
Owner

@davidgovea commented on GitHub (Nov 19, 2025):

The Swarm readme says:

This library has been updated to support LangChain 1.0. However, it has not been tested with the new agents in langchain. The library currently only supports the prebuilt createReactAgent from LangGraph. This update allows users to migrate to LangChain 1.0 without changing their existing code. For users of the swarm package, we recommend continuing to use createReactAgent rather than the new createAgent pattern from LangChain for now.

There is no such warning in supervisor. With swarm, it looks like the auto-handoff process needs to be implemented, but supervisor is pretty simple.

Thinking about a little shim:

createSupervisor({
  agents: agents.map(toLegacyLangGraphAgent), // returns agent.graph with shimmed name
  ...

Seems like it works, typescript satisfied.

I appreciate the backwards-compat attention, but I didn't want this to -prevent- us from upgrading right away.

@davidgovea commented on GitHub (Nov 19, 2025): The [Swarm readme](https://github.com/langchain-ai/langgraphjs/blob/1c1e7337d1671ef1b10cfbd34f8bbd4b06add2de/libs/langgraph-swarm/README.md?plain=1#L8) says: > This library has been updated to support LangChain 1.0. However, it has **not** been tested with the new agents in `langchain`. The library currently only supports the prebuilt `createReactAgent` from LangGraph. This update allows users to migrate to LangChain 1.0 without changing their existing code. For users of the swarm package, we recommend continuing to use `createReactAgent` rather than the new `createAgent` pattern from LangChain for now. There is no such warning in supervisor. With swarm, it looks like the auto-handoff process needs to be implemented, but supervisor is pretty simple. Thinking about a little shim: ```ts createSupervisor({ agents: agents.map(toLegacyLangGraphAgent), // returns agent.graph with shimmed name ... ``` Seems like it works, typescript satisfied. I appreciate the backwards-compat attention, but I didn't want this to -prevent- us from upgrading right away.
Author
Owner

@MartijnLeplae commented on GitHub (Nov 19, 2025):

@davidgovea , the swarm readme seems somewhat confusing. They mention in the note to use createReactAgent, but the code examples provided in that same readme use the newer createAgent.
https://github.com/langchain-ai/langgraphjs/blob/main/libs/langgraph-swarm/README.md#quickstart

Did you test if the examples there work? I might look at it if I have time.

@MartijnLeplae commented on GitHub (Nov 19, 2025): @davidgovea , the swarm readme seems somewhat confusing. They mention in the note to use createReactAgent, but the code examples provided in that same readme use the newer createAgent. https://github.com/langchain-ai/langgraphjs/blob/main/libs/langgraph-swarm/README.md#quickstart Did you test if the examples there work? I might look at it if I have time.
Author
Owner

@davidgovea commented on GitHub (Nov 19, 2025):

We don't use swarm. Have not run the examples.

Went through an exercise of making langgraph-supervisor accept both new and old style agent inputs:

But, in the end, the shim is simple enough. Not sure for swarm though - needs handoff handling

Here's the toLegacyLangGraphAgent transform I used
/**
 * Converts a LangChain v1 createAgent output (ReactAgent-style wrapper)
 * into a format compatible with the legacy createSupervisor.
 *
 * Rationale:
 * 1. Extracts the underlying executable graph which satisfies the Runnable interface.
 * 2. Hoists the 'name' and 'description' from the wrapper's options onto the graph object
 *    itself, as the legacy supervisor expects these properties to be direct attributes.
 */
function toLegacyLangGraphAgent(agent: {
  graph: CompiledStateGraph<any, any, any, any, any>;
  invoke: unknown;
  name?: string;
  description?: string;
  options?: { name?: string; description?: string };
}) {
  const graph = agent.graph;

  // Prioritize explicit name/description on the wrapper, then options, then fallback to existing graph props
  // We cast to 'any' to allow assignment if the type definition is strictly readonly
  (graph as any).name = agent.name ?? agent.options?.name ?? graph.name;
  (graph as any).description = agent.description ?? agent.options?.description;

  if (!graph.name || graph.name === 'LangGraph') {
    throw new Error(
      "Agent must have a valid name. Provide one via createAgent({ ..., name: 'agentName' }).",
    );
  }

  return graph;
}
@davidgovea commented on GitHub (Nov 19, 2025): We don't use swarm. Have not run the examples. Went through an exercise of making `langgraph-supervisor` accept both new and old style agent inputs: * https://github.com/davidgovea/langgraphjs/pull/1 But, in the end, the shim is simple enough. Not sure for swarm though - needs handoff handling <details><summary>Here's the toLegacyLangGraphAgent transform I used</summary> ```ts /** * Converts a LangChain v1 createAgent output (ReactAgent-style wrapper) * into a format compatible with the legacy createSupervisor. * * Rationale: * 1. Extracts the underlying executable graph which satisfies the Runnable interface. * 2. Hoists the 'name' and 'description' from the wrapper's options onto the graph object * itself, as the legacy supervisor expects these properties to be direct attributes. */ function toLegacyLangGraphAgent(agent: { graph: CompiledStateGraph<any, any, any, any, any>; invoke: unknown; name?: string; description?: string; options?: { name?: string; description?: string }; }) { const graph = agent.graph; // Prioritize explicit name/description on the wrapper, then options, then fallback to existing graph props // We cast to 'any' to allow assignment if the type definition is strictly readonly (graph as any).name = agent.name ?? agent.options?.name ?? graph.name; (graph as any).description = agent.description ?? agent.options?.description; if (!graph.name || graph.name === 'LangGraph') { throw new Error( "Agent must have a valid name. Provide one via createAgent({ ..., name: 'agentName' }).", ); } return graph; } ``` </details>
Author
Owner

@Aitosoft commented on GitHub (Nov 20, 2025):

This looks like a Python parity issue. The LangChain 1.0 announcement explicitly states:

“The best part? LangChain agents are built on LangGraph, so you're not locked in. Start with LangChain's high-level APIs and seamlessly drop down to LangGraph when you need more control. Since graphs are composable, you can mix both approaches—using agents created with create_agent inside custom LangGraph workflows as your needs evolve.”

In Python LangGraph:
create_react_agent() returns an object that works directly with all LangGraph composition APIs—you can pass it to create_swarm(agents=[...]), StateGraph.add_node(), etc. No unwrapping or shims needed.

In JavaScript LangGraph:
createAgent() returns a ReactAgent wrapper that is incompatible with StateGraph.addNode() (see #1767) and with helper packages like langgraph-swarm and langgraph-supervisor (this issue).

This isn’t just about helper packages. It blocks the core composition pattern that makes LangGraph valuable: starting with simple agents and composing them into more complex workflows as needs grow.

@Aitosoft commented on GitHub (Nov 20, 2025): This looks like a Python parity issue. The LangChain 1.0 announcement explicitly states: > “The best part? LangChain agents are built on LangGraph, so you're not locked in. Start with LangChain's high-level APIs and seamlessly drop down to LangGraph when you need more control. Since graphs are composable, you can mix both approaches—using agents created with create_agent inside custom LangGraph workflows as your needs evolve.” **In Python LangGraph:** create_react_agent() returns an object that works directly with all LangGraph composition APIs—you can pass it to create_swarm(agents=[...]), StateGraph.add_node(), etc. No unwrapping or shims needed. **In JavaScript LangGraph:** `createAgent()` returns a `ReactAgent` wrapper that is incompatible with `StateGraph.addNode()` (see #1767) and with helper packages like `langgraph-swarm` and `langgraph-supervisor` (this issue). This isn’t just about helper packages. It blocks the core composition pattern that makes LangGraph valuable: starting with simple agents and composing them into more complex workflows as needs grow.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#370