Soma (σῶμα — body) is a computational graph runtime for research pipelines, agent orchestration, and data virtualization. Written in Rust with Python bindings.
Part of the Nous-Soma-Chronos ecosystem:
- Nous: Understands, reasons — research IDE, agent graphs, automation
- Soma (this project): Executes, materializes — graphs, optimization, distributed workers
- ChronosVector: Remembers — temporal vector database
Docs: manucouto1.github.io/soma — quickstart, tutorial notebooks, Python API.
Examples: examples/ is a
submodule — longer, complete programs rather than feature demonstrations, with
every figure produced by the code beside it. Clone it with the repository:
# already cloned?
Key Concepts
| Concept | Description |
|---|---|
| Filter | Data transformation with fit() (learn state) and forward() (transform). Independently cacheable. |
| Graph | Computational DAG of filters. Build with .node()/.connect() or >> / | operators. |
| Graph.somatize() | "You think it. Soma somatizes it." — Materialize a chain/fork topology into an executable graph. |
| Persistent cache | Crash-safe cache-by-default: content-addressed action store, soma cache stats|gc|pin|verify. |
| Run tracking | Every track_run/Study writes a run directory (.soma/runs/<id>/): manifest, lossless event log, metrics, diagnostics. Crash-safe resume; readers never block training. |
| Visualization | Annotated architecture diagrams, Optuna-style HPO charts, gradient-health views, and one-file HTML reports — all read from run directories. |
| TrainingStrategy | Graph-level attribute: Local, DataParallel, ModelParallel, Federated, PopulationBased. |
| Study | Hyperparameter optimization: Grid, Random, or Bayesian (TPE) search with median/percentile pruning. |
| PBT | Population-Based Training: evolutionary train→evaluate→exploit/explore cycles. |
| Agentic layer | An agentic flow is a graph whose nodes are effectful steps (soma.Agent, soma.Judge, or any object with poll(ctx)). Steps journal their effects (record once, replay on resume); a pipeline is a tool an agent can run and an agent is a node a pipeline can contain. Patterns (react, refine, board, …) are functions in soma.agentic returning ordinary graphs. |
| ExecutionPlan | Compiled from graph. Variants: Sequence, Parallel, Execute, Step, Loop, Branch, Remote, Composite, Stream, Empty. |
| DataStore | Abstraction for data movement: Local, S3, Zarr (chunked tensors), Cached, Stream. |
| Worker | Remote execution daemon. Auto-detects hardware, Slurm-style resource limits, token auth. |
| Coordinator | Lightweight gateway: worker registration, routing, health monitoring. |
Workspace (11 crates)
soma-macros → proc macro (#[derive(SomaFilter)])
soma-core → types + traits: Filter, Value, Graph, Event, Schema, Study,
DataStore (Local/S3/Zarr), VirtualValue, tracking schema, GraphOverlay
soma-compiler → Graph → ExecutionPlan (caching, parallelism, distribution)
Scheduler, plan visualization
soma-runtime → GraphSession, executor, NodeCatalog (filters AND steps), caches,
samplers, pruners, EffectDriver + journal,
StudyRunner, PbtRunner, LocalTracker + RunReader (run directories)
soma-memory → KnowledgeBase trait + MemoryKB + ChronosKB
soma-worker → Worker, Protocol, EnvManager, token auth, CLI binary
soma-coordinator → worker registry, routing, heartbeat monitoring
soma-agent → Research agent loop (observe → hypothesize → experiment → conclude)
soma-mcp → MCP server (13 tools for code, execution, knowledge)
soma-python → PyO3 bindings: Graph, Study, Run, RunView, soma.viz, Chain/Fork operators
somatize (soma/) → facade crate re-exporting the workspace
Quick Start
# Run all tests (900+: 582 Rust + 325 Python)
&& &&
# With S3/Zarr DataStore
# With ChronosVector
# MCP server
Python Usage
= True
return
return
: =
return
return
# Build with >> (chain) and | (fork)
=
=
# Complex topologies
=
# Distributed execution
# or auto-discovery
See your experiments
Everything a run produces lands in a run directory; everything below just reads it back.
# Track a run — architecture snapshot + lossless event log + metrics
# List and inspect runs (crashed runs are detected via stale heartbeat)
=
# per-node wall times, durations, cache hits
# architecture annotated with timing/cache/health
In a notebook, evaluating g draws the architecture as an inline SVG
diagram (a materialized differentiable filter draws its inner layers,
parameter counts included) — no JavaScript, renders anywhere.
graph LR
scaler["scaler<br/>26ms"]
model["model<br/>27ms · ⚠ DEAD_CHANNELS(2)"]
scaler --> model
class scaler soma_completed
class model soma_flagged
With the viz extra (pip install 'somatize[viz]') you get interactive
Plotly figures and pandas projections:
# objective per trial + best-so-far
# params → objective
# Spearman rank correlation
# trial gantt
# pandas table
# logged metric curves
# where the run's wall time went
# gradient-audit health flags
# channel-correlation heatmap
And from the shell:
soma report packages the annotated DAG, efficiency tiles, metric
curves, the full HPO section with trial table, and the health section
into one shareable file. A future live GUI reads the same run-directory
files and the same embedded JSON shapes — see
the Visualization page.
Workers
# Start a worker with auto-detected capabilities
# With resource limits (Slurm-style)
# With coordinator auto-registration
Workers auto-detect CPU cores, RAM, GPUs (nvidia-smi), and Python environments. Each worker creates isolated venv/conda environments per job with incremental dependency updates.
Feature Flags & Extras
somatize-core/s3— S3-compatible DataStore (AWS, Backblaze B2, MinIO)somatize-core/zarr— Zarr v3 chunked tensor storage with compressionsomatize-memory/chronos— ChronosVector-backed KnowledgeBasesomatize[viz](pip) — Plotly figures, DataFrames, HTML reports, rich tables, tqdm progress