DuraGraph Python SDK
Python SDK for DuraGraph - Reliable AI Workflow Orchestration.
Build AI agents with decorators, deploy to a control plane, and get full observability out of the box.
Installation
pip install duragraph
# With OpenAI support
pip install duragraph[openai]
# With Anthropic support
pip install duragraph[anthropic]
# All features
pip install duragraph[all]
Quick Start
from duragraph import Graph, llm_node, entrypoint
@Graph(id="customer_support")
class CustomerSupportAgent:
"""A customer support agent that classifies and responds to queries."""
@entrypoint
@llm_node(model="gpt-4o-mini")
def classify(self, state):
"""Classify the customer intent."""
return {"intent": "billing"}
@llm_node(model="gpt-4o-mini")
def respond(self, state):
"""Generate a response based on intent."""
return {"response": f"I'll help you with {state['intent']}."}
# Define flow
classify >> respond
# Run locally
agent = CustomerSupportAgent()
result = agent.run({"message": "I have a billing question"})
print(result)
# Or deploy to control plane
agent.serve("http://localhost:8081")
Features
Decorator-Based Graph Definition
from duragraph import Graph, llm_node, tool_node, router_node, human_node
@Graph(id="my_agent")
class MyAgent:
@llm_node(model="gpt-4o-mini", temperature=0.7)
def process(self, state):
return state
@tool_node
def search(self, state):
results = my_search_function(state["query"])
return {"results": results}
@router_node
def route(self, state):
return "path_a" if state["condition"] else "path_b"
@human_node(prompt="Please review")
def review(self, state):
return state
Streaming
async for event in agent.stream({"message": "Hello"}):
if event.type == "token":
print(event.data, end="")
elif event.type == "node_complete":
print(f"\nNode {event.node_id} completed")
Subgraphs
@Graph(id="research")
class ResearchAgent:
@llm_node
def research(self, state):
return {"findings": "..."}
@Graph(id="main")
class MainAgent:
research = ResearchAgent.as_subgraph()
@entrypoint
def plan(self, state):
return state
plan >> research
Requirements
- Python 3.10+
- DuraGraph Control Plane (for deployment)
Documentation
Related Repositories
| Repository | Description |
|---|---|
| duragraph | Core API server |
| duragraph-go | Go SDK |
| duragraph-examples | Example projects |
| duragraph-docs | Documentation |
Contributing
See CONTRIBUTING.md for guidelines.
License
Apache 2.0 - See LICENSE for details.
Metadata
Release files for duragraph-python 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| duragraph_python-0.2.1.tar.gz | 326.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| duragraph_python-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 408.3 kB
Release files / duragraph_python-0.2.1.tar.gz
| Download URL | duragraph_python-0.2.1.tar.gz |
|---|---|
| Size | 326.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5efa2f70f5d3c708ccd6ed7488586962c6e3bcc38fac2f27d5cf3d6cc48c90b7
|
|
BLAKE2b-256 checksum How to use checksums |
436ed212a99b22955d38c3efe4bd74b86968ae8e0f7ed8a6d4e79005d6fa6e82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 1, 2026.
Transparency logRelease files / duragraph_python-0.2.1-py3-none-any.whl
| Download URL | duragraph_python-0.2.1-py3-none-any.whl |
|---|---|
| Size | 82.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c09983b007e011f8f3876088e6b3869e7826049830b7e5a3189baf03ce6f7fcf
|
|
BLAKE2b-256 checksum How to use checksums |
58d997a548985e305180f3f70b8a17030c019441dc304613aac126e1433533dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 1, 2026.
Transparency logSecurity for duragraph-python 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for duragraph_python-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.