Skip to content
 
 

Repository files navigation

Shannon — Production AI Agents That Actually Work

License: MIT Documentation Docker Hub Version Go Version Rust PRs Welcome

Battle-tested infrastructure for AI agents that solves the problems you hit at scale: runaway costs, non-deterministic failures, and security nightmares.

Shannon Desktop App

Native desktop app showing real-time agent execution and event streams

Why Shannon?

The Problem Shannon's Solution
Agents fail silently? Temporal workflows with time-travel debugging — replay any execution step-by-step
Costs spiral out of control? Hard token budgets per task/agent with automatic model fallback
No visibility into what happened? Real-time dashboard, Prometheus metrics, OpenTelemetry tracing
Security concerns? WASI sandbox for code execution, OPA policies, multi-tenant isolation
Vendor lock-in? Works with OpenAI, Anthropic, Google, DeepSeek, local models

Quick Start

Prerequisites

  • Docker and Docker Compose
  • An API key for at least one LLM provider (OpenAI, Anthropic, etc.)

Installation

Quick Install:

curl -fsSL https://raw.githubusercontent.com/Kocoro-lab/Shannon/v0.1.0/scripts/install.sh | bash

This downloads config, prompts for API keys, pulls Docker images, and starts services.

Required API Keys (choose one):

  • OpenAI: OPENAI_API_KEY=sk-...
  • Anthropic: ANTHROPIC_API_KEY=sk-ant-...
  • Or any OpenAI-compatible endpoint

Optional but recommended:

Building from source? See Development below.

Platform-specific guides: Ubuntu · Rocky Linux · Windows · Windows (中文)

Your First Agent

Shannon provides multiple ways to interact with AI agents. Choose the option that works best for you:

Option 1: REST API

Use Shannon's HTTP REST API directly. For complete API documentation, see docs.shannon.run.

# Submit a task
curl -X POST http://localhost:8080/api/v1/tasks \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is the capital of France?",
    "session_id": "demo-session"
  }'

# Response: {"task_id":"task-dev-123","status":"running"}

# Stream events in real-time
curl -N "http://localhost:8080/api/v1/stream/sse?workflow_id=task-dev-123"

# Get final result
curl "http://localhost:8080/api/v1/tasks/task-dev-123"

Perfect for:

  • Integrating Shannon into existing applications
  • Automation scripts and workflows
  • Language-agnostic integration

Option 2: Python SDK

Install the official Shannon Python SDK:

pip install shannon-sdk
from shannon import ShannonClient

# Create client
with ShannonClient(base_url="http://localhost:8080") as client:
    # Submit task
    handle = client.submit_task(
        "What is the capital of France?",
        session_id="demo-session"
    )

    # Wait for completion
    result = client.wait(handle.task_id)
    print(result.result)

CLI is also available:

shannon submit "What is the capital of France?"

Perfect for:

  • Python-based applications and notebooks
  • Data science workflows
  • Batch processing and automation

See Python SDK Documentation for the full API reference.

Option 3: Native Desktop App

Download pre-built desktop applications from GitHub Releases:

Or build from source:

cd desktop
npm install
npm run tauri:build  # Builds for your platform

Native app benefits:

  • System tray integration and native notifications
  • Offline task history (Dexie.js local database)
  • Better performance and lower memory usage
  • Auto-updates from GitHub releases

See Desktop App Guide for more details.

Option 4: Web UI (Needs Source Download)

Run the desktop app as a local web server for development:

# In a new terminal (backend should already be running)
cd desktop
npm install
npm run dev

# Open http://localhost:3000 in your browser

Perfect for:

  • Quick testing and exploration
  • Development and debugging
  • Real-time event streaming visualization

Configuring Tool API Keys

Add these to your .env file based on which tools you need:

# Web Search (choose one provider)
WEB_SEARCH_PROVIDER=serpapi             # serpapi | google | bing | exa
SERPAPI_API_KEY=your-serpapi-key        # serpapi.com
# OR
GOOGLE_SEARCH_API_KEY=your-google-key   # Google Custom Search
GOOGLE_SEARCH_ENGINE_ID=your-engine-id

# Web Fetch/Crawl (for deep research)
WEB_FETCH_PROVIDER=firecrawl            # firecrawl | exa | python
FIRECRAWL_API_KEY=your-firecrawl-key    # firecrawl.dev (recommended for production)

Tip: For quick setup, just add SERPAPI_API_KEY. Get a key at serpapi.com.

Ports & Endpoints

