Missing tools 'tool_name' in the model.bindTools().Tools in the model.bindTools() must match the tools passed to createReactAgent. #182

Closed
opened 2026-02-15 17:16:54 -05:00 by yindo · 3 comments
Owner

Originally created by @subeshb1 on GitHub (Mar 2, 2025).

Description

The langchain/langgraph-supervisor@0.0.6 isn't working with ChatBedrockConverse

Error logs

file:///Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph/dist/prebuilt/react_agent_executor.js:101
        throw new Error(`Missing tools '${missingTools}' in the model.bindTools().` +
              ^

Error: Missing tools 'transfer_to_codingagent,transfer_to_researchagent' in the model.bindTools().Tools in the model.bindTools() must match the tools passed to createReactAgent.
    at _shouldBindTools (/Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:197:9)
    at createReactAgent (/Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:413:5)
    at createSupervisor (/Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph-supervisor/src/supervisor.ts:180:27)
    at createSkillSupervisor (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/core/factory.ts:49:22)
    at <anonymous> (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/core/factory.ts:75:7)
    at Array.map (<anonymous>)
    at createSupervisorSystem (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/core/factory.ts:73:42)
    at createSupervisorMultiAgentSystem (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/index.ts:60:10)
    at <anonymous> (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/index.ts:64:22)
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25)

Node.js v22.13.0

Replication steps


import { ChatBedrockConverse } from '@langchain/aws';
import { createSupervisor } from "@langchain/langgraph-supervisor";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { tool } from "@langchain/core/tools";
import { z } from "zod";

const model = new ChatBedrockConverse({
    model: options.modelName || "anthropic.claude-3-sonnet-20240229-v1:0",
    region: options.region || DEFAULT_REGION,
    streaming: options.streaming ?? true,
  })

// Create specialized agents
const add = tool(
  async (args) => args.a + args.b,
  {
    name: "add",
    description: "Add two numbers.",
    schema: z.object({
      a: z.number(),
      b: z.number()
    })
  }
);

const multiply = tool(
  async (args) => args.a * args.b,
  {
    name: "multiply", 
    description: "Multiply two numbers.",
    schema: z.object({
      a: z.number(),
      b: z.number()
    })
  }
);

const webSearch = tool(
  async (args) => {
    return (
      "Here are the headcounts for each of the FAANG companies in 2024:\n" +
      "1. **Facebook (Meta)**: 67,317 employees.\n" +
      "2. **Apple**: 164,000 employees.\n" +
      "3. **Amazon**: 1,551,000 employees.\n" +
      "4. **Netflix**: 14,000 employees.\n" +
      "5. **Google (Alphabet)**: 181,269 employees."
    );
  },
  {
    name: "web_search",
    description: "Search the web for information.",
    schema: z.object({
      query: z.string()
    })
  }
);

const mathAgent = createReactAgent({
  llm: model,
  tools: [add, multiply],
  name: "math_expert",
  prompt: "You are a math expert. Always use one tool at a time."
});

const researchAgent = createReactAgent({
  llm: model,
  tools: [webSearch],
  name: "research_expert",
  prompt: "You are a world class researcher with access to web search. Do not do any math."
});

// Create supervisor workflow
const workflow = createSupervisor({
  agents: [researchAgent, mathAgent],
  llm: model,
  prompt: 
    "You are a team supervisor managing a research expert and a math expert. " +
    "For current events, use research_agent. " +
    "For math problems, use math_agent."
});

