Skip to main content

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 .venv and installs deps via Poetry.
  • test: poetry run pytest -q.
  • run-sample: run CLI on examples/sample_dag.json.
  • lock: (re)generate poetry.lock to match pyproject.toml.
  • patch: bump patch version via Poetry, commit, and tag vX.Y.Z.
  • publish: push branch and tag to origin (triggers GitHub Actions publish to PyPI).
  • clean: remove .venv and caches.

Publishing

  • GitHub Actions workflow Publish to PyPI builds 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 Version workflow (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 with id (string), type ("function" | "tool"), name (string)
  • edges: array of objects with source (string), target (string), optional condition (string)
  • entry_point: string (must match a node id)

Output LangGraph JSON (summary)

  • nodes: object keyed by node id, each with { type, name }
  • edges: array of { source, target } plus condition when provided
  • entry_point: copied from input

Errors

  • Entry point not specified. — when entry_point is missing/empty
  • Invalid DAG structure or cycles detected. — for malformed fields, missing refs, duplicate ids, or cycles

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dag2langgraph-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

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

Hashes for dag2langgraph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d1908b7e7923e223c658f865956a5179306be2826f576679df43d35dbb14d9e1
MD5 8bb3377efeda163631fac9ddd91150aa
BLAKE2b-256 f23e2b9fa899b2a06543b0a40ef4b8e2ef384bb88160bde032336622bbcd8559

See more details on using hashes here.

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

Hashes for dag2langgraph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ecedc261847d1ed666f317a34c8a923fde931869d8b246f318941937c19685c
MD5 2f956e2024a09d935c3ee57ff4bcaa12
BLAKE2b-256 48c0a00981ab569b9d429788576c3039b7f2d1ff18ce1ad615ce79d2d4d42834

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page