Service Port Endpoint Purpose
Gateway 8080 http://localhost:8080 REST API, OpenAI-compatible /v1
Admin/Events 8081 http://localhost:8081 SSE/WebSocket streaming, health
Orchestrator 50052 localhost:50052 gRPC (internal)
Temporal UI 8088 http://localhost:8088 Workflow debugging
Grafana 3030 http://localhost:3030 Metrics dashboard

Architecture

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│   Client    │────▶│ Orchestrator │────▶│ Agent Core  │
│  (SDK/API)  │     │     (Go)     │     │   (Rust)    │
└─────────────┘     └──────────────┘     └─────────────┘
                           │                    │
                    ┌──────┴──────┐      ┌──────┴──────┐
                    │  Temporal   │      │    WASI     │
                    │  Workflows  │      │   Sandbox   │
                    └─────────────┘      └─────────────┘
                           │
                    ┌──────┴──────┐
                    │ LLM Service │
                    │  (Python)   │
                    └─────────────┘

Components:

  • Orchestrator (Go) — Task routing, budget enforcement, session management, OPA policies
  • Agent Core (Rust) — WASI sandbox, policy enforcement, agent-to-agent communication
  • LLM Service (Python) — Provider abstraction (15+ LLMs), MCP tools, prompt optimization
  • Data Layer — PostgreSQL (state), Redis (sessions), Qdrant (vector memory)

Core Capabilities

OpenAI-Compatible API

# Drop-in replacement for OpenAI API
export OPENAI_API_BASE=http://localhost:8080/v1
# Your existing OpenAI code works unchanged

Real-time Event Streaming

# Monitor agent execution in real-time (SSE)
curl -N "http://localhost:8080/api/v1/stream/sse?workflow_id=task-dev-123"

# Events include:
# - WORKFLOW_STARTED, WORKFLOW_COMPLETED
# - AGENT_STARTED, AGENT_COMPLETED
# - TOOL_INVOKED, TOOL_OBSERVATION
# - LLM_PARTIAL, LLM_OUTPUT

Research Workflows

# Multi-agent research with automatic synthesis
curl -X POST http://localhost:8080/api/v1/tasks \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Compare renewable energy adoption in EU vs US",
    "context": {
      "force_research": true,
      "research_strategy": "deep"
    }
  }'
# Orchestrates multiple research agents and synthesizes findings with citations

Session Continuity

# Multi-turn conversations with context memory
curl -X POST http://localhost:8080/api/v1/tasks \
  -H "Content-Type: application/json" \
  -d '{"query": "What is GDP?", "session_id": "econ-101"}'

# Follow-up remembers previous context (within history window)
curl -X POST http://localhost:8080/api/v1/tasks \
  -H "Content-Type: application/json" \
  -d '{"query": "How does it relate to inflation?", "session_id": "econ-101"}'
# Agent recalls recent conversation history from the same session

Scheduled Tasks

# Run tasks on a schedule (cron syntax)
curl -X POST http://localhost:8080/api/v1/schedules \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Daily Market Analysis",
    "cron_expression": "0 9 * * *",
    "task_query": "Analyze market trends",
    "max_budget_per_run_usd": 0.50
  }'

15+ LLM Providers

  • OpenAI: GPT-4, GPT-3.5, GPT-4 Turbo
  • Anthropic: Claude 3 Opus/Sonnet/Haiku, Claude 3.5 Sonnet
  • Google: Gemini Pro, Gemini Ultra
  • DeepSeek: DeepSeek Chat, DeepSeek Coder
  • Local Models: Ollama, LM Studio, vLLM
  • Automatic failover between providers

MCP Integration

Native support for Model Context Protocol:

  • Custom tool registration
  • OAuth2 server authentication
  • Rate limiting and circuit breakers
  • Cost tracking for MCP tool usage

Key Features

Time-Travel Debugging (Needs Source Download)

# Production agent failed? Replay it locally step-by-step
./scripts/replay_workflow.sh task-prod-failure-123

# Output shows every decision, tool call, and state change

Token Budget Control

curl -X POST http://localhost:8080/api/v1/tasks \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Generate a market analysis report",
    "config": {
      "budget": {
        "max_tokens": 5000,
        "fallback_model": "gpt-5-mini-2025-08-07"
      }
    }
  }'
# Automatically switches to cheaper model when 80% budget consumed

OPA Policy Governance

# config/opa/policies/teams.rego
package shannon.teams

allow {
    input.team == "data-science"
    input.model in ["gpt-5-2025-08-07", "claude-sonnet-4-5-20250929"]
}

deny_tool["database_write"] {
    input.team == "support"
}

Secure Code Execution

# Python runs in isolated WASI sandbox — no network, read-only FS
./scripts/submit_task.sh "Execute Python: import os; os.system('rm -rf /')"
# Result: OSError - system calls blocked by WASI sandbox

