Skip to content

inteleion-ai/stratarouter-runtime

Repository files navigation

StrataRouter Runtime

High-performance, deterministic execution engine for TCFP-defined microagent workflows

License Rust Version Status

Overview

StrataRouter Runtime is the execution layer of the StrataRouter platform. It receives routing decisions from StrataRouter-Core, executes TCFP (Typed Compositional Flow Protocol) workflows with full isolation, and returns structured results with cost and latency metadata.

Key Features

  • Deterministic Execution — reproducible results for identical inputs via blake3-hashed cache keys
  • Semantic Routing — cosine-similarity microagent selection with rule-based override
  • Hybrid Semantic Cache — mandatory gate checks prevent incorrect cache reuse
  • Batch Deduplication — automatic request coalescing with per-workflow queues
  • State Snapshots — persistent execution state with checkpoint recovery
  • Freemium Limits — hard enforcement of 4 vCPU / 24 GB / 10 concurrent / 1000 daily
  • Full Observability — structured tracing, Prometheus metrics, health endpoints

Architecture

StrataRouter Platform
├── StrataRouter-Core        (Semantic routing library)
├── StrataRouter-Runtime     (THIS — execution engine)  ⬅
└── StrataRouter-Enterprise  (Distributed, policy, governance)
src/
├── api/          REST API (Axum) — handlers, models, middleware, errors
├── bridge/       Core↔Runtime integration layer
├── executor/     TCFP workflow execution engine
├── routing/      Semantic + rule-based agent selection
├── cache/        Hybrid semantic cache (deterministic)
├── batch/        Request deduplication and coordination
├── state/        Execution state with snapshots
├── storage/      PostgreSQL persistence
├── limits/       Freemium tier enforcement
├── metrics/      Cost, latency, success tracking
├── observability/ Tracing, logging, health
└── tcfp/         TCFP IR types, loader, validator, compiler

Quick Start

Prerequisites

  • Rust 1.70+
  • PostgreSQL 13+

Run locally

git clone https://github.com/raman-intel/stratarouter-runtime
cd stratarouter-runtime

# Set up database
createdb stratarouter
export DATABASE_URL="postgresql://localhost/stratarouter"

# Build and start
cargo build --release
cargo run --release

Configuration

Create config/local.toml (gitignored):

[server]
host = "127.0.0.1"
port = 8080

[database]
url = "postgresql://localhost/stratarouter"
max_connections = 20

[limits]
max_concurrent_executions = 10
max_memory_mb = 24000.0
max_cpu_cores = 4.0

Environment variable overrides:

export DATABASE_URL="postgresql://user:pass@host/db"
export RUST_LOG="info"
export SERVER_PORT="8080"

API

Execute workflow

POST /api/v1/workflows/execute
Content-Type: application/json

{
  "workflow_id": "my-workflow",
  "input": { "query": "Hello" },
  "options": { "enable_cache": true, "timeout_seconds": 60 }
}

Other endpoints

GET  /api/v1/health
GET  /api/v1/status
GET  /api/v1/executions/:id
GET  /api/v1/workflows/:id/executions
GET  /api/v1/cache/stats
DEL  /api/v1/cache/:workflow_id/invalidate
POST /api/v1/agents
GET  /api/v1/agents
POST /api/v1/routing/rules
POST /api/v1/batch/submit
GET  /api/v1/usage/stats
GET  /api/v1/usage/workflows/:id
GET  /metrics   (Prometheus)

See docs/API.md for full documentation.

Freemium Limits

Resource Limit
Concurrent Executions 10
CPU Cores 4 vCPU
Memory 24 GB
Workflows per Tenant 100
Daily Executions 1 000
Workflow Steps 1 000
Execution Duration 1 hour

Development

cargo build          # debug
cargo build --release
cargo test           # unit tests
cargo clippy -- -D warnings
cargo fmt --check

Deployment

docker build -t stratarouter-runtime .
docker run -p 8080:8080 -e DATABASE_URL="postgresql://..." stratarouter-runtime

# or
docker-compose up -d

Status

This is an alpha release (v0.1). The following are stubs pending full implementation:

  • enforcement.rs — constraint enforcement (passes all checks)
  • sandbox.rs — execution isolation (passthrough)
  • feedback.rs — feedback collection (logs only)
  • Python bindings (pyo3) — buildable but not production-tested

License

Apache-2.0 — see LICENSE


Built with Tokio · Axum · SQLx · Prometheus · Tracing

About

StrataRouter Runtime is the execution layer of the StrataRouter platform. It receives routing decisions from StrataRouter-Core, executes TCFP (Typed Compositional Flow Protocol) workflows with full isolation, and returns structured results with cost and latency metadata. Key Features

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors