Skip to main content

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 compression
  • soma-memory/chronos — ChronosVector-backed KnowledgeBase

License

Elastic License 2.0

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

somatize-0.2.14.tar.gz (188.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

somatize-0.2.14-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

somatize-0.2.14-cp313-cp313-macosx_11_0_arm64.whl (3.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

somatize-0.2.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

somatize-0.2.14-cp312-cp312-macosx_11_0_arm64.whl (3.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file somatize-0.2.14.tar.gz.

File metadata

  • Download URL: somatize-0.2.14.tar.gz
  • Upload date:
  • Size: 188.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for somatize-0.2.14.tar.gz
Algorithm Hash digest
SHA256 b61b3e9b6f65c1b11662011d0041cb66f4f2cd5c2d56878b043b45fba3278f92
MD5 c5527c6803a2875ab5c65342c33433d7
BLAKE2b-256 8f5c63cab53ecea16ab8e15ca758c02551a0eb911757fbf9e5488f4c5234003c

See more details on using hashes here.

File details

Details for the file somatize-0.2.14-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for somatize-0.2.14-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9dc65ad16690b0351119e71ee60b9d189a343e481855bf2c12f6ea965c859c38
MD5 25e102f26aa17afd58dfd03c22dea6b1
BLAKE2b-256 4c0fa5e43692406dbdcfc93033e96f84dab8f3606a03a0334c8a6db895e4fc29

See more details on using hashes here.

File details

Details for the file somatize-0.2.14-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for somatize-0.2.14-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d9a0dbdf411e317ff695dec82a50c8633adc51e33c0c1f9973811ee21cb707a9
MD5 e5068062fb844db7f314070521b2993b
BLAKE2b-256 71d0b8d12c021b6e1f1fe70bef5d4d9fa5c92fd54adfe7e1e7f5959c730ced9a

See more details on using hashes here.

File details

Details for the file somatize-0.2.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for somatize-0.2.14-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fdd5cfd6c34ad72d84edc053c991320a3d4a71a7b08fc4782176f54bf941563d
MD5 3259c0f0e39d9f9b88ee3ff6bc5aaad7
BLAKE2b-256 c40cd3c9adc8061671923deecae8b07daf5a2ba880a14521ab9d739829fe0212

See more details on using hashes here.

File details

Details for the file somatize-0.2.14-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for somatize-0.2.14-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 423a14939b8ff539c8a83b875101ad735773f0fe85f1c1ea00c00c80048da8be
MD5 1e6c4598db6b76b84118548a0f926012
BLAKE2b-256 4c7df66a845d6ffea67d20ea9b624630611b99c50b2f0ebaa73b2d99896c8997

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page