A modular framework for building composable AI workflows
Project description
NodeCraft
A modular framework for building composable AI workflows with a "building blocks" design philosophy.
Overview
NodeCraft provides a pluggable Node and Scenario system that allows you to discover, create, and compose reusable AI workflow components. Think of it as building blocks for AI-powered code analysis and automation.
Key Features
- Node-based architecture with automatic discovery
- YAML-based scenario definition
- Template-based Node and Scenario creation
- Configuration file system for team collaboration
- Dynamic CLI generation from scenarios
- Built-in scenarios for common tasks
Installation
# Install from PyPI
pip install NodeCraft
# Set up API key
export ANTHROPIC_API_KEY="your-api-key-here"
After installation, the nodecraft command is available globally.
Quick Start
Discover Available Nodes and Scenarios
# List all available nodes
nodecraft nodes list
# Show node details
nodecraft nodes show @common/get_files
# List all scenarios
nodecraft scenarios list
# Show scenario details
nodecraft scenarios show simple_rag
Create New Nodes and Scenarios
# Create a function-based node
nodecraft nodes create --name my_analyzer
# Create a class-based node with retry logic
nodecraft nodes create --name api_caller --type class
# Create a scenario from template
nodecraft scenarios create --name my_workflow --template rag-query
# View available templates
nodecraft scenarios create --name test --template custom --dry-run
Register Custom Nodes and Scenarios
# Register a single node
nodecraft nodes register ./custom_nodes/my_node.py
# Register all nodes in a directory
nodecraft nodes register ./custom_nodes/ --recursive
# Register a scenario
nodecraft scenarios register ./my_scenario.yaml
Configuration
Create a .nodecraft.yaml file in your project root:
nodes:
search_paths:
- ".nodecraft/nodes"
- "./custom_nodes"
scenarios:
search_paths:
- ".nodecraft/scenarios"
- "./workflows"
llm:
default_model: "claude-3-haiku-20240307"
api_timeout: 60
Configuration priority: CLI arguments > Project config > Global config > Defaults
Global config location: ~/.nodecraft/config.yaml
Built-in Scenarios
OutcomeForge includes several built-in scenarios for common tasks:
- snapshot: Create snapshots of your codebase with AI analysis
- adapt: Analyze open-source repositories and generate adaptation plans
- regression: AI-powered quality gate based on test metrics
- arch-drift: Detect architecture violations and structural drift
- rag: Lightweight RAG for codebase Q&A
- code-review: Security, quality, and performance code review
- wiki: Generate structured wiki documentation from codebases
Example usage:
# Create a snapshot
nodecraft snapshot --patterns "**/*.py"
# Ask questions about your codebase
nodecraft rag --patterns "**/*.py" --query "How does this work?"
# Review code changes
nodecraft code-review --git-diff
# Generate wiki documentation
nodecraft wiki --local-dir ./my-project
CLI Usage
Node Management
# List nodes
nodecraft nodes list [--namespace <namespace>]
# Show node details
nodecraft nodes show <node_id>
# Create new node from template
nodecraft nodes create --name <name> [--type function|class]
# Register custom node
nodecraft nodes register <path> [--recursive]
Scenario Management
# List scenarios
nodecraft scenarios list
# Show scenario details
nodecraft scenarios show <scenario_id>
# Create new scenario from template
nodecraft scenarios create --name <name> --template <template>
# Register custom scenario
nodecraft scenarios register <path> [--recursive]
# Run a scenario
nodecraft <scenario_id> [OPTIONS]
Available scenario templates:
rag-query: RAG-based codebase Q&Afile-process: File collection and processinganalyze-report: Code analysis with report generationgate-check: Quality gate enforcementsnapshot-restore: Version control and rollbackcustom: Blank template for custom workflows
Tutorial System
# Get started tutorial
nodecraft tutorial
# Node creation tutorial
nodecraft tutorial nodes
# Scenario tutorial
nodecraft tutorial scenarios
Architecture
Node System
Nodes are the smallest units of work. Each node has three phases:
- prep: Validate inputs and prepare parameters
- exec: Execute the main operation
- post: Process results and update context
Nodes are discovered automatically from:
- Framework built-in nodes (
nodes/common/) - Global user nodes (
~/.nodecraft/nodes/) - Project nodes (
.nodecraft/nodes/) - Configured search paths
Scenario System
Scenarios are workflows composed of nodes. They can be defined in:
- Python (programmatic):
from engine import flow
from nodes.common import get_files_node, call_llm_node
def my_scenario(config):
f = flow()
f.add(get_files_node(), name="get_files")
f.add(call_llm_node(), name="analyze")
return f
- YAML (declarative):
scenario:
id: my_scenario
name: My Scenario
description: Custom workflow
parameters:
patterns:
type: list
default: ["**/*.py"]
steps:
- node: "@common/get_files"
name: get_files
params:
patterns: "{{params.patterns}}"
- node: "@common/call_llm"
name: analyze
Context Flow
Data flows through the scenario via a shared context dictionary. Each node:
- Reads data from context using
input_keys - Writes results to context using
output_keys - Can access parameters via
{{params.name}}syntax in YAML
Development
Project Structure
nodecraft/
├── core/ # Core framework
│ ├── registry.py # Node discovery and registration
│ ├── scenario_registry.py # Scenario management
│ ├── template_generator.py # Template generation
│ └── config.py # Configuration management
├── nodes/
│ └── common/ # Built-in nodes
├── scenarios/ # Built-in scenarios
├── templates/ # Node and scenario templates
│ ├── nodes/
│ └── scenarios/
└── cli.py # CLI entry point
Running Tests
# Run all tests
pytest tests/
# Run specific test file
pytest tests/test_template_creation.py -v
Requirements
- Python 3.7+
- anthropic (Claude API)
- openai (OpenAI API)
- click (CLI framework)
- pyyaml (YAML parsing)
- gitpython (Git operations)
- jinja2 (Template rendering)
License
MIT
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 nodecraft-0.2.0.tar.gz.
File metadata
- Download URL: nodecraft-0.2.0.tar.gz
- Upload date:
- Size: 144.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70aa3d044477c7661441926ba2579cdd203a0bc2d5038a12c58aeb82669dc94b
|
|
| MD5 |
a2825a1c1ce6dd82335366f9c32bd1c3
|
|
| BLAKE2b-256 |
9cbc8bf55f66f7bc7639f66daacfe4b4496530af5337bfd63e8d57e4930ba115
|
Provenance
The following attestation bundles were made for nodecraft-0.2.0.tar.gz:
Publisher:
workflow.yml on bethneyQQ/NodeCraft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nodecraft-0.2.0.tar.gz -
Subject digest:
70aa3d044477c7661441926ba2579cdd203a0bc2d5038a12c58aeb82669dc94b - Sigstore transparency entry: 622772179
- Sigstore integration time:
-
Permalink:
bethneyQQ/NodeCraft@3ad5bfe3d009aeecfa0bd8627a80972b3b227219 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/bethneyQQ
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@3ad5bfe3d009aeecfa0bd8627a80972b3b227219 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nodecraft-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nodecraft-0.2.0-py3-none-any.whl
- Upload date:
- Size: 132.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be29e5bd06f7dfeead1408392c0d49de5a8b798f2c9467d13e3d067bf710821e
|
|
| MD5 |
ab9b3a4b4ef474a5164f1a068ebeb214
|
|
| BLAKE2b-256 |
0765bdbf67a140d869f2d46f3cb2eddf0899410ce7f917287c230b701f2009c9
|
Provenance
The following attestation bundles were made for nodecraft-0.2.0-py3-none-any.whl:
Publisher:
workflow.yml on bethneyQQ/NodeCraft
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nodecraft-0.2.0-py3-none-any.whl -
Subject digest:
be29e5bd06f7dfeead1408392c0d49de5a8b798f2c9467d13e3d067bf710821e - Sigstore transparency entry: 622772185
- Sigstore integration time:
-
Permalink:
bethneyQQ/NodeCraft@3ad5bfe3d009aeecfa0bd8627a80972b3b227219 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/bethneyQQ
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@3ad5bfe3d009aeecfa0bd8627a80972b3b227219 -
Trigger Event:
push
-
Statement type: