This module is responsible for running GNN models that have been rendered into framework-specific simulation code by Step 11 (11_render.py).
| Framework | Language | Subfolder | Script Pattern | Status |
|---|---|---|---|---|
| PyMDP | Python | pymdp/ |
*_pymdp.py |
✅ Full support |
| RxInfer.jl | Julia | rxinfer/ |
*_rxinfer.jl |
✅ Full support |
| ActiveInference.jl | Julia | activeinference_jl/ |
*_activeinference.jl |
✅ Full support |
| JAX | Python | jax/ |
*_jax.py |
✅ Full support |
| DisCoPy | Python | discopy/ |
*_discopy.py |
✅ Full support |
| PyTorch | Python | pytorch/ |
*_pytorch.py |
✅ Full support |
| NumPyro | Python | numpyro/ |
*_numpyro.py |
✅ Full support |
JAX, NumPyro, PyTorch, and DisCoPy are core dependencies (uv sync). If the environment is incomplete, their scripts are skipped (not failed). Julia frameworks require Julia installed.
src/execute/
├── __init__.py # Module initialization
├── executor.py # GNNExecutor class (framework dispatch)
├── processor.py # Main processor (Step 12 entry point)
├── validator.py # Output validation
├── recovery.py # Recovery execution strategies
├── data_extractors.py # Result data extraction
├── julia_setup.py # Julia environment setup
├── install_dependencies.py # Dependency management
├── test_execution.py # Execution tests
├── pymdp/ # PyMDP execution
│ └── simple_simulation.py # PyMDP simulation runner
├── rxinfer/ # RxInfer.jl execution
├── activeinference_jl/ # ActiveInference.jl execution
├── jax/ # JAX execution
├── discopy/ # DisCoPy execution
│ └── discopy_translator_module/
└── mcp.py # MCP tool integration
graph TD
Pipeline[Main Pipeline] --> Step12[12_execute.py]
Step12 --> Discovery[Discover Rendered Scripts]
Discovery --> List[Script List]
List --> Loop{For Each Script}
Loop --> Detect[Detect Framework]
Detect --> Setup[Environment Setup]
Setup --> Run[Subprocess Execution]
Run --> Capture[Capture Output]
Capture --> Report[Execution Report]
subgraph "Execution Environments"
Run --> PyMDP[PyMDP - Python]
Run --> RxInfer[RxInfer - Julia]
Run --> ActInf[ActiveInference.jl - Julia]
Run --> JAX[JAX - Python]
Run --> DisCoPy[DisCoPy - Python]
end
Main executor class providing framework dispatch:
execute_gnn_model(model_path, execution_type, options)— Execute a rendered scriptrun_simulation(simulation_config)— Run a simulation from configgenerate_execution_report(output_file)— Generate execution summary_execute_pymdp_script(),_execute_rxinfer_config(),_execute_discopy_diagram(),_execute_jax_script()— Framework-specific execution methods
Orchestrates multi-framework execution:
- Discovers all rendered scripts in
output/11_render_output/ - Detects framework by file extension and naming pattern
- Executes each script in appropriate runtime environment
- Aggregates results into
output/12_execute_output/summaries/
PyMDP simulation runner with support for:
- 2D and 3D B matrices (passive models and action-conditioned)
- Column normalization for stochastic matrices
- Standardized
simulation_results.jsonoutput
Julia environment management for RxInfer.jl and ActiveInference.jl:
- Package installation and version management
- Environment activation
- Runtime error handling
Total: 40 | Success: 40 | Failed: 0
actinf_pomdp_agent (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
deep_planning_horizon (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
hmm_baseline (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
markov_chain (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
multi_armed_bandit (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
simple_mdp (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
tmaze_epistemic (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
two_state_bistable (5/5): ✅PyMDP ✅JAX ✅DisCoPy ✅RxInfer ✅ActInf.jl
# Run as part of full pipeline
python src/main.py
# Run only render + execute steps
python src/main.py --only-steps "11,12"from execute.executor import GNNExecutor
executor = GNNExecutor(output_dir="output/12_execute_output")
result = executor.execute_gnn_model("path/to/script.py", execution_type="pymdp")