Framework · LangChain Inc.
LangGraph en bref
La bibliothèque bas niveau de LangChain pour créer des agents sous forme de graphes explicites, avec l'état sauvegardé à des points de reprise et les interruptions au cœur du système. create_agent de LangChain v1 s'appuie dessus lorsqu'une boucle préconstruite suffit.
Idéal pour : Les agents persistants et avec état, lorsque vous voulez contrôler chaque étape et reprendre l'exécution après une défaillance.
Informations clés
- Mainteneur
- LangChain Inc.
- Langages
- Python, TypeScript, JavaScript
- Licence
- MIT
- Dernière version
langgraph 1.2.12 / langchain 1.4.3· 28 septembre 2026- Dépôt
- langchain-ai/langgraph
- Option hébergée
- LangSmith Deployment (formerly LangGraph Platform)
Démarrage rapide
Installez le package, configurez vos identifiants, puis lancez l’agent le plus simple présenté dans la documentation officielle. Les ID de modèle utilisés sont ceux de la documentation et ne sont pas forcément activés sur votre compte.
Python (LangChain create_agent)
pip install -U langchainfrom langchain.agents import create_agent
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"It's always sunny in {city}!"
agent = create_agent(
model="openai:gpt-5.5",
tools=[get_weather],
system_prompt="You are a helpful assistant",
)
result = agent.invoke(
{"messages": [{"role": "user", "content": "What's the weather in San Francisco?"}]}
)
print(result["messages"][-1].content_blocks)Python (raw LangGraph)
pip install -U langgraphfrom langgraph.graph import StateGraph, MessagesState, START, END
def mock_llm(state: MessagesState):
return {"messages": [{"role": "ai", "content": "hello world"}]}
graph = StateGraph(MessagesState)
graph.add_node(mock_llm)
graph.add_edge(START, "mock_llm")
graph.add_edge("mock_llm", END)
graph = graph.compile()
graph.invoke({"messages": [{"role": "user", "content": "hi!"}]})Fonctionnalités
| Tous les modèles | Oui | |
|---|---|---|
| Client MCP | Oui | Via langchain-mcp-adapters |
| Serveur MCP | Non confirmé | |
| Multi-agent | Oui | Sous-graphes ; le harness Deep Agents ajoute des sous-agents |
| Exécutions durables | Oui | Checkpointers pour Postgres ou SQLite ; reprise après une défaillance |
| Approbation humaine | Oui | Les interruptions permettent d’inspecter et de modifier l’état en cours d’exécution |
| Traçage | Oui | Via LangSmith, avec LANGSMITH_TRACING=true |
| Évaluations | Non | L’évaluation est gérée dans LangSmith, pas dans la bibliothèque open source |
Modifications récentes
- Les agents LangChain v1 (create_agent) reposent désormais sur LangGraph.
- LangGraph Platform a été renommé LangSmith Deployment.
- Deep Agents, un harness basé sur LangGraph, ajoute des sous-agents.