mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-05 09:17:47 +02:00
2.9 KiB
2.9 KiB
How-to guides
Welcome to the LangGraph how-to guides! These guides provide practical, step-by-step instructions for accomplishing key tasks in LangGraph.
Core
The core guides show how to address common needs when building out AI workflows, with special focus placed on ReAct-style agents with tool calling.
- ReAct agent: How to create a tool-calling agent that Reasons and Acts to accomplish tasks
- Persistence: How to give your graph "memory" and resilience by saving and loading state
- Time travel: How to navigate and manipulate graph state history once it's persisted
- Async execution: How to run nodes asynchronously for improved performance
- Streaming responses: How to stream agent responses in real-time
- Visualization: How to visualize your graphs
- Configuration: How to indicate that a graph can swap out configurable components
Design patterns
Recipes showing how to apply common design patterns in your workflows:
- Subgraphs: How to compose subgraphs within a larger graph
- Branching: How to create branching logic in your graphs for parallel node execution
- Map-reduce: How to branch different views of the state for parallel node execution (even applying the same node in parallel N times)
- Human-in-the-loop: How to incorporate human feedback and intervention
The following examples are useful especially if you are used to LangChain's AgentExecutor configurations.
- Force calling a tool first: Define a fixed workflow before ceding control to the ReAct agent
- Pass run time values to tools: Pass values that are only known at run time to tools (e.g., the ID of the user who made the request)
- Dynamic direct return: Let the LLM decide whether the graph should finish after a tool is run or whether the LLM should be able to review the output and keep going
- Respond in structured format: Let the LLM use tools or populate schema to provide the user. Useful if your agent should generate structured content
- Managing agent steps: How to format the intermediate steps of your workflow for the agent
Alternative ways to define state
- Pydantic state: Use a Pydantic model as your state
Structured output
- Extraction with re-prompting: How to generate complex nested schemas using JSONPatch retries, for when function calling is insufficient, and regular reprompting still fails to generate valid results