Attractor
A DOT-based pipeline runner that uses directed graphs (defined in Graphviz DOT syntax) to orchestrate multi-stage AI workflows.
Overview
Attractor lets you define multi-stage AI workflows as directed graphs using Graphviz DOT syntax. The graph is the workflow: nodes are tasks, edges are transitions, and attributes configure behavior.
Based on the Attractor Specification.
Features
- Declarative pipelines defined in DOT syntax
- Pluggable handlers for different node types (LLM calls, conditionals, human gates)
- Checkpoint and resume for crash recovery
- Goal gates to enforce critical stages
- Edge-based routing with conditions and priorities
- Retry logic with exponential backoff
- Comprehensive validation and linting
Installation
pip install -e .
Quick Start
Create a simple pipeline in example.dot:
digraph Simple {
graph [goal="Run tests and report"]
start [shape=Mdiamond, label="Start"]
exit [shape=Msquare, label="Exit"]
run_tests [label="Run Tests", prompt="Run the test suite"]
report [label="Report", prompt="Summarize results for $goal"]
start -> run_tests -> report -> exit
}
Run the pipeline:
# Validate the pipeline
python -m attractor.cli example.dot --validate-only
# Execute the pipeline
python -m attractor.cli example.dot
Or use the Python API:
from attractor import parse_dot, run_pipeline
graph = parse_dot("example.dot")
outcome = run_pipeline(graph)
print(f"Pipeline completed with status: {outcome.status.value}")
Documentation
- Usage Guide - Detailed usage and examples
- Attractor Specification - Complete specification
Testing
# Run all tests
pytest tests/
# Run with verbose output
pytest tests/ -v
Currently 47 tests passing, including:
- DOT parser tests
- Validation and linting tests
- Execution engine tests
- Condition evaluation tests
- Handler tests (tool, human-in-the-loop, parallel)
- Stylesheet parsing and matching tests
- Integration tests matching the spec's smoke test
Examples
See the examples/ directory for complete working pipelines:
simple.dot- Basic linear workflowbranching.dot- Conditional branching with goal gates
Implementation Status
Core features implemented:
- ✅ DOT parser for the supported subset
- ✅ Validation with 7 built-in lint rules
- ✅ Execution engine with retry logic and checkpointing
- ✅ Edge selection with 5-step priority algorithm
- ✅ Condition evaluation (=, !=, && operators)
- ✅ Basic handlers (start, exit, codergen, conditional)
- ✅ Tool handler (parallelogram nodes) - shell command execution
- ✅ Human-in-the-loop handler (hexagon nodes) - interactive gates
- ✅ Parallel execution handler (component nodes) - concurrent branches
- ✅ Fan-in handler (tripleoctagon nodes) - result consolidation
- ✅ Model stylesheet parser - CSS-like LLM configuration
- ✅ CLI interface
- ✅ Variable expansion ($goal)
Not yet implemented:
- ⏳ Manager loop handler (house nodes) - supervisor pattern
- ⏳ HTTP server mode
- ⏳ Observability events
- ⏳ Full parallel subgraph execution (current implementation is simplified)
License
MIT
Metadata
Release files for py-attractor 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_attractor-0.3.0.tar.gz | 27.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_attractor-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.4 kB
Release files / py_attractor-0.3.0.tar.gz
| Download URL | py_attractor-0.3.0.tar.gz |
|---|---|
| Size | 27.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de57e4390a673cd2a249e928e33a580c4b72ecba9d35df364d8e1471ae033146
|
|
BLAKE2b-256 checksum How to use checksums |
163b297b8cffdb46f338b35a0ded2dc757adccb58965bf51a1a2d9971e11001c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 8, 2026.
Transparency logRelease files / py_attractor-0.3.0-py3-none-any.whl
| Download URL | py_attractor-0.3.0-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f6b59127d63ef22b759ab8d20fbdd3a9fc4848fc258ca44722f89af89f6b985
|
|
BLAKE2b-256 checksum How to use checksums |
e29eb5bd2305e90c14513ac22f52cbb6fae7184d91ad6f7f58f489d1069a24bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 8, 2026.
Transparency log