// Compile and run
const app = workflow.compile();
const result = await app.invoke({
  messages: [
    {
      role: "user",
      content: "what's the combined headcount of the FAANG companies in 2024??"
    }
  ]
});
Originally created by @subeshb1 on GitHub (Mar 2, 2025). ## Description The `langchain/langgraph-supervisor@0.0.6` isn't working with ChatBedrockConverse ## Error logs ``` file:///Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph/dist/prebuilt/react_agent_executor.js:101 throw new Error(`Missing tools '${missingTools}' in the model.bindTools().` + ^ Error: Missing tools 'transfer_to_codingagent,transfer_to_researchagent' in the model.bindTools().Tools in the model.bindTools() must match the tools passed to createReactAgent. at _shouldBindTools (/Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:197:9) at createReactAgent (/Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:413:5) at createSupervisor (/Users/subesh.bhandari/supervisor-agent/node_modules/@langchain/langgraph-supervisor/src/supervisor.ts:180:27) at createSkillSupervisor (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/core/factory.ts:49:22) at <anonymous> (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/core/factory.ts:75:7) at Array.map (<anonymous>) at createSupervisorSystem (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/core/factory.ts:73:42) at createSupervisorMultiAgentSystem (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/index.ts:60:10) at <anonymous> (/Users/subesh.bhandari/supervisor-agent/agents/src/mas/index.ts:64:22) at ModuleJob.run (node:internal/modules/esm/module_job:271:25) Node.js v22.13.0 ``` ## Replication steps ```ts import { ChatBedrockConverse } from '@langchain/aws'; import { createSupervisor } from "@langchain/langgraph-supervisor"; import { createReactAgent } from "@langchain/langgraph/prebuilt"; import { tool } from "@langchain/core/tools"; import { z } from "zod"; const model = new ChatBedrockConverse({ model: options.modelName || "anthropic.claude-3-sonnet-20240229-v1:0", region: options.region || DEFAULT_REGION, streaming: options.streaming ?? true, }) // Create specialized agents const add = tool( async (args) => args.a + args.b, { name: "add", description: "Add two numbers.", schema: z.object({ a: z.number(), b: z.number() }) } ); const multiply = tool( async (args) => args.a * args.b, { name: "multiply", description: "Multiply two numbers.", schema: z.object({ a: z.number(), b: z.number() }) } ); const webSearch = tool( async (args) => { return ( "Here are the headcounts for each of the FAANG companies in 2024:\n" + "1. **Facebook (Meta)**: 67,317 employees.\n" + "2. **Apple**: 164,000 employees.\n" + "3. **Amazon**: 1,551,000 employees.\n" + "4. **Netflix**: 14,000 employees.\n" + "5. **Google (Alphabet)**: 181,269 employees." ); }, { name: "web_search", description: "Search the web for information.", schema: z.object({ query: z.string() }) } ); const mathAgent = createReactAgent({ llm: model, tools: [add, multiply], name: "math_expert", prompt: "You are a math expert. Always use one tool at a time." }); const researchAgent = createReactAgent({ llm: model, tools: [webSearch], name: "research_expert", prompt: "You are a world class researcher with access to web search. Do not do any math." }); // Create supervisor workflow const workflow = createSupervisor({ agents: [researchAgent, mathAgent], llm: model, prompt: "You are a team supervisor managing a research expert and a math expert. " + "For current events, use research_agent. " + "For math problems, use math_agent." }); // Compile and run const app = workflow.compile(); const result = await app.invoke({ messages: [ { role: "user", content: "what's the combined headcount of the FAANG companies in 2024??" } ] }); ```
yindo added the langgraph-supervisor label 2026-02-15 17:16:54 -05:00
yindo closed this issue 2026-02-15 17:16:54 -05:00
Author
Owner

@subeshb1 commented on GitHub (Mar 2, 2025):

Here's my attempt for the fix
https://github.com/langchain-ai/langgraphjs/pull/922

@subeshb1 commented on GitHub (Mar 2, 2025): Here's my attempt for the fix https://github.com/langchain-ai/langgraphjs/pull/922
Author
Owner

@HarshavardhanNetha commented on GitHub (Mar 3, 2025):

It's the same case with Google chat models.
Facing Error: Number of tools in the model.bindTools() and tools passed to createReactAgent must match

@HarshavardhanNetha commented on GitHub (Mar 3, 2025): It's the same case with Google chat models. Facing `Error: Number of tools in the model.bindTools() and tools passed to createReactAgent must match`
Author
Owner

@vbarda commented on GitHub (Mar 4, 2025):

@HarshavardhanNetha made a fix to your issue here https://github.com/langchain-ai/langgraphjs/pull/940/files

@vbarda commented on GitHub (Mar 4, 2025): @HarshavardhanNetha made a fix to your issue here https://github.com/langchain-ai/langgraphjs/pull/940/files
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#182