Firecrawl + LangGraph
Add Firecrawl web search and scraping to LangGraph agents.
Give stateful AI agents live web results through a tool they call when a question needs it.
companies of all sizes
Key Features
How do I add web search to a LangGraph agent?
To add web search to a LangGraph agent, give the model the Firecrawl search tool from the langchain-firecrawl package and route its tool calls through a ToolNode. The agent decides when to search, Firecrawl returns titles, URLs and descriptions from the live web, and the graph loops until the model has an answer.
Install the packages
Install LangGraph, the official Firecrawl package for LangChain, and a chat model provider. Set FIRECRAWL_API_KEY from your Firecrawl dashboard and the key for your model provider.
pip install -U langgraph langchain-firecrawl langchain-openai
export FIRECRAWL_API_KEY="fc-YOUR-API-KEY"
export OPENAI_API_KEY="sk-YOUR-API-KEY"Create the Firecrawl search tool
FirecrawlSearch is a LangChain tool that calls the Firecrawl search API, so LangGraph can bind it to any chat model that supports tool calling. The model passes a query and an optional result limit.
from langchain_firecrawl import FirecrawlSearch
search = FirecrawlSearch()
tools = [search]
print(search.invoke({"query": "LangGraph latest release", "limit": 3}))Build the graph
The agent node calls the model. tools_condition sends any tool call to the ToolNode, which runs the Firecrawl search and hands the results back to the model.
from langchain_openai import ChatOpenAI
from langgraph.graph import StateGraph, MessagesState, START
from langgraph.prebuilt import ToolNode, tools_condition
llm = ChatOpenAI(model="gpt-6-luna").bind_tools(tools)
def agent(state: MessagesState):
return {"messages": [llm.invoke(state["messages"])]}
graph = StateGraph(MessagesState)
graph.add_node("agent", agent)
graph.add_node("tools", ToolNode(tools))
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", tools_condition)
graph.add_edge("tools", "agent")
app = graph.compile()Ask a question that needs the web
The search tool runs only when the model asks for it. Questions about recent releases, prices or news trigger a Firecrawl search, and the model can cite the URLs it got back.
result = app.invoke(
{"messages": [{"role": "user", "content": "What changed in the latest LangGraph release? Cite your sources."}]}
)
print(result["messages"][-1].content)People love
building with Firecrawl











Firecrawl is an open-source framework that takes a URL, crawls it, and conver..."

Upload a CSV of emails and..."



Firecrawl is an open-source framework that takes a URL, crawls it, and conver..."

Upload a CSV of emails and..."
Tutorials & guides
How to Build a Web Scraping Agent With LangGraph and Firecrawl
Build a LangGraph agent that scrapes pages with Firecrawl and decides what to read next.
Read tutorial →Turn Any Documentation Site Into an AI Agent with LangGraph and Firecrawl
Crawl a documentation site with Firecrawl and answer questions about it with a LangGraph agent.
Read tutorial →LangGraph Tutorial: Build a Startup Idea Validator with Interactive UI
Learn how to create a powerful startup validation agent using LangGraph's agent framework with a responsive Streamlit interface.
Read tutorial →Frequently
asked questions
Flexible pricing
Free Plan
Hobby
StandardMost popular
Growth
Scale Plans
High-volume plans for teams that need more power and dedicated support. Get access to higher rate limits, more concurrent browsers, and priority support. Scale checks out instantly, no sales call needed.
Need more? Contact usAlso on AWS Marketplace and Google Cloud Marketplace.

















