Converts a Directed Acyclic Graph (DAG) JSON to LangGraph JSON format.
Project description
dag2langgraph
Compiles a DAG JSON into LangGraph JSON. Includes validation for structure and cycles.
Install / Run (Poetry)
- Ensure Poetry is installed: https://python-poetry.org/docs/#installation
- Create an in-project virtualenv and install deps (creates
.venv):make setup
- Run tests:
make test
- Convert a DAG file via console script:
poetry run dag2langgraph examples/sample_dag.json -o /tmp/langgraph.json
- Or via stdin/stdout:
cat examples/sample_dag.json | poetry run dag2langgraph - > /tmp/langgraph.json
Makefile Targets
setup: creates/uses.venvand installs deps via Poetry.test:poetry run pytest -q.run-sample: run CLI onexamples/sample_dag.json.lock: (re)generatepoetry.lockto matchpyproject.toml.patch: bump patch version via Poetry, commit, and tagvX.Y.Z.publish: push branch and tag toorigin(triggers GitHub Actions publish to PyPI).clean: remove.venvand caches.
Publishing
-
GitHub Actions workflow
Publish to PyPIbuilds and uploads the package when:- A GitHub Release is published, or
- You push a tag like
v0.1.0, or - You manually dispatch the workflow.
-
Required secret in the repo settings:
PYPI_API_TOKEN: PyPI API token (user:__token__).
Releasing (Patch)
- Use the
Release Patch Versionworkflow (workflow_dispatch) to:- Bump the patch version via Poetry
- Commit the change and create tag
vX.Y.Z - Create a GitHub Release
- This will trigger the publish workflow to upload to PyPI
Input DAG schema (summary)
nodes: array of objects withid(string),type("function" | "tool"),name(string)edges: array of objects withsource(string),target(string), optionalcondition(string)entry_point: string (must match a nodeid)
Output LangGraph JSON (summary)
nodes: object keyed by nodeid, each with{ type, name }edges: array of{ source, target }plusconditionwhen providedentry_point: copied from input
Errors
Entry point not specified.— whenentry_pointis missing/emptyInvalid DAG structure or cycles detected.— for malformed fields, missing refs, duplicate ids, or cycles
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
dag2langgraph-0.1.1.tar.gz
(4.3 kB
view details)
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 dag2langgraph-0.1.1.tar.gz.
File metadata
- Download URL: dag2langgraph-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1908b7e7923e223c658f865956a5179306be2826f576679df43d35dbb14d9e1
|
|
| MD5 |
8bb3377efeda163631fac9ddd91150aa
|
|
| BLAKE2b-256 |
f23e2b9fa899b2a06543b0a40ef4b8e2ef384bb88160bde032336622bbcd8559
|
File details
Details for the file dag2langgraph-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dag2langgraph-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ecedc261847d1ed666f317a34c8a923fde931869d8b246f318941937c19685c
|
|
| MD5 |
2f956e2024a09d935c3ee57ff4bcaa12
|
|
| BLAKE2b-256 |
48c0a00981ab569b9d429788576c3039b7f2d1ff18ce1ad615ce79d2d4d42834
|