Temporal integration for LangGraph - durable execution for stateful AI agents.
Project description
Langgraph Temporal
Temporal integration for LangGraph — durable execution for stateful AI agents.
Run your existing LangGraph StateGraph as a Temporal Workflow with automatic recovery from failures, distributed node execution, and zero-resource human-in-the-loop.
This project is experimental, use at your own risk
Installation
pip install langgraph-temporal
Requirements: Python >= 3.10, langgraph >= 1.0.0, temporalio >= 1.7.0
Quick start
1. Run a local Temporal server
A docker-compose.yml is provided to run Temporal locally with PostgreSQL and Elasticsearch.
cp .env.ci .env
make start_temporal
2. Create langgraph workflow
Take any compiled LangGraph graph, wrap it in TemporalGraph, start a Worker, and invoke:
import asyncio
from typing import TypedDict
from langgraph.graph import END, START, StateGraph
from temporalio.client import Client as TemporalClient
from temporalio.worker import UnsandboxedWorkflowRunner
from langgraph.temporal import TemporalGraph
class State(TypedDict):
message: str
def greet(state: State) -> dict:
from time import sleep
sleep(10) # simulate work
return {"message": f"Hello, {state['message']}!"}
async def main():
# 1. Build a normal LangGraph
builder = StateGraph(State)
builder.add_node("greet", greet)
builder.add_edge(START, "greet")
builder.add_edge("greet", END)
graph = builder.compile()
# 2. Connect to Temporal and wrap the graph
client = await TemporalClient.connect("localhost:7233")
tg = TemporalGraph(graph, client, task_queue="my-queue")
# 3. Start a Worker (runs Activities that execute your nodes)
worker = tg.create_worker(workflow_runner=UnsandboxedWorkflowRunner())
async with worker:
result = await tg.ainvoke(
{"message": "world"},
config={"configurable": {"thread_id": "greeting-1"}},
)
print(result) # {"message": "Hello, world!"}
asyncio.run(main())
Note: LangGraph imports modules restricted by Temporal's sandbox, so
UnsandboxedWorkflowRunner()is required when creating the Worker.
3. Open Temporal UI
The Temporal Web UI is available at http://localhost:8233
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langgraph_temporal-0.2.0.tar.gz.
File metadata
- Download URL: langgraph_temporal-0.2.0.tar.gz
- Upload date:
- Size: 31.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcb64dfbde0b8a0676bf93c16eb7d5794d6f5e3b435458f02dda6a7a4fa1e46a
|
|
| MD5 |
cc85577868752071d157b41b8784e847
|
|
| BLAKE2b-256 |
a90d3695806bbf0de8e48a6f6b8f20ebe1500fb5124318de8d3e76c195dc6685
|
Provenance
The following attestation bundles were made for langgraph_temporal-0.2.0.tar.gz:
Publisher:
release.yml on pradithya/langgraph-temporal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_temporal-0.2.0.tar.gz -
Subject digest:
dcb64dfbde0b8a0676bf93c16eb7d5794d6f5e3b435458f02dda6a7a4fa1e46a - Sigstore transparency entry: 1191923229
- Sigstore integration time:
-
Permalink:
pradithya/langgraph-temporal@93e616bc27a778c1a1f7accc22945c4935e1e0b1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/pradithya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@93e616bc27a778c1a1f7accc22945c4935e1e0b1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langgraph_temporal-0.2.0-py3-none-any.whl.
File metadata
- Download URL: langgraph_temporal-0.2.0-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e357ab4c5d5cf8de17ec73722879f82215cc12347f51b0f237160a9b99651e55
|
|
| MD5 |
b82a9d308684749f94d2a9ff7ef2bc05
|
|
| BLAKE2b-256 |
1ab899d4c99f79ca964fd154d466bc91ec7e2f552cf22ef1a19736c633ca5425
|
Provenance
The following attestation bundles were made for langgraph_temporal-0.2.0-py3-none-any.whl:
Publisher:
release.yml on pradithya/langgraph-temporal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_temporal-0.2.0-py3-none-any.whl -
Subject digest:
e357ab4c5d5cf8de17ec73722879f82215cc12347f51b0f237160a9b99651e55 - Sigstore transparency entry: 1191923233
- Sigstore integration time:
-
Permalink:
pradithya/langgraph-temporal@93e616bc27a778c1a1f7accc22945c4935e1e0b1 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/pradithya
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@93e616bc27a778c1a1f7accc22945c4935e1e0b1 -
Trigger Event:
push
-
Statement type: