Skip to content

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

@baptistejamin

Description

@baptistejamin

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)

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