Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.agno.com/llms.txt

Use this file to discover all available pages before exploring further.

LangGraphAgent wraps a compiled LangGraph graph so it can be served through AgentOS or used standalone.
from agno.agents.langgraph import LangGraphAgent
from agno.db.sqlite import SqliteDb
from agno.os import AgentOS
from langchain_openai import ChatOpenAI
from langgraph.graph import MessagesState, StateGraph


def chatbot(state: MessagesState):
    return {"messages": [ChatOpenAI(model="gpt-5.4").invoke(state["messages"])]}


graph = StateGraph(MessagesState)
graph.add_node("chatbot", chatbot)
graph.set_entry_point("chatbot")
compiled = graph.compile()

agent = LangGraphAgent(
    name="LangGraph Chatbot",
    graph=compiled,
)

agent_os = AgentOS(
    agents=[agent],
    tracing=True,
    db=SqliteDb(db_file="tmp/agentos.db"),
)
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="langgraph_agent:app", reload=True)

Install

uv pip install langgraph langchain-openai
export OPENAI_API_KEY=sk-...

Parameters

ParameterTypeDefaultDescription
namestrNoneDisplay name for the agent.
idstrNoneUnique identifier. Auto-generated from name if unset.
graphCompiledGraphNoneCompiled LangGraph graph (graph.compile()).
input_keystr"messages"Key in the graph state used for input messages.
output_keystr"messages"Key in the graph state used for output messages.
configDict[str, Any]NoneOptional LangGraph config dict passed to invoke / stream.
dbBaseDbNoneDatabase for session persistence.

Examples

AgentOS deployment

Serve a compiled LangGraph through AgentOS.

Standalone usage

Call the agent directly with .run() and .print_response().

Graphs with tools

Tool nodes that surface as Agno tool events.

Sessions

Resume conversations across runs with session_id.

Time travel

Replay and fork runs from LangGraph checkpoints.

Developer Resources