Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
fd05009
feat: add dapr-ext-langgraph documentation
CasperGN Nov 25, 2025
928f986
fix: remove link to state stores
CasperGN Nov 25, 2025
7fa6216
fix: remove redundant header & wording correction
CasperGN Nov 25, 2025
d977a93
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
msfussell Dec 4, 2025
4701747
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
msfussell Dec 14, 2025
56685f1
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
CasperGN Dec 16, 2025
993721f
fix: add missing link
CasperGN Dec 16, 2025
70901db
Update sdkdocs/python/content/en/python-sdk-docs/python-sdk-extension…
CasperGN Dec 16, 2025
2a79ad4
Update sdkdocs/python/content/en/python-sdk-docs/python-sdk-extension…
CasperGN Dec 16, 2025
3cc2dd1
Update sdkdocs/python/content/en/python-sdk-docs/python-sdk-extension…
CasperGN Dec 16, 2025
7fcac03
Update sdkdocs/python/content/en/python-sdk-docs/python-sdk-extension…
CasperGN Dec 16, 2025
76fdd01
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
msfussell Dec 16, 2025
6deb26e
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
msfussell Dec 16, 2025
2ee7625
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
msfussell Dec 17, 2025
4bae4bd
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
CasperGN Dec 17, 2025
6a12e0f
docs: move langgraph memory documentation into new ai docs structure
CasperGN Dec 17, 2025
939ce89
chore: align naming across all third party agent frameworks
CasperGN Dec 17, 2025
3779b4c
docs: align document structure to openai example
CasperGN Dec 17, 2025
fe9003f
Merge branch 'v1.16' into docs/python-sdk-ext-langgraph
CasperGN Dec 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
type: docs
title: "LangGraph"
linkTitle: "LangGraph"
weight: 25
description: "Dapr first-class integrations with LangGraph Agents"
---

### What is the Dapr LangGraph integration?

Dapr provides LangGraph agents a first class integration to agent session management (checkpointers).
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
type: docs
title: "Agent Sessions"
linkTitle: "Agent Sessions"
weight: 30
description: "How to use Dapr reliably and securely manage LangGraph Agent Checkpointers"
---

## Overview

The Dapr Python SDK provides integration with LangGraph Checkpointer using the `dapr-ext-langgraph` extension.

## Getting Started

Initialize Dapr locally to set up a self-hosted environment for development. This process fetches and installs the Dapr sidecar binaries, runs essential services as Docker containers, and prepares a default components folder for your application. For detailed steps, see the official [guide on initializing Dapr locally]({{% ref install-dapr-cli.md %}}).

To initialize the Dapr control plane containers and create a default configuration file, run:

```bash
dapr init
```

Verify you have container instances with `daprio/dapr`, `openzipkin/zipkin`, and `redis` images running:

```bash
docker ps
```

### Install Python

{{% alert title="Note" color="info" %}}
Make sure you have Python already installed. `Python >=3.10`. For installation instructions, visit the official [Python installation guide](https://www.python.org/downloads/).
{{% /alert %}}

### Download Dependencies

Download and install the Dapr LangGraph extension with:

{{< tabpane text=true >}}

{{% tab header="Stable" %}}

```bash
pip install dapr-ext-langgraph langchain_openai langchain_core langgraph langgraph-prebuilt
```

{{% /tab %}}

{{% tab header="Development" %}}
{{% alert title="Note" color="warning" %}}
The development package will contain features and behavior that will be compatible with the pre-release version of the Dapr runtime. Make sure to uninstall any stable versions of the Python SDK extension before installing the `dapr-dev` package.
{{% /alert %}}

```bash
pip install dapr-ext-langgraph-dev langchain_openai langchain_core langgraph langgraph-prebuilt
```

{{% /tab %}}

{{< /tabpane >}}

### Create a LangGraph Agent

To let Dapr handle the agent memory, utilize the `DaprCheckpointer` as the checkpointer object when compiling the graph. Pass the checkpointer just like any other checkpointer provider:

```python
from dapr.ext.langgraph import DaprCheckpointer
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage, SystemMessage
from langgraph.graph import START, MessagesState, StateGraph
from langgraph.prebuilt import ToolNode, tools_condition


def add(a: int, b: int) -> int:
"""Adds a and b.

Args:
a: first int
b: second int
"""
return a + b

tools = [add]
llm = ChatOpenAI(model="gpt-4o")
llm_with_tools = llm.bind_tools(tools)

sys_msg = SystemMessage(
content='You are a helpful assistant tasked with performing arithmetic on a set of inputs.'
)

def assistant(state: MessagesState):
return {'messages': [llm_with_tools.invoke([sys_msg] + state['messages'])]}

builder = StateGraph(MessagesState)
builder.add_node('assistant', assistant)
builder.add_node('tools', ToolNode(tools))
builder.add_edge(START, 'assistant')
builder.add_conditional_edges(
'assistant',
tools_condition,
)
builder.add_edge('tools', 'assistant')

memory = DaprCheckpointer(store_name='statestore', key_prefix='dapr')
react_graph_memory = builder.compile(checkpointer=memory)

config = {'configurable': {'thread_id': '1'}}

messages = [HumanMessage(content='Add 3 and 4.')]
messages = react_graph_memory.invoke({'messages': messages}, config)
for m in messages['messages']:
m.pretty_print()
```

### Set an OpenAI API key

```bash
export OPENAI_API_KEY=sk-...
```

### Create a Python venv

```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```

## Create the database component

The component file is how Dapr connects to your databae. The full list of supported databases can be found [here]({{% ref supported-state-stores %}}). Create a `components` directory and this file in it:

```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
version: v1
metadata:
- name: redisHost
value: localhost:6379
- name: redisPassword
value: ""
```

## Next Steps

Now that you have a LangGraph agent using Dapr to manage the agent sessions, explore more you can do with the [State API]({{% ref "state-management-overview" %}}) and how to enable [resiliency policies]({{% ref resiliency-overview %}}) for enhanced reliability.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
type: docs
title: "OpenAI Agents"
linkTitle: "OpenAI Agents"
title: "OpenAI"
linkTitle: "OpenAI"
weight: 25
description: "Dapr first-class integrations for OpenAI Agents"
---
Expand Down
Loading