Skip to main content

The Open Source Foundation for AI Agents. Powered by the DisCo (Distributed Cognition) architecture.

Project description

Soorma Core

The Open Source Foundation for AI Agents.

Soorma is an agentic infrastructure platform based on the DisCo (Distributed Cognition) architecture. It provides a standardized Control Plane (Gateway, Registry, Event Bus, State Tracker, Memory) for building production-grade multi-agent systems.

๐Ÿšง Status: Pre-Alpha

We are currently building the core runtime. This package provides early access to the SDK and CLI.

Join the waitlist: soorma.ai

Prerequisites

  • Python 3.11+ is required.

Quick Start

Note: Docker images are not yet published. You must clone the repo and build locally.

1. Clone Repository and Build Infrastructure

# Clone the repository (needed for Docker images)
git clone https://github.com/soorma-ai/soorma-core.git
cd soorma-core

# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the SDK from PyPI
pip install soorma-core

# Build infrastructure containers (required first time)
soorma dev --build

๐Ÿ’ก Alternative: To install SDK from local source (for development/customization):

pip install -e sdk/python

2. Run the Hello World Example

# Start infrastructure
soorma dev

# In separate terminals, run the agents:
python examples/hello-world/planner_agent.py
python examples/hello-world/worker_agent.py
python examples/hello-world/tool_agent.py
python examples/hello-world/client.py

3. Create a New Agent Project

# Create a Worker agent (default)
soorma init my-worker

# Create a Planner agent (goal decomposition)
soorma init my-planner --type planner

# Create a Tool service (stateless operations)
soorma init my-tool --type tool

cd my-worker
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Start Local Development

# Start infrastructure (runs in background)
soorma dev

# In another terminal, run your agent
python -m my_worker.agent

Infrastructure management:

# Start infrastructure (default)
soorma dev --start

# Check status
soorma dev --status

# View logs
soorma dev --logs

# Stop infrastructure
soorma dev --stop

Deploy to Soorma Cloud

soorma deploy  # Coming soon!

The DisCo "Trinity"

Soorma implements the DisCo (Distributed Cognition) architecture with three domain service types:

Type Class Purpose Example Use Cases
Planner Planner Strategic reasoning, goal decomposition Research planning, workflow orchestration
Worker Worker Domain-specific task execution Data processing, analysis, content generation
Tool Tool Atomic, stateless operations API calls, calculations, file parsing

Planner Agent

Planners are the "brain" - they receive high-level goals and decompose them into tasks:

from soorma import Planner, PlatformContext
from soorma.agents.planner import Goal, Plan, Task

planner = Planner(
    name="research-planner",
    description="Plans research workflows",
    capabilities=["research_planning"],
)

@planner.on_goal("research.goal")
async def plan_research(goal: Goal, context: PlatformContext) -> Plan:
    # Discover available workers
    workers = await context.registry.find_all("paper_search")
    
    # Decompose goal into tasks
    return Plan(
        goal=goal,
        tasks=[
            Task(name="search", assigned_to="paper_search", data=goal.data),
            Task(name="summarize", assigned_to="summarizer", depends_on=["search"]),
        ],
    )

planner.run()

Worker Agent

Workers are the "hands" - they execute domain-specific cognitive tasks:

from soorma import Worker, PlatformContext
from soorma.agents.worker import TaskContext

worker = Worker(
    name="research-worker",
    description="Searches and analyzes papers",
    capabilities=["paper_search", "citation_analysis"],
)

@worker.on_task("paper_search")
async def search_papers(task: TaskContext, context: PlatformContext):
    # Report progress
    await task.report_progress(0.5, "Searching...")
    
    # Access shared memory
    prefs = await context.memory.retrieve(f"user:{task.session_id}:prefs")
    
    # Your task logic
    results = await search_academic_papers(task.data["query"], prefs)
    
    # Store for downstream workers
    await context.memory.store(f"results:{task.task_id}", results)
    
    return {"papers": results, "count": len(results)}

worker.run()

Tool Service

Tools are the "utilities" - stateless, deterministic operations:

from soorma import Tool, PlatformContext
from soorma.agents.tool import ToolRequest

tool = Tool(
    name="calculator",
    description="Performs calculations",
    capabilities=["arithmetic", "unit_conversion"],
)

