mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-10 11:47:51 +02:00
docs: reorganize API refs (#1884)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Channels
|
||||
|
||||
::: langgraph.channels.base
|
||||
options:
|
||||
members:
|
||||
- BaseChannel
|
||||
|
||||
::: langgraph.channels
|
||||
options:
|
||||
members:
|
||||
- Topic
|
||||
- LastValue
|
||||
- EphemeralValue
|
||||
- BinaryOperatorAggregate
|
||||
- AnyValue
|
||||
@@ -1,62 +1,29 @@
|
||||
# Checkpointers
|
||||
|
||||
You can [compile][langgraph.graph.MessageGraph.compile] any LangGraph workflow with a [Checkpointer][basecheckpointsaver] to give your agent "memory" by persisting its state. This permits things like:
|
||||
::: langgraph.checkpoint.base
|
||||
options:
|
||||
members:
|
||||
- CheckpointMetadata
|
||||
- Checkpoint
|
||||
- BaseCheckpointSaver
|
||||
- create_checkpoint
|
||||
|
||||
- Remembering things across multiple interactions
|
||||
- Interrupting to wait for user input
|
||||
- Resilience for long-running, error-prone agents
|
||||
- Time travel retry and branch from a previous checkpoint
|
||||
::: langgraph.checkpoint.serde.base
|
||||
options:
|
||||
members:
|
||||
- SerializerProtocol
|
||||
|
||||
Key checkpointer interfaces and primitives are defined in [`langgraph_checkpoint`](https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint) library. Additional checkpointer implementations are also available as installable libraries:
|
||||
* [`langgraph-checkpoint-sqlite`](https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-sqlite): An implementation of LangGraph checkpointer that uses SQLite database. Ideal for experimentation and local workflows.
|
||||
* [`langgraph-checkpoint-postgres`](https://github.com/langchain-ai/langgraph/tree/main/libs/checkpoint-postgres): An advanced checkpointer that uses Postgres database, used in LangGraph Cloud. Ideal for using in production.
|
||||
::: langgraph.checkpoint.serde.jsonplus
|
||||
options:
|
||||
members:
|
||||
- JsonPlusSerializer
|
||||
|
||||
### Checkpoint
|
||||
::: langgraph.checkpoint.memory
|
||||
|
||||
::: langgraph.checkpoint.base.Checkpoint
|
||||
::: langgraph.checkpoint.sqlite
|
||||
|
||||
### CheckpointMetadata
|
||||
::: langgraph.checkpoint.sqlite.aio
|
||||
|
||||
::: langgraph.checkpoint.base.CheckpointMetadata
|
||||
::: langgraph.checkpoint.postgres
|
||||
|
||||
### BaseCheckpointSaver
|
||||
|
||||
::: langgraph.checkpoint.base.BaseCheckpointSaver
|
||||
|
||||
## Serialization / deserialization
|
||||
|
||||
### SerializerProtocol
|
||||
|
||||
::: langgraph.checkpoint.base.SerializerProtocol
|
||||
|
||||
### JsonPlusSerializer
|
||||
|
||||
::: langgraph.checkpoint.serde.jsonplus.JsonPlusSerializer
|
||||
|
||||
## Checkpointer Implementations
|
||||
|
||||
LangGraph also natively provides the following checkpoint implementations.
|
||||
|
||||
### MemorySaver
|
||||
|
||||
::: langgraph.checkpoint.memory.MemorySaver
|
||||
|
||||
### AsyncSqliteSaver
|
||||
|
||||
::: langgraph.checkpoint.sqlite.aio.AsyncSqliteSaver
|
||||
|
||||
### SqliteSaver
|
||||
|
||||
::: langgraph.checkpoint.sqlite.SqliteSaver
|
||||
|
||||
### AsyncPostgresSaver
|
||||
|
||||
::: langgraph.checkpoint.postgres.aio.AsyncPostgresSaver
|
||||
|
||||
### PostgresSaver
|
||||
|
||||
::: langgraph.checkpoint.postgres.PostgresSaver
|
||||
handler: python
|
||||
|
||||
|
||||
handler: python
|
||||
::: langgraph.checkpoint.postgres.aio
|
||||
@@ -0,0 +1,6 @@
|
||||
::: langgraph.constants
|
||||
options:
|
||||
members:
|
||||
- TAG_HIDDEN
|
||||
- START
|
||||
- END
|
||||
@@ -1,6 +1,3 @@
|
||||
# Errors
|
||||
|
||||
While you may not want to see them, informative errors help you design better workflows.
|
||||
Below are the LangGraph-specific errors and what they mean.
|
||||
|
||||
::: langgraph.errors
|
||||
@@ -1,80 +1,18 @@
|
||||
# Graph Definitions
|
||||
|
||||
Graphs are the core abstraction of LangGraph. Each [StateGraph](#stategraph) implementation is used to create graph workflows. Once compiled, you can run the [CompiledGraph](#compiledgraph) to run the application.
|
||||
::: langgraph.graph.graph
|
||||
options:
|
||||
members:
|
||||
- Graph
|
||||
- CompiledGraph
|
||||
|
||||
## StateGraph
|
||||
::: langgraph.graph.state
|
||||
options:
|
||||
members:
|
||||
- StateGraph
|
||||
- CompiledStateGraph
|
||||
|
||||
```python
|
||||
from langgraph.graph import StateGraph
|
||||
from typing_extensions import TypedDict
|
||||
class MyState(TypedDict)
|
||||
...
|
||||
graph = StateGraph(MyState)
|
||||
```
|
||||
|
||||
::: langgraph.graph.StateGraph
|
||||
handler: python
|
||||
|
||||
## MessageGraph
|
||||
|
||||
::: langgraph.graph.message.MessageGraph
|
||||
|
||||
## `add_messages`
|
||||
|
||||
::: langgraph.graph.message.add_messages
|
||||
|
||||
## CompiledGraph
|
||||
|
||||
::: langgraph.graph.graph.CompiledGraph
|
||||
|
||||
## StreamMode
|
||||
|
||||
::: langgraph.types.StreamMode
|
||||
|
||||
## Constants
|
||||
|
||||
The following constants and classes are used to help control graph execution.
|
||||
|
||||
## START
|
||||
|
||||
START is a string constant (`"__start__"`) that serves as a "virtual" node in the graph.
|
||||
Adding an edge (or conditional edges) from `START` to node one or more nodes in your graph
|
||||
will direct the graph to begin execution there.
|
||||
|
||||
```python
|
||||
from langgraph.graph import START
|
||||
...
|
||||
builder.add_edge(START, "my_node")
|
||||
# Or to add a conditional starting point
|
||||
builder.add_conditional_edges(START, my_condition)
|
||||
```
|
||||
|
||||
## END
|
||||
|
||||
END is a string constant (`"__end__"`) that serves as a "virtual" node in the graph. Adding
|
||||
an edge (or conditional edges) from one or more nodes in your graph to the `END` "node" will
|
||||
direct the graph to cease execution as soon as it reaches this point.
|
||||
|
||||
```python
|
||||
from langgraph.graph import END
|
||||
...
|
||||
builder.add_edge("my_node", END) # Stop any time my_node completes
|
||||
# Or to conditionally terminate
|
||||
def my_condition(state):
|
||||
if state["should_stop"]:
|
||||
return END
|
||||
return "my_node"
|
||||
builder.add_conditional_edges("my_node", my_condition)
|
||||
```
|
||||
|
||||
## Send
|
||||
|
||||
::: langgraph.types.Send
|
||||
|
||||
## Interrupt
|
||||
|
||||
::: langgraph.types.Interrupt
|
||||
|
||||
## RetryPolicy
|
||||
|
||||
::: langgraph.types.RetryPolicy
|
||||
::: langgraph.graph.message
|
||||
options:
|
||||
members:
|
||||
- add_messages
|
||||
@@ -1,67 +1,18 @@
|
||||
# Prebuilt
|
||||
|
||||
## create_react_agent
|
||||
::: langgraph.prebuilt.chat_agent_executor
|
||||
options:
|
||||
members:
|
||||
- create_react_agent
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
```
|
||||
::: langgraph.prebuilt.tool_node
|
||||
options:
|
||||
members:
|
||||
- ToolNode
|
||||
- InjectedState
|
||||
- tools_condition
|
||||
|
||||
::: langgraph.prebuilt.create_react_agent
|
||||
|
||||
## ToolNode
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import ToolNode
|
||||
```
|
||||
|
||||
::: langgraph.prebuilt.ToolNode
|
||||
handler: python
|
||||
|
||||
|
||||
## ToolExecutor
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import ToolExecutor
|
||||
```
|
||||
|
||||
::: langgraph.prebuilt.ToolExecutor
|
||||
handler: python
|
||||
|
||||
|
||||
## ToolInvocation
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import ToolInvocation
|
||||
```
|
||||
|
||||
::: langgraph.prebuilt.ToolInvocation
|
||||
handler: python
|
||||
heading_level: 4
|
||||
|
||||
|
||||
|
||||
## `tools_condition`
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import tools_condition
|
||||
```
|
||||
|
||||
::: langgraph.prebuilt.tools_condition
|
||||
|
||||
|
||||
## ValidationNode
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import ValidationNode
|
||||
```
|
||||
|
||||
::: langgraph.prebuilt.ValidationNode
|
||||
|
||||
## InjectedState
|
||||
|
||||
```python
|
||||
from langgraph.prebuilt import InjectedState
|
||||
```
|
||||
|
||||
::: langgraph.prebuilt.InjectedState
|
||||
handler: python
|
||||
::: langgraph.prebuilt.tool_validator
|
||||
options:
|
||||
members:
|
||||
- ValidationNode
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# Types
|
||||
|
||||
::: langgraph.types
|
||||
options:
|
||||
members:
|
||||
- All
|
||||
- StreamMode
|
||||
- StreamWriter
|
||||
- RetryPolicy
|
||||
- CachePolicy
|
||||
- Interrupt
|
||||
- PregelTask
|
||||
- PregelExecutableTask
|
||||
- StateSnapshot
|
||||
- Send
|
||||
Reference in New Issue
Block a user