langgraph-gen
langgraph-gen is a CLI tool that allows you to auto-generate a LangGraph stub from a specification file.
Usage
pip install langgraph-gen
Basic Usage
# Generate Python code from a YAML spec
langgraph-gen spec.yml
# Generate TypeScript code from a YAML spec
langgraph-gen spec.yml --language typescript
# Generate with custom output paths
langgraph-gen spec.yml -o custom_output.py --implementation custom_impl.py
Command Line Options
langgraph-gen [options] input
Required arguments:
input Input YAML specification file
Optional arguments:
-l, --language Language to generate code for (python, typescript)
Default: python
-o, --output Output file path for the agent stub
--implementation Output file path for an implementation with function stubs for all nodes
-V, --version Show program's version number and exit
Example Spec
# A simple 2-step Retrieval-Augmented Generation workflow
name: RagWorkflow
nodes:
- name: retrieve
- name: generate
edges:
- from: __start__
to: retrieve
- from: retrieve
to: generate
- from: generate
to: __end__
Quick Start
Create an example specification file and generate the code:
# Create a simple RAG workflow specification
cat > rag_example.yml << 'EOF'
# A simple 2-step Retrieval-Augmented Generation workflow
name: RagWorkflow
nodes:
- name: retrieve
- name: generate
edges:
- from: __start__
to: retrieve
- from: retrieve
to: generate
- from: generate
to: __end__
EOF
# Generate Python code
langgraph-gen rag_example.yml
# This will create rag_example.py and rag_example_impl.py
Examples
You can find examples of the LangGraph specification together with the generated LangGraph stubs in the examples directory.
Metadata
Release files for langgraph-gen 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langgraph_gen-0.0.6.tar.gz | 78.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langgraph_gen-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.4 kB
Release files / langgraph_gen-0.0.6.tar.gz
| Download URL | langgraph_gen-0.0.6.tar.gz |
|---|---|
| Size | 78.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ae2cdbb5bfb51776c780dc81fcf264d1b0eae142472469c2f313e471bd799f0
|
|
BLAKE2b-256 checksum How to use checksums |
53e7c34ebc6d2b8725e58755f8456b13350841e1d1e44089b12cec5c66f60953
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / langgraph_gen-0.0.6-py3-none-any.whl
| Download URL | langgraph_gen-0.0.6-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbacd4d10e3b8d5a44068dd8a75e8b0bd0bb225fdbca1a32a31bf7891650fa6f
|
|
BLAKE2b-256 checksum How to use checksums |
5b30916a9e3823b4c22631601e9bd70a713fe17634ba9dbc1be671490b3292c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|