@tool.on_invoke("calculate")
async def calculate(request: ToolRequest, context: PlatformContext):
    expression = request.data["expression"]
    result = safe_eval(expression)
    return {"result": result, "expression": expression}

tool.run()

Platform Context

Every handler receives a PlatformContext that provides access to all platform services:

@worker.on_task("my_task")
async def handler(task: TaskContext, context: PlatformContext):
    # Service Discovery
    tool = await context.registry.find("calculator")
    
    # Shared Memory
    data = await context.memory.retrieve(f"cache:{task.data['key']}")
    await context.memory.store("result:123", {"value": 42})
    
    # Event Publishing
    await context.bus.publish("task.completed", {"result": "done"})
    
    # Progress Tracking (automatic for workers, manual available)
    await context.tracker.emit_progress(
        plan_id=task.plan_id,
        task_id=task.task_id,
        status="running",
        progress=0.75,
    )
Service Purpose Methods
context.registry Service Discovery find(), register(), query_schemas()
context.memory Distributed State retrieve(), store(), search()
context.bus Event Choreography publish(), subscribe(), request()
context.tracker Observability start_plan(), emit_progress(), complete_task()

Advanced Usage

Structured Agent Registration

For simple agents, you can pass a list of strings as capabilities. For more control, use AgentCapability objects to define schemas and descriptions.

from soorma import Agent, Context
from soorma.models import AgentCapability

async def main(context: Context):
    # Define structured capabilities
    capabilities = [
        AgentCapability(
            name="analyze_sentiment",
            description="Analyzes the sentiment of a given text",
            input_schema={
                "type": "object",
                "properties": {
                    "text": {"type": "string", "description": "Text to analyze"}
                },
                "required": ["text"]
            },
            output_schema={
                "type": "object",
                "properties": {
                    "score": {"type": "number", "description": "Sentiment score (-1 to 1)"}
                }
            }
        )
    ]

    # Register with structured capabilities
    await context.register(
        name="sentiment-analyzer",
        capabilities=capabilities
    )

    # ... rest of agent logic

Event Registration

You can register custom event schemas that your agent produces or consumes.

from soorma.models import EventDefinition

async def main(context: Context):
    # Register a custom event schema
    await context.registry.register_event(
        EventDefinition(
            event_type="analysis.completed",
            description="Emitted when text analysis is complete",
            schema={
                "type": "object",
                "properties": {
                    "text_id": {"type": "string"},
                    "result": {"type": "object"}
                },
                "required": ["text_id", "result"]
            }
        )
    )

AI Integration

The SDK provides specialized tools for AI agents (like LLMs) to interact with the system dynamically.

AI Event Toolkit

The EventToolkit allows agents to discover events and generate valid payloads without hardcoded DTOs.

from soorma.ai.event_toolkit import EventToolkit

async with EventToolkit() as toolkit:
    # 1. Discover events
    events = await toolkit.discover_events(topic="action-requests")
    
    # 2. Get detailed info
    info = await toolkit.get_event_info("web.search.request")
    
    # 3. Create validated payload (handles schema validation)
    payload = await toolkit.create_payload(
        "web.search.request",
        {"query": "AI trends 2025"}
    )

OpenAI Function Calling

You can expose Registry capabilities directly to OpenAI-compatible LLMs using get_tool_definitions().

from soorma.ai.tools import get_tool_definitions, execute_ai_tool
import openai

# 1. Get tool definitions
tools = get_tool_definitions()

# 2. Call LLM
response = await openai.ChatCompletion.create(
    model="gpt-4",
    messages=[{"role": "user", "content": "Find events related to search"}],
    tools=tools
)

# 3. Execute tool calls
tool_call = response.choices[0].message.tool_calls[0]
result = await execute_ai_tool(
    tool_call.function.name,
    json.loads(tool_call.function.arguments)
)

CLI Commands

First-time setup: Run soorma dev --build --infra-only to build Docker images before using other commands.

Command Description
soorma init <name> Scaffold a new agent project
soorma init <name> --type planner Create a Planner agent
soorma init <name> --type worker Create a Worker agent (default)
soorma init <name> --type tool Create a Tool service
soorma dev Start infra + run agent with hot reload
soorma dev --build Build service images from source first
soorma dev --build --infra-only Build images without running agent (first-time setup)
soorma dev --infra-only Start infra without running agent
soorma dev --stop Stop the development stack
soorma dev --status Show stack status
soorma dev --logs View infrastructure logs
soorma deploy Deploy to Soorma Cloud (coming soon)
soorma version Show CLI version

