Skip to content

OpenAI builtin tool web_search is not working in the createAgent #9054

@arbazalam01

Description

@arbazalam01

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.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 LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

import {
AgentState,
createAgent,
createMiddleware,
HumanMessage,
ToolNode,
} from "langchain";
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({
modelName: "gpt-5-mini-2025-08-07",
apiKey: env.openai.apiKey,
});

const researcherAgent = createAgent({
llm: model,
tools: [{ name: "web_search", type: "web_search" }],
prompt: research_system_prompt(getTodayStr()),
});

Error Message and Stack Trace (if applicable)

throw new UnreachableNodeError(
^

UnreachableNodeError: Node tools is not reachable.

If you are returning Command objects from your node,
make sure you are passing names of potential destination nodes as an "ends" array
into ".addNode(..., { ends: ["node1", "node2"] })".

Description

I'm trying to use the openai built-in web search tool, but it's throwing an error

System Info

"@langchain/core": "1.0.0-alpha.5"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions