Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Version Python version Coverage Badge Ruff

Manta SDK

Beta. The SDK is in beta and every published release is a pre-release (pip install "mantatech-sdk>=0.6b5.dev0"). New to the platform? Start with the beta quickstart: install, token, list your clusters, deploy a minimal module.

The Manta SDK is a unified Python library for distributed computing and federated learning on the Manta platform. It combines the functionality of both the high-level API client and the lightweight task execution runtime into a single, flexible package.

Features

  • 🚀 Unified API: Single package for both client operations and task execution
  • 📦 Modular Installation: Install only what you need with optional dependencies
  • 🐳 Container Optimized: Lightweight [light] mode for minimal container footprint
  • 🔄 Async/Sync APIs: Full async support with sync wrappers for convenience
  • 🖥️ CLI Tools: Command-line interface for cluster and swarm management
  • 🔒 Secure: JWT authentication with optional mTLS support

Documentation

📚 Full documentation: docs.manta-tech.io

Source: docs/source/ (Sphinx + Furo). Build locally with cd docs && make html.

Installation Options

Every published release is a pre-release, so each command below carries the version specifier that lets pip select one. The extras are the ones pyproject.toml defines: light, sdk, examples, test, docs, code-analytics and all.

API Client

pip install "mantatech-sdk>=0.6b5.dev0"

The base install is enough to import manta.apis and deploy and manage swarms from your application.

For Task Execution

pip install "mantatech-sdk[light]>=0.6b5.dev0"

Adds numpy, used by the manta.light array helpers.

For CLI Usage

pip install "mantatech-sdk[sdk]>=0.6b5.dev0"

Adds the TOML/YAML configuration and cryptography dependencies the manta command-line tool uses.

Examples

pip install "mantatech-sdk[examples]>=0.6b5.dev0"

Adds marimo, torch and torchvision for the bundled examples.

Development Installation

pip install "mantatech-sdk[all]>=0.6b5.dev0"

Installs sdk, light, test, docs and code-analytics. It does not include examples.

Quick Start

API Client Usage

import manta
from manta.apis import AsyncUserAPI
import asyncio

async def main():
    # Initialize API client
    api = AsyncUserAPI(
        token="your_jwt_token",
        host="localhost",
        port=50052
    )
    
    # Check service availability
    available = await api.is_available()
    print(f"Service available: {available}")
    
    # Get cluster API for specific cluster
    cluster_api = api.get_async_cluster_api("cluster_id")
    
    # Deploy a swarm
    swarm_overview = await cluster_api.deploy_swarm(swarm_definition)
    print(f"Deployed swarm: {swarm_overview.swarm_id}")
    
    # Stream results in real-time
    async for result in cluster_api.stream_results(swarm_id, tag="metrics"):
        print(f"Result: {result.data}")

if __name__ == "__main__":
    asyncio.run(main())

Task Execution Usage (Inside Containers)

from manta.light import Local, World, Results, Task
import numpy as np

# Initialize task runtime
task = Task()
local = Local()
world = World()
results = Results()

# Load data from cluster
data = local.load_data("training_data")

# Get global parameters
global_model = world.get("model_weights")

# Perform computation
model = train_model(data, global_model)
accuracy = evaluate_model(model, data)

# Save results
results.save({"accuracy": accuracy}, tag="metrics")
world.set("model_weights", model.state_dict())

CLI Usage

# Configure connection
manta config set --host localhost --port 50052 --token your_jwt_token

# List available clusters
manta cluster list

# Deploy a swarm
manta simulation deploy --swarm-file swarm.py --cluster-id cluster_123

# Monitor swarm execution
manta simulation logs --swarm-id swarm_456

# Stop running swarm
manta simulation stop --swarm-id swarm_456

API Modules

manta.apis - High-Level Client SDK

Access via: from manta.apis import AsyncUserAPI or import manta; api = manta.api

  • AsyncUserAPI / UserAPI: User operations and swarm management
  • AsyncClusterAPI / ClusterAPI: Cluster-specific operations
  • Swarm, Task, Module: High-level swarm definition classes

manta.light - Task Execution Runtime

Access via: from manta.light import Local or import manta; light = manta.light

  • Local: Access to cluster data and local resources
  • World: Global state management across tasks
  • Results: Result saving and sharing
  • Task: Task runtime information and utilities

