Skip to main content

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

Project description

Soorma Core SDK

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 for building production-grade multi-agent systems, including Registry, Event Bus, Memory, Tracker, and Identity services.

PyPI version Python 3.11+ License: MIT

๐Ÿšง Status: Day 0 (Pre-Alpha)

We're in active pre-launch refactoring to solidify architecture and APIs before v1.0. The SDK and infrastructure are functional for building multi-agent systems.

Learn more: soorma.ai

What's New in v0.9.0

  • ๐Ÿ” JWT-First Service Auth - SDK and service documentation now reflect the current bearer-token runtime model and trusted admin exception paths
  • ๐Ÿชช Identity Bootstrap Hardening - soorma dev bootstraps persisted local RS256/JWKS signing material for local stacks by default
  • ๐Ÿท๏ธ Unified Release Alignment - SDK, shared libraries, and backend services are aligned on 0.9.0

Highlights from v0.8.2

  • ๐Ÿ” Agent Discovery - context.registry.discover() finds active agents by consumed event; returns DiscoveredAgent list with schema helpers
  • ๐Ÿ“‹ Schema Registry - Register and retrieve JSON payload schemas via context.registry.register_schema() / get_schema() / list_schemas()
  • ๐Ÿ”— A2A Gateway - A2AGateway adapter exposes any Soorma agent via the Agent-to-Agent (A2A) protocol (GET /.well-known/agent.json, POST /)
  • ๐Ÿ”Œ EventSelector - Discover agents that handle a specific event before publishing
  • ๐Ÿ“ฆ soorma-nats - New shared NATSClient library (libs/soorma-nats/); Tracker Service no longer depends on SDK
  • โœ… Integration Test Suite - 11 in-process tests (E2E discovery, multi-tenant isolation, A2A round-trip)

Highlights from v0.8.1

  • ๐Ÿค– ChoreographyPlanner - LLM-based autonomous orchestration (50+ model providers via LiteLLM)
  • ๐Ÿ“Š PlanContext - State machine for multi-step workflows with pause/resume
  • ๐Ÿ“ˆ TrackerClient - Event-driven observability and progress tracking
  • ๐ŸŽฏ Pattern Selection Framework - Choose the right pattern for your use case
  • ๐Ÿ” BYO Model Credentials - Developer-controlled LLM providers (OpenAI, Azure, Anthropic, Ollama)

Install with LLM support: pip install soorma-core[ai]

Installation

During Pre-Launch: We recommend installing from local source to stay synchronized with breaking changes:

# Clone the repository
git clone https://github.com/soorma-ai/soorma-core.git
cd soorma-core

# Install from source
pip install -e sdk/python

After v1.0 Release: Standard PyPI installation will be recommended: pip install soorma-core

Requirements: Python 3.11+

Quick Start

Note: Infrastructure runs locally via Docker. Clone the repo to get started.

# 1. Clone the repository
git clone https://github.com/soorma-ai/soorma-core.git
cd soorma-core

# 2. Start local infrastructure
soorma dev --build

# 3. Run the Hello World example
cd examples/01-hello-world
python worker.py

# 4. In another terminal, send a request
python client.py Alice

Next steps: See the Examples Guide for a complete learning path.

Core Concepts

Soorma provides four agent patterns for building distributed AI systems:

  • Tool - Synchronous, stateless operations (< 1 second)
  • Worker - Asynchronous, stateful tasks with delegation
  • Planner - Multi-step workflows with manual state machine control
  • ChoreographyPlanner - Autonomous LLM-based orchestration

Platform Services:

  • context.registry - Service discovery, agent registration, schema registry & A2A discovery (discover(), register_schema(), list_schemas())
  • context.memory - Distributed state (Semantic, Episodic, Working, Plan context)
  • context.bus - Event choreography (pub/sub)
  • context.tracker - Observability & progress tracking

Learn more: See the comprehensive documentation for architecture details, patterns, and API references.

Agent Models

Tool Model (Synchronous)

Tools handle fast, stateless operations that return immediate results:

from soorma import Tool
from soorma.agents.tool import InvocationContext

tool = Tool(name="calculator")

@tool.on_invoke("calculate.add")
async def add_numbers(request: InvocationContext, context):
    numbers = request.data["numbers"]
    return {"sum": sum(numbers)}  # Auto-published to caller

Characteristics:

  • โšก Stateless: No persistence between calls
  • ๐Ÿš€ Fast: Returns immediately (< 1 second)
  • ๐Ÿ”„ Auto-complete: SDK publishes response automatically
  • ๐Ÿ“Š Use cases: Calculations, lookups, validations

Example: 01-hello-tool

Worker Model (Asynchronous with Delegation)

Workers handle multi-step, stateful tasks with delegation:

from soorma import Worker
from soorma.task_context import TaskContext, ResultContext, DelegationSpec

worker = Worker(name="order-processor")

@worker.on_task("order.process.requested")
async def process_order(task: TaskContext, context):
    # Save state
    task.state["order_id"] = task.data["order_id"]
    await task.save()
    
    # Delegate to sub-workers
    await task.delegate_parallel([
        DelegationSpec("inventory.reserve.requested", {...}, "inventory.reserved"),
        DelegationSpec("payment.process.requested", {...}, "payment.processed"),
    ])

@worker.on_result("inventory.reserved")
@worker.on_result("payment.processed")
async def handle_result(result: ResultContext, context):
    task = await result.restore_task()
    task.update_sub_task_result(result.correlation_id, result.data)
    
    # Complete when all results arrived
    if task.aggregate_parallel_results(task.state["group_id"]):
        await task.complete({"status": "completed"})

Characteristics:

  • ๐Ÿ’พ Stateful: TaskContext persists across delegations
  • ๐Ÿ”„ Asynchronous: Manual completion with task.complete()
  • ๐ŸŽฏ Delegation: Sequential or parallel sub-tasks
  • โš™๏ธ Use cases: Workflows, long-running operations, coordination

Delegation Patterns:

  • Sequential: task.delegate() - One sub-task at a time
  • Parallel: task.delegate_parallel() - Fan-out with aggregation
  • Multi-level: Workers can delegate to Workers (arbitrary depth)

Example: 08-worker-basic

Planner Model (Multi-Step Workflows)

Planners orchestrate multi-step workflows using state machines:

from soorma import Planner
from soorma.plan_context import PlanContext
from soorma_common.state import StateConfig, StateTransition, StateAction

planner = Planner(name="approval-workflow")

# Define state machine
states = [
    StateConfig(
        name="pending_review",
        transitions=[StateTransition(event="review.approved", next_state="pending_execution")],
        actions=[StateAction(event="review.requested", data={...})]
    ),
    # ... more states
]

@planner.on_goal("approval.workflow.requested")
async def start_workflow(goal, context):
    plan = await PlanContext.create_from_goal(goal, states, context)
    await plan.execute_next(context)  # Execute first state's actions

@planner.on_transition()
async def handle_transition(event, context, plan, next_state):
    await plan.execute_next(context)  # Execute next state's actions

Characteristics:

  • ๐ŸŽฏ Manual control: Developer defines all state transitions
  • ๐Ÿ’พ Stateful: PlanContext persists across events
  • ๐Ÿ”„ Re-entrant: Pause/resume for human-in-the-loop workflows
  • ๐Ÿ“Š Use cases: Approval workflows, multi-stage pipelines

Example: 09-planner-basic

ChoreographyPlanner Model (Autonomous Orchestration)

ChoreographyPlanner uses LLMs to autonomously decide next actions:

from soorma.ai.choreography import ChoreographyPlanner

planner = ChoreographyPlanner(
    name="research-planner",
    reasoning_model="gpt-4o",  # or azure/gpt-4o, anthropic/claude-3-opus, ollama/llama2, etc.
    api_key=os.getenv("OPENAI_API_KEY"),  # BYO credentials
    system_instructions="You are a research assistant...",
    max_actions=10  # Circuit breaker
)

@planner.on_goal("research.requested")
async def handle_research(goal, context):
    plan = await planner.reason_and_execute(
        goal=goal.data["query"],
        context=context,
        custom_context={"domain": "AI research"}  # Business logic injection
    )

Characteristics:

  • ๐Ÿค– Autonomous: LLM decides which events to publish and when to complete
  • ๐ŸŒ Event discovery: Queries Registry for available capabilities
  • โœ… Validation: Prevents LLM hallucinations via event schema checks
  • ๐Ÿ’ฐ Cost-aware: Configurable planning strategies (balanced|conservative|aggressive)
  • ๐Ÿ” BYO credentials: Developer controls LLM provider and API keys
  • ๐Ÿ“Š Use cases: Research workflows, adaptive planning, dynamic orchestration

Installation: pip install soorma-core[ai] (includes LiteLLM for 50+ model providers)

Example: 10-choreography-basic

Pattern Comparison

Feature Tool Worker Planner ChoreographyPlanner
Execution Synchronous Asynchronous Multi-step Multi-step
State Stateless TaskContext PlanContext PlanContext
Completion Auto Manual Manual Auto (LLM decides)
Delegation โŒ No โœ… Yes โœ… Yes โœ… Yes
Control Full High Full Autonomous
LLM Required โŒ No โŒ No โŒ No โœ… Yes
Latency < 100ms Seconds Varies 1-10s per decision
Cost Free Free Free LLM API costs
Example Calculator Order processing Approval workflow Research assistant

Choosing a pattern: See the Pattern Selection Guide for decision criteria and flowcharts.

CLI Reference

Command Description
soorma init <name> Create a new agent project
soorma dev Start local infrastructure
soorma dev --build Build and start (first time)
soorma dev --status Show infrastructure status
soorma dev --logs View infrastructure logs
soorma dev --stop Stop infrastructure
soorma dev --stop --clean Stop and remove all data
soorma version Show SDK version

The soorma dev command runs infrastructure (Registry, NATS, Event Service, Memory Service) in Docker while your agent code runs natively on the host for fast iteration and debugging.

Documentation & Resources

๐Ÿ“š Complete Documentation: github.com/soorma-ai/soorma-core

Key Guides:

๐ŸŽ“ Learning Path:

  1. 01-hello-world - Basic Worker pattern
  2. 01-hello-tool - Stateless Tool pattern
  3. 02-events-simple - Event pub/sub
  4. 03-events-structured - LLM-based event selection
  5. 04-memory-working - Workflow state
  6. 05-memory-semantic - RAG patterns
  7. 06-memory-episodic - Multi-agent chatbot
  8. 08-worker-basic - Task delegation (parallel)
  9. 09-planner-basic - State machine workflows
  10. 10-choreography-basic - Autonomous LLM planning
  11. 11-discovery-llm - LLM-based dynamic discovery & lightweight dispatch
  12. 12-event-selector - Intelligent event routing with EventSelector
  13. 13-a2a-gateway - A2A protocol gateway integration

Contributing & Support

License

MIT License - see LICENSE for details.

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.9.1.tar.gz (108.4 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.9.1-py3-none-any.whl (121.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for soorma_core-0.9.1.tar.gz
Algorithm Hash digest
SHA256 de7ad06c9f22f788b332acbfc9065af3225e919727d7a7e315991004e773a837
MD5 e550b2755c2ba137ef0b6be1015fd896
BLAKE2b-256 c7eec454be906ad7dd781f1ffccbc05ad18aae5309c1787f316bcb2904febd87

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for soorma_core-0.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1047112ac80a3d3ee0a000aa137764604ba08663751dd19dd2e588184fab06a8
MD5 e75dd2ff6a109a5b3bde8399d24715e3
BLAKE2b-256 51162d51ba7ee3d89bbf88b22ba80d25fc43b0cfefa5194edcf3de4037d6fed3

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