dr-graph
Hashable computation-graph configs plus a pure, deterministic interpreter. Not a workflow engine.
The rule this library exists to serve: whatever is searched over must be data; whatever does the searching is code. Graph configs are the searched-over layer — the motivating use case is experiment conditions and optimizer genomes. Optimizers and durable workflows are ordinary code that read and write these configs.
The vocabulary sheet
(source: .defs/vocab.html) is the authoritative contract: the terms,
guarantees, scope boundaries, and the mapping from each term to the
exported names. This README orients; the sheet decides.
What it provides
GraphDefinition/NodeDefinition— a versioned, variable-bearing DAG shape thatmaterialize()s fully-setGraphConfigs from per-node Variable assignments.GraphConfig/NodeConfig— the flat, validated config that a graph hash identifies; construction enforces the structural guarantees (acyclicity, exactly one terminal node, input-source legality).graph_hash()— the config's identity, computed through dr-serialize's identity API; the sheet defines its exact coverage and format.execute_graph()— pure sequential execution: resolves each node's inputs, calls the injectedrun_nodecallback, and returns aGraphRunResult. An optionalcompletedmapping skips already-paid-for nodes on resume.node()/graph()/inline_subgraph()— neutral builders and composition by flattening.
Everything else — durability, retries, scheduling, persistence, prompts, providers — belongs to the caller; the sheet draws the exact line. Sequential execution is a feature: deterministic order is what makes durable-workflow replay line up.
Ecosystem
Part of the dr-* family: depends on dr-serialize (identity
hashing); consumed by whetstone-ai. Neighbor repos are
dr-providers, dr-platform, dr-code, and unitbench.
Example
from dr_graph import execute_graph, graph, node
config = graph(
[
node(
"encoder",
node_type="llm_call",
input_sources={"prompt": "task.prompt"},
output_field="description",
),
node(
"decoder",
node_type="llm_call",
input_sources={"description": "encoder.description"},
output_field="code",
),
],
terminal="decoder",
)
result = execute_graph(
graph=config,
inputs={"prompt": "write an add function"},
run_node=lambda node_config, inputs: {
"values": {node_config.output_field: "..."}
},
)
Development
uv sync
uv run pytest
uv run ruff check .
uv run ty check
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 dr_graph-0.1.0.tar.gz.
File metadata
- Download URL: dr_graph-0.1.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e6d50e445d8b1e341f12416dcd383f7c4730e8964433d74518f80c478e0e089
|
|
| MD5 |
b57f6f36cf6090f9d660936babb0c4a4
|
|
| BLAKE2b-256 |
a245f82331de72b71b9bc74f420efc5f6255ebdeba9847421b54b9153bfd318f
|
File details
Details for the file dr_graph-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dr_graph-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe99f93118b371e72e6ea2bc80b190c915f3a5a1c5317a1fb4664b0ec67a3e2f
|
|
| MD5 |
e2c30256ee977fdb456e405e49bbc527
|
|
| BLAKE2b-256 |
e7dc87cde3391e89537da6f62d9e87b861a7b28b080b7ed872f92175c2b223e6
|