How to set tool_calling_parallel when using langgraph-swarm? #197

Closed
opened 2026-02-15 17:17:10 -05:00 by yindo · 5 comments
Owner

Originally created by @shwarcu on GitHub (Mar 11, 2025).

There is information that parallel tool calling can be disabled https://js.langchain.com/docs/how_to/tool_calling_parallel/

but when using swarm, invoke method is hidden behind abstraction. Is there a way to disable tool parallel calling when using swarm?
When two tools are called it results with an error when using swarm. Here is an example from my playground

Image
Originally created by @shwarcu on GitHub (Mar 11, 2025). There is information that parallel tool calling can be disabled https://js.langchain.com/docs/how_to/tool_calling_parallel/ but when using swarm, invoke method is hidden behind abstraction. Is there a way to disable tool parallel calling when using [swarm](https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-swarm)? When two tools are called it results with an error when using swarm. Here is an example from my playground <img width="822" alt="Image" src="https://github.com/user-attachments/assets/6aa07b47-64a6-42b0-a30f-0a1d3d9e15b0" />
yindo added the docs-needed label 2026-02-15 17:17:10 -05:00
yindo closed this issue 2026-02-15 17:17:10 -05:00
Author
Owner

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

you can disable it on a model passed to the agent via llm.bindTools(allTools, { parallel_tool_calls: false }). note that at the moment only OpenAI integration supports this

@vbarda commented on GitHub (Mar 11, 2025): you can disable it on a model passed to the agent via `llm.bindTools(allTools, { parallel_tool_calls: false })`. note that at the moment only OpenAI integration supports this
Author
Owner

@shwarcu commented on GitHub (Mar 12, 2025):

you can disable it on a model passed to the agent via llm.bindTools(allTools, { parallel_tool_calls: false }). note that at the moment only OpenAI integration supports this

so if I'm using createReactAgent function there is no way to set it? Like in the example from quickstart https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-swarm#quickstart

@shwarcu commented on GitHub (Mar 12, 2025): > you can disable it on a model passed to the agent via `llm.bindTools(allTools, { parallel_tool_calls: false })`. note that at the moment only OpenAI integration supports this so if I'm using `createReactAgent` function there is no way to set it? Like in the example from quickstart https://github.com/langchain-ai/langgraphjs/tree/main/libs/langgraph-swarm#quickstart
Author
Owner

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

there is, like this

createReactAgent({ llm: llm.bindTools(allTools, { parallel_tool_calls: false })., ...}

@vbarda commented on GitHub (Mar 13, 2025): there is, like this `createReactAgent({ llm: llm.bindTools(allTools, { parallel_tool_calls: false })., ...}`
Author
Owner

@benjamincburns commented on GitHub (Mar 13, 2025):

Closing this as answered - added docs-needed label so we can look at this later in the context of how to improve docs around this concern.

@benjamincburns commented on GitHub (Mar 13, 2025): Closing this as answered - added `docs-needed` label so we can look at this later in the context of how to improve docs around this concern.
Author
Owner

@postbird commented on GitHub (Jun 17, 2025):

there is, like this

createReactAgent({ llm: llm.bindTools(allTools, { parallel_tool_calls: false })., ...}

Does it still work now?

I am getting the issue with below:

Error: llm [object Object] must define bindTools method.
    at getModelRunnable (.pnpm/@langchain+langgraph@0.3.0_@langchain+core@0.3.57/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:573:11)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async RunnableCallable.callModel [as func] (.pnpm/@langchain+langgraph@0.3.0_@langchain+core@0.3.57/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:655:25) {
  pregelTaskId: '6f65019b-e2e0-503d-b9d7-ab7bfe0f513c'
}

My code

  const agent = createReactAgent({
    llm: model.bindTools([weatherTool], { parallel_tool_calls: false }),
    tools: [weatherTool],
    prompt:
      'You are a good assistant, you can use tool and reply to user, but you can only use English to reply',
    checkpointSaver: LANGGRAPH_MEMORY_SAVER,
  });

  this.printAgent(agent);

  return agent;
  
@postbird commented on GitHub (Jun 17, 2025): > there is, like this > > `createReactAgent({ llm: llm.bindTools(allTools, { parallel_tool_calls: false })., ...}` Does it still work now? I am getting the issue with below: ```ts Error: llm [object Object] must define bindTools method. at getModelRunnable (.pnpm/@langchain+langgraph@0.3.0_@langchain+core@0.3.57/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:573:11) at processTicksAndRejections (node:internal/process/task_queues:95:5) at async RunnableCallable.callModel [as func] (.pnpm/@langchain+langgraph@0.3.0_@langchain+core@0.3.57/node_modules/@langchain/langgraph/src/prebuilt/react_agent_executor.ts:655:25) { pregelTaskId: '6f65019b-e2e0-503d-b9d7-ab7bfe0f513c' } ``` My code ```ts const agent = createReactAgent({ llm: model.bindTools([weatherTool], { parallel_tool_calls: false }), tools: [weatherTool], prompt: 'You are a good assistant, you can use tool and reply to user, but you can only use English to reply', checkpointSaver: LANGGRAPH_MEMORY_SAVER, }); this.printAgent(agent); return agent; ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#197