How soorma dev Works

The CLI implements an "Infra in Docker, Code on Host" pattern for optimal DX:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Your Machine                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Docker Containers (Infrastructure)                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
โ”‚  โ”‚ Registry โ”‚  โ”‚   NATS   โ”‚  โ”‚ Event Service โ”‚              โ”‚
โ”‚  โ”‚  :8081   โ”‚  โ”‚  :4222   โ”‚  โ”‚    :8082      โ”‚              โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ”‚        โ–ฒ            โ–ฒ               โ–ฒ                       โ”‚
โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€ localhost โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                       โ”‚
โ”‚                     โ–ฒ                                       โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                    โ”‚
โ”‚  โ”‚    Native Python (Your Agent)       โ”‚                    โ”‚
โ”‚  โ”‚  โ€ข Hot reload on file change        โ”‚                    โ”‚
โ”‚  โ”‚  โ€ข Full debugger support            โ”‚                    โ”‚
โ”‚  โ”‚  โ€ข Auto-connects to Event Service   โ”‚                    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Benefits:

  • โšก Fast iteration - No docker build cycle, instant reload
  • ๐Ÿ” Debuggable - Attach VS Code/PyCharm debugger
  • ๐ŸŽฏ Production parity - Same infrastructure as prod

Event-Driven Architecture

Unlike single-threaded agent loops, Soorma enables Autonomous Choreography via events:

Client                Planner              Worker              Tool
  โ”‚                     โ”‚                    โ”‚                   โ”‚
  โ”‚  goal.submitted     โ”‚                    โ”‚                   โ”‚
  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚                    โ”‚                   โ”‚
  โ”‚                     โ”‚  action.request    โ”‚                   โ”‚
  โ”‚                     โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚                   โ”‚
  โ”‚                     โ”‚                    โ”‚  tool.request     โ”‚
  โ”‚                     โ”‚                    โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚
  โ”‚                     โ”‚                    โ”‚  tool.response    โ”‚
  โ”‚                     โ”‚                    โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
  โ”‚                     โ”‚  action.result     โ”‚                   โ”‚
  โ”‚                     โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚                   โ”‚
  โ”‚  goal.completed     โ”‚                    โ”‚                   โ”‚
  โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚                    โ”‚                   โ”‚

Documentation

Core Concepts

API Reference

  • Registry Client: Service discovery and capability registration
  • Event Client: Publish/subscribe event choreography
  • Memory Client: Persistent memory for autonomous agents (Semantic, Episodic, Procedural, Working)
  • Platform Context: Unified API for all platform services

Examples

Roadmap

  • v0.1.0: Core SDK & CLI (soorma init, soorma dev)
  • v0.1.1: Event Service & DisCo Trinity (Planner, Worker, Tool)
  • v0.2.0: Subscriber Groups & Unified Versioning
  • v0.3.0: Structured Registration & LLM-friendly Discovery
  • v0.4.0: Multi-provider LLM support & Autonomous choreography improvements
  • v0.5.0: Memory Service (CoALA framework) & PostgreSQL infrastructure
  • v0.6.0: State Tracker & Workflow observability
  • v1.0.0: Enterprise GA

License

MIT

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

soorma_core-0.5.0.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

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

soorma_core-0.5.0-py3-none-any.whl (60.6 kB view details)

Uploaded Python 3

File details

Details for the file soorma_core-0.5.0.tar.gz.

File metadata

  • Download URL: soorma_core-0.5.0.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for soorma_core-0.5.0.tar.gz
Algorithm Hash digest
SHA256 885c69f777d4d2626e83b1ca7a1e9e95581ab8e4158657acd850c65bbc05b6f6
MD5 c4bd51efbe0f958073b03a2ac354ae52
BLAKE2b-256 26a23f41b73f5e1f80bec8f1443a5fc40207828af7a0380edbd34137819ca019

See more details on using hashes here.

File details

Details for the file soorma_core-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: soorma_core-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 60.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for soorma_core-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1345bd4b88f09a0a5b636ea44402fde64f86c47c772cbbbf9d515e83cc2a5f1c
MD5 3d37fbfbbd4bcbe893703d96975129b3
BLAKE2b-256 dad5b0dc316017d48774ea2e5b297050e1901c50648104de624e8da59da52d25

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