SOVEREIGN is the first open-source agent runtime that treats AI autonomy as a trust problem. While frameworks like OpenClaw run on blind loops, SOVEREIGN runs parallel specialist councils, auto-corrects its own failing tool logic using Hermes-grade routing, and stops to ask for your explicit approval before doing anything dangerous.
Experience what makes SOVEREIGN different right in your terminal. No setup required.
# Provide 1 API key (OpenAI, Anthropic, or Gemini)
export ANTHROPIC_API_KEY="sk-ant-..."
# Run a complex objective
npx sovereign "Audit our pricing page, research 3 competitors, and draft an updated pricing baseline with evidence."What you will see:
- Planning: SOVEREIGN dynamically creates 3 parallel workstreams.
- Debate: Parallel specialist agents debate the objective (visible consensus scores).
- Execution: The agents spawn tools. If a tool fails, it auto-corrects its own JSON payload and retries in milliseconds.
- Trust Gate: When the agent attempts to finalize the pricing document, it pauses. Your terminal safely prompts you:
High-risk action detected. Approve? [y/n]. - Verified Deliverable: You get a dossier with a multi-source Verification Confidence level.
Current agents use one model for everything. SOVEREIGN uses a Hermes-Grade Model Mesh:
- Tool calls route to fast, structured models (like Groq/LLaMA 3.3).
- Reasoning/Debates route to heavy, smart models (like Claude 3.5 Sonnet / GPT-4o).
- Result: 40% cheaper and significantly fewer hallucinated JSON schemas.
- Mission Contracts: Every objective gets a bounded cost cap, strict deadline, and KPI.
- Micro-Auto-Correction: Instead of macro-looping an entire workflow upon failure, SOVEREIGN catches individual tool failures, analyzes the error, and self-corrects the input.
- Gateway Control Plane: REST + WebSocket RPC for tracing sessions, reviewing memory dumps, and remote overrides.
cp .env.example .env
npm install
npm run buildRun the background worker to handle asynchronous verification and background planning:
npm run workerRun the API / Control Plane:
npm run start- Health:
http://localhost:3001/health - UI Dashboard:
http://localhost:3001/dashboard - OpenAPI:
http://localhost:3001/api/openapi
Before pushing a heavily edited local copy, run:
npm run repo:audit
npm run buildWhat the audit checks:
- local
.envpresence - generated
.data/state - machine-specific
mcp_servers.json - unusually large root files that deserve a second look before publishing
If this folder is not a git repo yet, initialize it here and review the first add carefully:
git init
git add .
git status- Docs index:
docs/README.md - Quick start:
docs/start/getting-started.md - Demo flows:
docs/start/showcase.md - Security model:
docs/core/security.md - Architecture:
docs/core/architecture.md - API and SDK reference:
docs/reference/api.md - Operator runbook:
RUNBOOK.md - Support policy:
SUPPORT.md
- OpenAPI endpoints:
GET /api/openapiGET /api/openapi.json
- Export artifact:
npm run openapi:export->openapi.json
- TypeScript SDK:
- runtime client:
src/sdk/sovereign-client.ts - publishable package:
sdk/ts(@sovereign/client) - package docs:
sdk/ts/README.md
- runtime client:
- Python starter client:
sdk/python/sovereign_client.py
SOVEREIGN supports local and cloud model providers.
Choose mode by provider configuration in .env.
- Local-heavy mode:
- set
OLLAMA_BASE_URLandOLLAMA_MODEL - avoid external provider keys
- set
- Hybrid mode:
- local for low-risk tasks, cloud for high-reasoning tasks
- Cloud mode:
- OpenAI/Anthropic/Gemini/OpenRouter/etc.
- Build:
npm run buildpasses - Tests:
npm testpasses (67/67tests verified locally) - API coverage: OpenAPI exposed and exported
- Reliability features shipped:
- runtime HITL checkpoints
- mission budget cap enforcement
- council step timeout controls
- durable notification outbox and retries
- soul history and rollback
cp .env.example .env
docker compose up --buildThen open:
http://localhost:3001/healthhttp://localhost:3001/dashboardhttp://localhost:3001/api/openapi
npm run uiThe CLI supports agent selection/creation, model policy updates, and local chat.
npm run devbuilds and runs the API in watch mode.npm run startbuilds and starts the API server.npm run workerbuilds and starts the background worker.npm run uilaunches the local terminal UI.npm run stream:reasoningruns the streaming reasoning CLI flow.npm run companion:macosstarts the macOS bridge companion node.npm run companion:windowsstarts the Windows bridge companion node.npm run openapi:exportregeneratesopenapi.json.npm run repo:auditchecks local files before a GitHub push.npm run repo:audit:strictruns the same audit and exits non-zero on warnings.npm run start:prodandnpm run worker:prodrun the built artifacts without rebuilding.
Use the setup wizard to scaffold a serious workspace and auto-create a specialist team:
curl -X POST http://localhost:3001/api/setup/wizard/run \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "default",
"personaName": "SOVEREIGN"
}'Then inspect readiness:
curl "http://localhost:3001/api/setup/doctor?workspaceId=default"The readiness report scores security, team coverage, onboarding scaffold, intelligence configuration, and operating posture so you can close the biggest blockers first.
Gateway and security control-plane routes are bearer-token protected by default.
Bootstrap first-run admin access:
export SECURITY_BOOTSTRAP_TOKEN="change-me-now"Example:
curl http://localhost:3001/api/gateway/status \
-H "Authorization: Bearer $SECURITY_BOOTSTRAP_TOKEN"After startup, issue narrower scoped tokens from /api/security/auth/issue and use those for remote clients and automation. For gateway clients, explicitly request scopes such as gateway:read, gateway:write, gateway:node:invoke, or gateway:browser:control.
Set any model providers you want:
export OPENAI_API_KEY="..."
export ANTHROPIC_API_KEY="..."
export GEMINI_API_KEY="..."State backend switch:
export STATE_BACKEND="file" # file | postgres | postgres_redis
export DATABASE_URL="postgres://user:pass@host:5432/db"
export REDIS_URL="redis://host:6379"Optional web research providers:
export BRAVE_SEARCH_API_KEY="..."
export TAVILY_API_KEY="..."
export SERPAPI_API_KEY="..."
export PERPLEXITY_API_KEY="..."Companion / bridge node settings:
export BRIDGE_URL="ws://127.0.0.1:3001/bridge/ws"
export COMPANION_BRIDGE_TOKEN="replace-me"
export COMPANION_NODE_ID="windows-laptop"
export COMPANION_SYSTEM_RUN_ENABLED="false"After Prisma schema changes:
npx prisma generateGET /healthGET /api/openapiGET /api/openapi.json
GET /dashboard(real-time web UI for orchestrator, council debate, and risk)GET /api/dashboard/snapshot
GET /api/setup/doctorPOST /api/setup/wizard/runGET /api/setup/wizard/runsGET /api/setup/wizard/:runId
GET /api/system/persistence
GET /api/queue/stats
GET /api/llm/providersGET /api/llm/modelsPOST /api/llm/respond
GET /api/pluginsPOST /api/plugins/reloadGET /api/plugins/:pluginIdPOST /api/plugins/:pluginId/tools/:toolName/invoke
GET /api/runtime/actionsGET /api/runtime/actions/:runtimeActionIdGET /api/runtime/metrics
GET /api/channels/adaptersGET /api/channels/sessionsGET /api/channels/sessions/:sessionId/messagesPOST /api/channels/:channelId/webhookGET /api/channels/:channelId/webhook(platform verification handshake where supported)
GET /api/gateway/statusGET /api/gateway/ws-infoGET /api/gateway/bridge/statusGET /api/gateway/bridge/ws-infoGET /api/gateway/bridge/nodesGET /api/gateway/nodesPOST /api/gateway/nodes/registerGET /api/gateway/nodes/:nodeIdPOST /api/gateway/nodes/:nodeId/invokeGET /api/gateway/browser/statusPOST /api/gateway/browser/startPOST /api/gateway/browser/stopGET /api/gateway/browser/targetsPOST /api/gateway/browser/openPOST /api/gateway/browser/cdpGET /api/gateway/tailscale/statusPOST /api/gateway/tailscale/planPOST /api/gateway/tailscale/apply
Gateway WebSocket RPC methods:
gateway.ping,gateway.status,events.subscribesessions.list,sessions.history,sessions.sendnode.list,node.describe,node.invokebridge.status,bridge.nodesbrowser.status,browser.opentailscale.status,tailscale.plan,tailscale.apply
Current node action coverage:
- implemented on host node:
system.run,system.notify,location.get,browser.open_url,browser.status - implemented for connected bridge nodes:
node.invokeover/bridge/ws - scaffolded for companion nodes:
camera.snap,camera.clip,screen.record
Device bridge protocol:
- Companion connects to
ws://<host>:3001/bridge/ws(orwss://...) - Companion registers with
bridge.registerand heartbeats withbridge.heartbeat - Gateway executes remote actions by sending
bridge.invokeand waiting for result
macOS companion runtime:
npm run companion:macosWindows companion runtime:
npm run companion:windowsBridge + companion quick setup:
# terminal 1
cp .env.example .env
export DEVICE_BRIDGE_TOKEN="replace-me"
npm run start# terminal 2
export COMPANION_BRIDGE_TOKEN="replace-me"
export COMPANION_NODE_ID="macos-borhen"
npm run companion:macos# terminal 3 (invoke companion node action through gateway)
curl -X POST http://localhost:3001/api/gateway/nodes/macos-borhen/invoke \
-H "Content-Type: application/json" \
-d '{
"action": "system.notify",
"input": { "title": "SOVEREIGN", "message": "Bridge invoke is live." }
}'GET /api/autopilot/goalsPOST /api/autopilot/goalsGET /api/autopilot/goals/:goalIdGET /api/autopilot/goals/:goalId/logsPOST /api/autopilot/goals/:goalId/runPOST /api/autopilot/goals/:goalId/pausePOST /api/autopilot/goals/:goalId/resumePOST /api/autopilot/goals/:goalId/cancel
GET /api/architecture/blueprintPOST /api/architecture/company-planPOST /api/architecture/soul/evolveGET /api/architecture/soul/:agentId/historyPOST /api/architecture/soul/:agentId/rollback
GET /api/company/runsGET /api/company/runs/:runIdPOST /api/company/runs/:runId/resumePOST /api/company/execute
GET /api/security/pairingsPOST /api/security/pairings/createPOST /api/security/pairings/verifyPOST /api/security/auth/issuePOST /api/security/auth/verifyGET /api/security/rate/eventsPOST /api/security/rate/checkPOST /api/security/sandbox/checkGET /api/security/secretsPOST /api/security/secrets/setPOST /api/security/secrets/get
GET /api/tunnelsPOST /api/tunnelsGET /api/tunnels/activeGET /api/tunnels/:tunnelIdPATCH /api/tunnels/:tunnelIdPOST /api/tunnels/:tunnelId/activatePOST /api/tunnels/:tunnelId/deactivate
POST /api/memory/indexPOST /api/memory/searchPOST /api/memory/reindexPOST /api/memory/graph/queryGET /api/memory/graph/statsGET /api/memory/stats
POST /api/evals/company/:runId
GET /api/heartbeat/jobsPOST /api/heartbeat/jobsGET /api/heartbeat/jobs/:jobIdPOST /api/heartbeat/jobs/:jobId/runPOST /api/heartbeat/jobs/:jobId/pausePOST /api/heartbeat/jobs/:jobId/resumeGET /api/heartbeat/runsGET /api/heartbeat/outboxPOST /api/heartbeat/outbox/process
POST /api/setup/wizard/runGET /api/setup/wizard/runsGET /api/setup/wizard/:runId
GET /api/missionsPOST /api/missionsGET /api/missions/:missionIdPOST /api/missions/:missionId/simulatePOST /api/missions/:missionId/startGET /api/missions/:missionId/councilGET /api/missions/:missionId/council/runsPOST /api/missions/:missionId/council/run
POST /api/missions/:missionId/tasksPATCH /api/missions/:missionId/tasks/:taskId
POST /api/missions/:missionId/actionsactionType:read|write|external_send|financial|destructive- optional
idempotencyKeyto prevent duplicate side effects - high-risk actions create approval requests automatically
POST /api/approvals/:approvalId/decisiondecision:approve|reject
GET /api/missions/:missionId/timelineGET /api/missions/:missionId/metrics
GET /api/observability/eventsGET /api/observability/metricsGET /api/observability/tracesGET /api/observability/traces/:traceId
POST /api/verify
GET /api/agentsPOST /api/agentsGET /api/agents/:agentIdPATCH /api/agents/:agentId
GET /api/agents/:agentId/skillsPOST /api/agents/:agentId/skillsPOST /api/agents/:agentId/skills/generateGET /api/agents/:agentId/skills/:skillIdPATCH /api/agents/:agentId/skills/:skillIdGET /api/agents/:agentId/skills/:skillId/memoryPOST /api/agents/:agentId/skills/:skillId/memory
GET /api/councils/:councilIdGET /api/council-runs/:runId
POST /api/missions/:missionId/council/run supports:
subAgentIds(optional): manual sub-agent listteamSize(optional): auto-assembly size whensubAgentIdsis omitteddebateRounds(optional): number of challenge/rebuttal rounds (1-4)idempotencyKey(optional): replay-safe council execution keyautoSpawnSubAgents(optional, defaulttrue): spawn specialist sub-agents when capacity is missingautoGenerateSkills(optional, defaulttrue): generate/reuse per-workstream skills and write skill memory
curl -X POST http://localhost:3001/api/missions \
-H "Content-Type: application/json" \
-d '{
"title": "Book 12 demos",
"objective": "Increase qualified pipeline",
"kpi": "12 booked demos in 14 days",
"deadline": "2026-03-15",
"policyPreset": "balanced"
}'curl -X POST http://localhost:3001/api/agents \
-H "Content-Type: application/json" \
-d '{
"name": "Scout",
"role": "sub",
"skills": ["research", "analysis", "strategy"],
"model": {
"primary": "anthropic/claude-3-5-sonnet-latest",
"fallbacks": ["openai/gpt-4o-mini", "gemini/gemini-1.5-pro"]
},
"canUseWeb": true,
"soul": {
"mission": "Find truth and challenge assumptions.",
"values": ["clarity", "evidence"],
"communicationStyle": "direct",
"riskTolerance": "balanced"
}
}'Per-agent model policy is supported for both main and sub agents:
agent.model.primary: first model ref (provider/model)agent.model.fallbacks: ordered fallback refs
When present:
- channel chat uses the session
metadata.activeAgentIdmodel policy when provided; otherwise it prefers workspace main agent model policy - council skill generation for that agent can auto-use its model policy
POST /api/agents/:agentId/skills/generatewith"llm": {}uses the agent model policy
curl -X POST http://localhost:3001/api/missions/<missionId>/council/run \
-H "Content-Type: application/json" \
-d '{
"problem": "How do we increase activation without harming reliability?",
"mainAgentId": "<mainAgentId>",
"subAgentIds": ["<subAgentA>", "<subAgentB>", "<subAgentC>"],
"idempotencyKey": "council-activation-001",
"debateRounds": 2,
"autoSpawnSubAgents": true,
"autoGenerateSkills": true,
"allowWebResearch": true
}'Council runs are queued by mission lane (mission:<missionId>) so overlapping runs for the same mission execute safely in order while different missions can run in parallel.
If you omit subAgentIds, SOVEREIGN auto-assembles a specialist team from available sub-agents in the same workspace using skills + soul matching. If the workspace has fewer specialists than requested, it can auto-spawn specialist sub-agents with role-specific souls.
curl -X POST http://localhost:3001/api/company/execute \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "default",
"objective": "Plan launch, ship reliability fixes, and update sales assets",
"runtimeEscalationEnabled": true,
"runtimePauseOnHighRiskStream": true,
"runtimePauseOnLowConsensus": true,
"runtimeLowConsensusThreshold": 0.65
}'curl -X POST http://localhost:3001/api/company/runs/<runId>/resume \
-H "Content-Type: application/json" \
-d '{
"decision": "approve",
"note": "Approved by founder. Continue.",
"runtimePauseOnLowConsensus": false
}'curl -X POST http://localhost:3001/api/architecture/company-plan \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "default",
"objective": "Increase sales demos while shipping reliable product improvements.",
"teamSize": 4,
"debateRounds": 2,
"autoSpawnSubAgents": true,
"autoGenerateSkills": true
}'curl -X POST http://localhost:3001/api/architecture/soul/evolve \
-H "Content-Type: application/json" \
-d '{
"agentId": "<agentId>",
"performanceScore": 0.42,
"outcome": "Incident occurred. Add stronger verification and risk control."
}'curl "http://localhost:3001/api/architecture/soul/<agentId>/history?limit=20"curl -X POST http://localhost:3001/api/architecture/soul/<agentId>/rollback \
-H "Content-Type: application/json" \
-d '{
"targetVersion": 1,
"reason": "rollback after regression"
}'curl -X POST http://localhost:3001/api/heartbeat/outbox/process \
-H "Content-Type: application/json" \
-d '{
"limit": 50
}'curl -X POST http://localhost:3001/api/agents/<agentId>/skills/generate \
-H "Content-Type: application/json" \
-d '{
"task": "Fix checkout bug and add regression tests",
"seedMemory": {
"note": "Root cause likely stale cart cache",
"source": "mission.bootstrap"
}
}'curl -X POST http://localhost:3001/api/agents/<agentId>/skills/generate \
-H "Content-Type: application/json" \
-d '{
"task": "Fix checkout bug and add regression tests",
"llm": {
"provider": "anthropic",
"model": "claude-3-5-sonnet-latest",
"temperature": 0.2
}
}'curl -X POST http://localhost:3001/api/llm/respond \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "default",
"traceId": "trace-demo-001",
"modelRef": "gemini/gemini-1.5-pro",
"fallbacks": ["openai/gpt-4o-mini"],
"prompt": "Summarize this mission objective in 2 lines."
}'/api/llm/respond response now includes telemetry fields:
durationMsusageNormalized(promptTokens,completionTokens,totalTokens)costUsd(estimated, if configured)
import { SovereignClient } from "@sovereign/client";
const client = new SovereignClient({
baseUrl: "http://localhost:3001"
});
const run = await client.executeCompanyObjective({
workspaceId: "default",
objective: "Plan, execute, and verify launch readiness."
});
console.log(run);from sdk.python.sovereign_client import SovereignClient
client = SovereignClient(base_url="http://localhost:3001")
print(client.health())
print(client.list_company_runs())Plugins live under plugins/<plugin-folder>/ with:
plugin.jsonmanifest- module file (default
index.js) exporting a function (default export or namedregister)
Manifest example:
{
"id": "hello-world",
"name": "Hello World Plugin",
"version": "0.1.0",
"description": "Example plugin tools",
"entry": "index.js",
"permissions": {
"network": false,
"filesystem": false
}
}Plugin module example:
import { definePlugin, defineTool } from "../../src/plugins/sdk.js";
export default definePlugin(() => ({
tools: [
defineTool({
name: "echo",
actionType: "read",
inputSchema: {
type: "object",
required: ["text"],
properties: {
text: { type: "string" }
}
},
async run({ input }) {
return { echoed: input.text };
}
})
]
}));Tool actionType supports:
readwriteexternal_sendfinancialdestructive
Every plugin tool call is mediated by runtime policy and recorded in runtime audits with redacted snapshots.
- Runtime and host tools:
filesystem,shell-executor,system-info,browser-playwright,vision - Autonomy and scheduling:
scheduling,hibernation,webhook-router,mcp-client - Memory and self-improvement:
dialectic-memory,trajectory-compressor,core-mutator,meta-engineering - Coordination and network surfaces:
swarm-protocol,company-bank - Example / starter:
hello-world
curl http://localhost:3001/api/pluginscurl -X POST http://localhost:3001/api/plugins/reloadcurl -X POST http://localhost:3001/api/plugins/hello-world/tools/echo/invoke \
-H "Content-Type: application/json" \
-d '{
"input": {
"text": "hello plugin"
}
}'SOVEREIGN now includes a channel gateway with built-in adapters:
local(for browser/terminal/API testing)telegramwhatsapp(Meta Cloud API format)
export CHAT_PROVIDER="openai" # default chat provider for channel replies
export DEFAULT_WORKSPACE_ID="default"
export AUTOPILOT_POLL_MS="3000" # background loop polling interval
export AUTOPILOT_MAX_CYCLES="12" # max execution cycles per goal
export TELEGRAM_BOT_TOKEN="..."
export TELEGRAM_WEBHOOK_SECRET="..."
export WHATSAPP_ACCESS_TOKEN="..."
export WHATSAPP_VERIFY_TOKEN="..."
export WHATSAPP_PHONE_NUMBER_ID="..."curl -X POST http://localhost:3001/api/channels/local/webhook \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "default",
"chatId": "founder-chat",
"userId": "borhen",
"text": "/help"
}'curl -X POST http://localhost:3001/api/autopilot/goals \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "default",
"title": "Prepare launch brief",
"objective": "Draft, validate, and finalize launch brief with execution plan",
"maxCycles": 20,
"notifyTargets": [
{
"channelId": "local",
"chatId": "founder-dm",
"userId": "founder"
}
]
}'Manual single-step run (for testing/debug):
curl -X POST http://localhost:3001/api/autopilot/goals/<goalId>/runSet your Telegram webhook to:
https://<your-domain>/api/channels/telegram/webhook?secret=<your-secret>
In Meta webhook config:
- Verify URL:
https://<your-domain>/api/channels/whatsapp/webhook - Verify token: same value as
WHATSAPP_VERIFY_TOKEN
curl -X POST http://localhost:3001/api/agents/<agentId>/skills/<skillId>/memory \
-H "Content-Type: application/json" \
-d '{
"note": "Patch reduced checkout failure rate by 40%",
"outcome": "improved conversion",
"source": "task.run",
"score": 0.84
}'npm testCurrent local verification target:
npm run buildnpm test
- License:
LICENSE(Apache-2.0) - Contribution guide:
CONTRIBUTING.md - Code of conduct:
CODE_OF_CONDUCT.md - Security policy:
SECURITY.md - Deployment guide:
DEPLOYMENT.md - Operator runbook:
RUNBOOK.md - Support guide:
SUPPORT.md - Changelog:
CHANGELOG.md - Docs index:
docs/README.md - TypeScript SDK guide:
sdk/ts/README.md
- CI workflow:
.github/workflows/ci.yml - Security workflow:
.github/workflows/security.yml - Release workflow (tags
v*):.github/workflows/release.yml