Migration from Previous Packages

From manta-core

# Old import (still works - backwards compatible)
from manta import AsyncUserAPI, Swarm, Task

# New recommended import pattern
import manta
from manta.apis import AsyncUserAPI, Swarm, Task
# Or access via: api_module = manta.api

From manta-light

# Old import  
from manta_light import Local, World, Results

# New import (same functionality)
from manta.light import Local, World, Results

Container Optimization

The SDK is designed for optimal container usage:

Light Mode (Recommended for Tasks):

  • Install: pip install "mantatech-sdk[light]>=0.6b5.dev0"
  • Contains: Task execution runtime
  • Use case: Inside task containers

With the CLI (For Development):

  • Install: pip install "mantatech-sdk[sdk]>=0.6b5.dev0"
  • Contains: Client SDK + task runtime + the manta CLI's configuration dependencies
  • Use case: Development machines, CI/CD pipelines

Advanced Usage

Configuration

The SDK reads no MANTA_* environment variables. Connection settings come from the arguments you pass, or from a configuration saved under ~/.manta/sdk/ by the manta CLI (which needs the [sdk] extra):

# Prompts for the host, the port and the token (masked as you type it)
manta sdk config init --interactive --name prod
import manta
from manta.apis import AsyncUserAPI

# From a saved configuration: the active one, or one by name
api = manta.configure_from_config("prod")

# Or sign in with your email and password
api = await AsyncUserAPI.sign_in(
    "you@example.com", "your-password", host="api.manta-tech.io", port=443
)

Secure Connections

For production environments with mTLS:

from manta.apis import AsyncUserAPI

api = AsyncUserAPI(
    token="your_jwt_token",
    host="prod-manager.example.com",
    port=50052,
    cafile="/etc/manta/certs/ca.crt",
    certfile="/etc/manta/certs/client.crt",
    keyfile="/etc/manta/certs/client.key",
)

The synchronous UserAPI also accepts cert_folder="/etc/manta/certs", and picks up ca.crt, client.crt and client.key from that folder.

Swarm Definition

Create complex swarms with task dependencies:

from manta.apis import Swarm, Task, Module

# Define algorithm module
module = Module(
    name="federated_learning",
    python_program="fl_trainer.py",
    image="ghcr.io/mantatech/manta-light:pytorch"
)

# Define tasks with dependencies
aggregator = Task(
    name="aggregator",
    module=module,
    command="python fl_trainer.py --role aggregator",
    replicas=1
)

workers = Task(
    name="worker",
    module=module,
    command="python fl_trainer.py --role worker", 
    replicas=5
)

# Create swarm
swarm = Swarm(
    name="federated_mnist",
    tasks=[aggregator, workers],
    iteration=10,
    circular=True
)

Further reading

  • User docs — getting started, SDK usage, node guide, tutorials
  • SDK Architecture — modular design, async/sync patterns, configuration system (internal)
  • SDK Development — developer setup, testing, code quality (internal)
  • Examples — four runnable scripts: federated learning and its non-federated control, on MNIST and CIFAR-10

Contributing

  1. Install development dependencies: pip install mantatech-sdk[all]
  2. Run tests: python -m pytest tests/
  3. Check code style: ruff check manta/
  4. Format code: ruff format manta/

License

AGPL-3.0 with a linking exception for manta.light (ADR-0027) — see LICENSE file for details.

Importing manta.light from your own code does not make your program a derivative work; the copyleft terms of the AGPL continue to apply to manta.apis and manta.cli.

Metadata

Release files for mantatech-sdk 0.6b5.dev750

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mantatech-sdk 0.6b5.dev750
File Interpreter ABI Platform
mantatech_sdk-0.6b5.dev750-py3-none-any.whl Python 3 none any Details

Release files / mantatech_sdk-0.6b5.dev750-py3-none-any.whl

Download URL mantatech_sdk-0.6b5.dev750-py3-none-any.whl
Size 318.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b66c9f97a0738ec4e61d42d97f5dd88fa39468e3927a8d8d1931549a40d98b26
BLAKE2b-256 checksum
How to use checksums
d7e94700fbd8198995a848779b4ceaeafb4be47bc9ffb71028694c550058a6e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6b5.dev750 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page