A computational graph runtime for research pipelines, agent orchestration, and data virtualization
Project description
Soma
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
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. |
| 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. |
| ExecutionPlan | Compiled from graph. Variants: Sequence, Parallel, Execute, Cached, Remote, Loop, Branch. |
| 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 (10 crates)
soma-macros → proc macro (#[derive(SomaFilter)])
soma-core → types + traits: Filter, Value, Graph, TrainingStrategy, Schema, Event
DataStore (Local/S3/Zarr), VirtualValue, StreamCache
soma-compiler → Graph → ExecutionPlan (caching, parallelism, distribution)
Scheduler, plan visualization (Mermaid/Graphviz)
soma-runtime → GraphSession, executor, FilterLibrary, caches, samplers, pruners
StudyRunner, PbtRunner, stream executor
soma-memory → KnowledgeBase trait + MemoryKB + ChronosKB
soma-worker → Worker, Coordinator, Protocol, EnvManager, token auth
Auto-detect capabilities, resource limits, CLI binary
soma-agent → Research agent loop (observe → hypothesize → experiment → conclude)
soma-mcp → MCP server (13 tools for code, execution, knowledge)
soma-python → PyO3 bindings: Graph, Filter, Study, Lab, Chain/Fork operators
Quick Start
# Run all tests (355 Rust + 29 Python)
cargo test --workspace
cd soma-python && maturin develop && pytest tests/ -v
# With S3/Zarr DataStore
cargo test -p soma-core --features s3
cargo test -p soma-core --features zarr
# With ChronosVector
cargo test -p soma-memory --features chronos
# MCP server
cargo run -p soma-mcp -- /path/to/project
Python Usage
from soma import Filter, Graph, Study, search
class Scaler(Filter):
_differentiable = True
def fit(self, x, y=None):
return {"mean": sum(x) / len(x)}
def forward(self, x, state):
return [v - state["mean"] for v in x]
class Model(Filter):
lr: float = search(0.001, 1.0, scale="log")
def fit(self, x, y=None):
return {"weights": [0.5] * len(x)}
def forward(self, x, state):
return [v * w for v, w in zip(x, state["weights"])]
# Build with >> (chain) and | (fork)
g = Graph.somatize(Scaler() >> Model())
g.fit(train_data)
result = g.forward(test_data)
# Visualize
print(g.to_mermaid())
print(g.to_text())
# Complex topologies
g = Graph.somatize(
(LoadA() >> NormA() | LoadB() >> NormB())
>> Aggregate()
>> Backbone()
>> (HeadA() | HeadB())
)
# Events
g.on_event(lambda e: print(e["event_type"], e.get("node_id", "")))
# Distributed training
g.set_strategy(DataParallel(num_replicas=4))
g.set_coordinator("http://coord:9090", token="sk-xxx")
Workers
# Start a worker with auto-detected capabilities
soma-worker --port 8080 --tags gpu,training --token sk-xxx
# With resource limits (Slurm-style)
soma-worker --cpus 4 --memory 8G --gpus 1 --max-concurrent 2
# With coordinator auto-registration
soma-worker --coordinator http://coord:9090 --token sk-xxx --tags gpu
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
soma-core/s3— S3-compatible DataStore (AWS, Backblaze B2, MinIO)soma-core/zarr— Zarr v3 chunked tensor storage with compressionsoma-memory/chronos— ChronosVector-backed KnowledgeBase
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 somatize-0.2.31.tar.gz.
File metadata
- Download URL: somatize-0.2.31.tar.gz
- Upload date:
- Size: 213.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91e1dbbae548d6eeec274adc1c6a5ecaf4f51c1677ab58cb1bf2c572eea50ea2
|
|
| MD5 |
6055b9a2d58b3c2018d40c0a93880265
|
|
| BLAKE2b-256 |
8643e3a097941e78f10975cbabfd84cfbe1698f49a41699cbb3106399493b0ff
|
File details
Details for the file somatize-0.2.31-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: somatize-0.2.31-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c7030e8fca3ec633e6fde1aa2f91708c7b12f6c7462285c0c83da741c5803ff
|
|
| MD5 |
4ffae2d4a2009620950c7bdbd142f44a
|
|
| BLAKE2b-256 |
7d61391e0c56950107d12e608d27479ea3130303b954b1efe25b98fa24f0b983
|
File details
Details for the file somatize-0.2.31-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: somatize-0.2.31-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18e73afdbe61e0af95f9634c591506da9e8adde1b00344a40a421aff08b955be
|
|
| MD5 |
7854406209401b0418f0c645270b7cf3
|
|
| BLAKE2b-256 |
9885b3ef0363d688d378494c3f85c086e4c78fb5a482e1e93a241ea955b0fad5
|
File details
Details for the file somatize-0.2.31-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: somatize-0.2.31-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 6.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d485a8a35f2785a8a200924ec8d397e2ebfc70e86fcb034d9b40cc9c03794e5
|
|
| MD5 |
3f004ace6d771544d94bfcd5ea678ae6
|
|
| BLAKE2b-256 |
60f49866531ae12470a165bd75e5854a62112d7d50ceb87a2c529ea1158ed26f
|
File details
Details for the file somatize-0.2.31-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: somatize-0.2.31-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.7 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6272a2b74b93eee01af5279536e92dcaf65c37edc3e11b9c2d4a927c355f73c6
|
|
| MD5 |
27484563d2d62677a29a031dd8c91023
|
|
| BLAKE2b-256 |
fb9bbb962d8c000f002d2b739e40940d0b82c20a52822f5b37890f277c4e9b99
|