Registry / llm-agents / langgraph-prebuilt

langgraph-prebuilt

JSON →
library1.1.0pypypi✓ verified 8d ago

LangGraph Prebuilt is a Python library offering high-level APIs for creating and executing LangGraph agents and tools. It simplifies building complex agentic workflows by providing pre-packaged components and architectures, reducing the need for low-level graph construction. Currently at version 1.0.8, this library is part of the broader LangGraph ecosystem, which undergoes frequent updates, with `langgraph-prebuilt` releases typically aligning with major feature additions to its high-level components. [2, 18]

pip install langgraph-prebuilt langchain-openai tavily-python
INSTALL
IMPORT
SIG · LANGGRAPH-PREBUILT
L
langgraph-prebuilt
llm-agentspythonv1.1.0
Install
10.2s avg
Import
Disk
104MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 101.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 10.2s · import 0.000s · 109MB
104MB installed
● package 104MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

create_react_agent
from langgraph.prebuilt import create_react_agent
ToolNode
from langgraph.prebuilt import ToolNode
tools_condition
from langgraph.prebuilt import tools_condition
MessagesState
from langgraph.graph import MessagesState
from langgraph.prebuilt import MessagesState
MessagesState is part of the core langgraph graph module, not prebuilt.

This quickstart demonstrates how to set up and use `create_react_agent` from `langgraph-prebuilt`. It initializes an OpenAI LLM, a Tavily search tool, and then creates an agent capable of using these tools. The agent is then invoked with a query, showcasing its ability to use tools for information retrieval and simple calculations. Ensure `OPENAI_API_KEY` and `TAVILY_API_KEY` are set in your environment for the example to run. [8, 13]

import os from langchain_openai import ChatOpenAI from langchain_community.tools.tavily_search import TavilySearchResults from langgraph.prebuilt import create_react_agent from typing import Annotated, Sequence, TypedDict from langchain_core.messages import BaseMessage # Set API keys (replace with actual keys or set as environment variables) os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "YOUR_OPENAI_API_KEY") os.environ["TAVILY_API_KEY"] = os.environ.get("TAVILY_API_KEY", "YOUR_TAVILY_API_KEY") # Define the agent state (LangGraph requires a defined state) class AgentState(TypedDict): messages: Annotated[Sequence[BaseMessage], lambda x, y: x + y] # Initialize LLM and tools llm = ChatOpenAI(model="gpt-4o-mini") # or any other tool-calling capable LLM search_tool = TavilySearchResults(max_results=3) tools = [search_tool] # Create the prebuilt ReAct agent agent_executor = create_react_agent(llm, tools=tools) # Example usage # Ensure OPENAI_API_KEY and TAVILY_API_KEY are set if os.environ["OPENAI_API_KEY"] == "YOUR_OPENAI_API_KEY" or os.environ["TAVILY_API_KEY"] == "YOUR_TAVILY_API_KEY": print("Please set OPENAI_API_KEY and TAVILY_API_KEY environment variables or replace placeholders.") else: response = agent_executor.invoke( {"messages": [("human", "What is the weather in London and what is 123 + 456?")]} ) print(response["messages"][-1].content)
Debug
Known issues
gotchaLangGraph is a low-level framework, while `langgraph-prebuilt` offers higher-level abstractions. Mixing low-level graph construction (e.g., `StateGraph`, `add_node`) with prebuilt agents (like `create_react_agent`) without understanding LangGraph's state management can lead to unexpected behavior or difficult-to-debug issues. Stick to one paradigm or thoroughly understand how state is managed across both. [3, 5, 6]
fix
For complex customizations, consider extending or modifying the prebuilt agent's internal graph if the documentation provides a clear path, or build a custom graph from scratch using `langgraph.graph.StateGraph` for full control. For simpler cases, leverage the provided prebuilt agent parameters and hooks. Consult the official LangGraph documentation for advanced patterns. [5, 8, 9]
affects: All versions
gotchaPrebuilt agents often rely on external services (LLMs, search tools). Failing to set required API keys as environment variables (e.g., `OPENAI_API_KEY`, `TAVILY_API_KEY`) or passing incorrect values will cause agents to fail silently or with authentication errors. [1, 6, 13]
fix
Always verify that all necessary API keys are correctly set in your environment or explicitly passed to the respective LLM/tool constructors before running the agent. Test credentials independently if an agent is failing. Use a `.env` file and `python-dotenv` for local development. [1, 6]
affects: All versions
deprecatedThe LangGraph ecosystem, including `langgraph-prebuilt`, is actively developed. Older patterns for agents or tool integration, while functional, might be superseded by more efficient, flexible, or recommended approaches in newer releases. [7]
fix
Regularly consult the official LangChain/LangGraph documentation and quickstarts for the latest recommended practices and agent architectures. Pay attention to release notes for potential API changes or new high-level abstractions. [1, 7, 10]
affects: Versions <= 1.0.8, potentially future versions
gotchaThe `langchain_community` package, which provides various tools and utilities (e.g., `TavilySearchResults`), is a common dependency for agents utilizing external services. If it's not explicitly installed, importing modules from it will result in a `ModuleNotFoundError`.
fix
Ensure `langchain_community` is listed in your project's `requirements.txt` or explicitly installed via `pip install langchain-community` in your environment before running agents that rely on it. Verify your environment setup, especially in containerized or CI/CD contexts, to ensure all necessary dependencies are installed.
affects: All versions
breakingA `ModuleNotFoundError` for packages like `langchain_community` indicates that required dependencies are not installed in the execution environment. Prebuilt agents and tools often rely on specific packages that must be explicitly added.
fix
Ensure all necessary Python packages are installed in the environment. This typically involves running `pip install <package_name>` for each required package, or using `pip install -r requirements.txt` if a `requirements.txt` file is present. Verify that the correct virtual environment is activated if applicable.
affects: All versions
Upgrade
Version history
1.1.0latest on PyPI · released May 12, 2026
Audit
Dependencies
langgraphrequiredCore orchestration framework upon which prebuilt agents are built.
langchain-openaioptionalCommon LLM integration for agent models.
tavily-pythonoptionalCommon tool integration for search functionality.
pydanticoptionalUsed for defining state and output schemas.
Agent activity
32 hits · last 30 days
node
30
Amazon
1
Resources
langgraph-prebuilt — pip install langgraph-prebuilt · libregistry