Shannon vs. Alternatives

Capability Shannon LangGraph Dify AutoGen CrewAI
Scheduled Tasks ✅ Cron-based workflows ⚠️ Basic
Research Workflows ✅ Multi-strategy (5 types) ⚠️ Manual setup ⚠️ Manual setup ⚠️ Manual setup ⚠️ Manual setup
Deterministic Replay ✅ Time-travel debugging
Token Budget Limits ✅ Hard caps + auto-fallback
Security Sandbox ✅ WASI isolation
OPA Policy Control ✅ Fine-grained governance
Production Metrics ✅ Dashboard/Prometheus ⚠️ DIY ⚠️ Basic
Native Desktop Apps ✅ macOS/iOS
Multi-Language Core ✅ Go/Rust/Python ⚠️ Python only ⚠️ Python only ⚠️ Python only ⚠️ Python only
Session Persistence ✅ Redis-backed ⚠️ In-memory ✅ Database ⚠️ Limited
Multi-Agent Orchestration ✅ DAG/Supervisor/Strategies ✅ Graphs ⚠️ Workflows ✅ Group chat ✅ Crews

Built for Enterprise

  • Multi-Tenant Isolation — Separate memory, budgets, and policies per tenant
  • Human-in-the-Loop — Configurable approval workflows for sensitive operations
  • Audit Trail — Complete trace of every decision and data access
  • On-Premise Ready — No cloud dependencies, runs entirely in your infrastructure

Configuration

Shannon uses layered configuration:

  1. Environment Variables (.env) — API keys, secrets
  2. YAML Files (config/) — Feature flags, model pricing, policies

Key files:

  • config/models.yaml — LLM providers, pricing, tier configuration
  • config/features.yaml — Feature toggles, workflow settings
  • config/opa/policies/ — Access control rules

See Configuration Guide for details.

Troubleshooting

Health Checks

# Check all services
docker compose -f deploy/compose/docker-compose.release.yml ps

# Gateway health
curl http://localhost:8080/health

# Admin health
curl http://localhost:8081/health

View Logs

# All services
docker compose -f deploy/compose/docker-compose.release.yml logs -f

# Specific service
docker compose -f deploy/compose/docker-compose.release.yml logs -f orchestrator
docker compose -f deploy/compose/docker-compose.release.yml logs -f gateway
docker compose -f deploy/compose/docker-compose.release.yml logs -f llm-service

Common Issues

Services not starting:

  • Check .env has required API keys (OPENAI_API_KEY or ANTHROPIC_API_KEY)
  • Ensure ports 8080, 8081, 50052 are not in use
  • Run docker compose -f deploy/compose/docker-compose.release.yml down && docker compose -f deploy/compose/docker-compose.release.yml up -d to recreate

Task execution fails:

  • Verify LLM API key is valid: echo $OPENAI_API_KEY
  • Check orchestrator logs for errors
  • Ensure config files exist in ./config/ directory

Out of memory:

  • Reduce WASI_MEMORY_LIMIT_MB (default: 512)
  • Lower HISTORY_WINDOW_MESSAGES (default: 50)
  • Check Docker memory limits

Documentation

Resource Description
Official Docs Full documentation site
Architecture System design deep-dive
API Reference Agent Core API
Streaming APIs SSE and WebSocket streaming
Python Execution WASI sandbox guide
Adding Tools Custom tool development

Development

Building from Source

For contributors who want to build and run Shannon locally:

# Clone the repository
git clone https://github.com/Kocoro-lab/Shannon.git
cd Shannon

# Setup development environment
make setup                              # Creates .env, generates proto files
echo "OPENAI_API_KEY=sk-..." >> .env    # Add your API key
./scripts/setup_python_wasi.sh          # Download Python WASI interpreter (~20MB)

# Start all services (builds locally)
make dev

# Run tests
make smoke  # E2E smoke tests
make ci     # Full CI suite

Using Pre-built Images (No Build)

If you cloned the repo but want to use pre-built images instead of building:

cd Shannon
cp .env.example .env
nano .env  # Add your API keys
docker compose -f deploy/compose/docker-compose.release.yml up -d

Development Commands

make lint   # Run linters (Go, Rust, Python)
make fmt    # Format code
make proto  # Regenerate proto files
make logs   # View service logs
make ps     # Service status
make down   # Stop all services

See CONTRIBUTING.md for full development guidelines.

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

License

MIT License — Use it anywhere, modify anything. See LICENSE.


Stop debugging AI failures. Start shipping reliable agents.

GitHub · Docs · X

About

A production-oriented multi-agent orchestration framework.

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages