Genenerate code stubs for langgraph agents.
Project description
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.
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
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 langgraph_gen-0.0.6.tar.gz.
File metadata
- Download URL: langgraph_gen-0.0.6.tar.gz
- Upload date:
- Size: 78.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ae2cdbb5bfb51776c780dc81fcf264d1b0eae142472469c2f313e471bd799f0
|
|
| MD5 |
4b1995b9757429cf27eb05a7770b5713
|
|
| BLAKE2b-256 |
53e7c34ebc6d2b8725e58755f8456b13350841e1d1e44089b12cec5c66f60953
|
File details
Details for the file langgraph_gen-0.0.6-py3-none-any.whl.
File metadata
- Download URL: langgraph_gen-0.0.6-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbacd4d10e3b8d5a44068dd8a75e8b0bd0bb225fdbca1a32a31bf7891650fa6f
|
|
| MD5 |
e751d0690a02918a57d95357cc217ba0
|
|
| BLAKE2b-256 |
5b30916a9e3823b4c22631601e9bd70a713fe17634ba9dbc1be671490b3292c8
|