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.12.tar.gz (187.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.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

somatize-0.2.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

somatize-0.2.12-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.12.tar.gz.

File metadata

  • Download URL: somatize-0.2.12.tar.gz
  • Upload date:
  • Size: 187.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.12.tar.gz
Algorithm Hash digest
SHA256 00fccdb7c39495fcc922b8dc2184e6d6315ccf8415b65a99c6942f6abfd24c96
MD5 8315f1c948ddb3e5770c8a4f1eb0c7cd
BLAKE2b-256 591c80f85b20694781f0dc94ec5c50d75b7ffa4c14015b8ce2a22da010dd1972

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for somatize-0.2.12-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f3628dfb9edfa5bae68ddb629e9b398ab049643ae6ca317db02db28f83b08b0d
MD5 8c8b89bf6aaa2414dddfcad7beae51f4
BLAKE2b-256 6779d3b08be180e03145b947f748db5beafd71fd2b5cfef51ed05ddebb28b8d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for somatize-0.2.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4008733c17c9de08ad17d89592f1997353d2667773b9a2c9113d4f8e192e88e
MD5 ddd33766c3d05803142e1a273775889c
BLAKE2b-256 9a36d948b3713e132da36661096e50535d424055c1c1080614862b16f771bb62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for somatize-0.2.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 53679a56a36e3d394aa6f6d8b9bb30f483a353de4db1d2df2eabc21d1d3d8bf1
MD5 ec9a584c73d821bc853ec63fa5d8daae
BLAKE2b-256 16b25c876dddab7f2d3df8d67c6f4ac154e7e98f51cdeadc507707f1d8c35d45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for somatize-0.2.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0ae67a9cd1754c012d09122aa983361c6e761b217e4ea3790d8a489606795e7
MD5 0673b2d9a8fd1e35072aef4570762985
BLAKE2b-256 3274eb1195ba54a2b54f6dedf9dfba0ad3d6e0a58a5e696abfbd11052898a942

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