agent-runtime-mcp

agent-runtime-mcp

Enables persistent task and goal management with AI-powered decomposition, cross-session continuity, and fault-tolerant multi-agent pipelines.

Category
Visit Server

README

Agent Runtime MCP

Persistent task queues and goal decomposition for cross-session AGI autonomy with God Agent integration.

Description

Agent Runtime MCP provides persistent task management that survives across sessions, enabling true autonomous AGI workflows. Features include:

  • Persistent Goals & Tasks: SQLite-backed storage that survives restarts
  • AI-Powered Goal Decomposition: Break complex goals into executable tasks
  • Dependency Management: Automatic task ordering based on dependencies
  • Priority Queuing: Intelligent task scheduling by priority and readiness
  • Relay Race Protocol (God Agent Phase 2): 48-agent pipelines with structured handoffs
  • Circuit Breaker (God Agent Phase 5): Fault tolerance with automatic fallback
  • Cross-Session Continuity: Resume work exactly where you left off

Installation

Using pip

git clone https://github.com/marc-shade/agent-runtime-mcp
cd agent-runtime-mcp
pip install -r requirements.txt

Using uv (recommended)

git clone https://github.com/marc-shade/agent-runtime-mcp
cd agent-runtime-mcp
uv pip install -r requirements.txt

Dependencies

pip install anthropic-mcp

Configuration

Add to ~/.claude.json:

{
  "mcpServers": {
    "agent-runtime": {
      "command": "python3",
      "args": [
        "/absolute/path/to/agent-runtime-mcp/server.py"
      ]
    }
  }
}

Tools

Core Goal & Task Management (9)

Tool Description
create_goal Create high-level goal with name and description
decompose_goal Use AI to break goal into tasks (sequential/parallel/hierarchical)
create_task Manually create task with dependencies
get_next_task Get next ready task from queue (highest priority, deps met)
update_task_status Update status (pending/in_progress/completed/failed/cancelled)
list_goals List all goals, optionally filtered by status
list_tasks List tasks by goal, status, with limit
get_goal Get goal details by ID
get_task Get task details by ID

Relay Race Protocol (God Agent Phase 2) (6)

Tool Description
create_relay_pipeline Create 48-agent relay race with baton passing
get_relay_status Get pipeline status (progress, quality scores)
advance_relay Pass baton to next agent after completing step
retry_relay_step Retry failed step without restarting pipeline
list_relay_pipelines List pipelines by status
get_relay_baton Get current baton with context for next agent

Circuit Breaker (God Agent Phase 5: Tiny Dancer) (7)

Tool Description
circuit_breaker_status Get breaker state (CLOSED/OPEN/HALF_OPEN)
circuit_breaker_list List all breakers with open/degraded circuits
circuit_breaker_trip Manually trip breaker to OPEN state
circuit_breaker_reset Reset breaker to CLOSED state
circuit_breaker_configure Configure thresholds (failures, window, cooldown)
circuit_breaker_record_failure Record failure for tracking
circuit_breaker_record_success Record success (helps recovery)

Usage Examples

Basic Goal Creation

# Create goal
goal = mcp__agent-runtime__create_goal({
    "name": "Build REST API",
    "description": "Create RESTful API for user authentication with JWT tokens",
    "metadata": {"priority": "high", "project": "auth-service"}
})
# Returns: {"id": 1, "name": "Build REST API", "status": "active", ...}

AI Goal Decomposition

# Decompose goal into tasks (sequential strategy)
result = mcp__agent-runtime__decompose_goal({
    "goal_id": 1,
    "strategy": "sequential"
})
# Returns: {
#   "goal_id": 1,
#   "strategy": "sequential",
#   "tasks_created": [101, 102, 103, 104, 105],
#   "count": 5
# }
# Tasks: Research → Plan → Implement → Test → Document (with dependencies)

Parallel Decomposition

# Decompose for parallel execution
result = mcp__agent-runtime__decompose_goal({
    "goal_id": 1,
    "strategy": "parallel"
})
# Creates: Backend, Frontend, Testing tasks (no dependencies, run simultaneously)

Hierarchical Decomposition

# Decompose into phases
result = mcp__agent-runtime__decompose_goal({
    "goal_id": 1,
    "strategy": "hierarchical"
})
# Creates: Phase 1 (Foundation) → Phase 2 (Core) → Phase 3 (Integration) → Phase 4 (Optimization)

Task Queue Processing

# Get next ready task
task = mcp__agent-runtime__get_next_task()
# Returns: Highest priority task with all dependencies met
# {"id": 101, "title": "Research requirements...", "priority": 10, ...}

# Start work
mcp__agent-runtime__update_task_status({
    "task_id": 101,
    "status": "in_progress"
})

# Complete task
mcp__agent-runtime__update_task_status({
    "task_id": 101,
    "status": "completed",
    "result": "Requirements documented in docs/api-spec.md"
})

# Get next (automatically handles dependencies)
next_task = mcp__agent-runtime__get_next_task()
# Returns: Task 102 (Plan approach) since Research (101) is complete

Manual Task Creation with Dependencies

# Create task with explicit dependencies
mcp__agent-runtime__create_task({
    "goal_id": 1,
    "title": "Deploy to production",
    "description": "Deploy authentication service",
    "priority": 7,
    "dependencies": [103, 104]  # Wait for Implementation and Testing
})

Relay Race Pipeline (48-Agent)

# Create relay pipeline for complex workflow
pipeline = mcp__agent-runtime__create_relay_pipeline({
    "name": "Research Paper Analysis",
    "goal": "Extract insights from 10 AGI papers",
    "agent_types": [
        "researcher",      # Gather papers
        "analyzer",        # Extract key points
        "synthesizer",     # Find patterns
        "validator",       # Check quality
        "formatter"        # Create report
    ],
    "token_budget": 100000
})
# Returns: {"pipeline_id": "rp_abc123", "agent_count": 5, ...}

# Check pipeline status
status = mcp__agent-runtime__get_relay_status({
    "pipeline_id": "rp_abc123"
})
# Returns: {
#   "current_step": 2,
#   "total_steps": 5,
#   "status": "in_progress",
#   "quality_scores": [0.92, 0.88, ...],
#   "tokens_used": 24531
# }

# Get current baton (context for next agent)
baton = mcp__agent-runtime__get_relay_baton({
    "pipeline_id": "rp_abc123"
})
# Returns: {
#   "baton": {...},
#   "prompt": "You are the Synthesizer. Previous output: ..."
# }

# Advance to next step
mcp__agent-runtime__advance_relay({
    "pipeline_id": "rp_abc123",
    "quality_score": 0.88,
    "l_score": 0.85,
    "output_entity_id": 456,
    "tokens_used": 8234,
    "output_summary": "Found 3 key patterns across papers"
})

# Retry failed step
mcp__agent-runtime__retry_relay_step({
    "pipeline_id": "rp_abc123",
    "step_index": 2
})

Circuit Breaker (Fault Tolerance)

# Check agent circuit breaker status
status = mcp__agent-runtime__circuit_breaker_status({
    "agent_id": "researcher_agent"
})
# Returns: {
#   "agent_id": "researcher_agent",
#   "state": "CLOSED",
#   "failure_count": 0,
#   "success_count": 42
# }

# Record failure
mcp__agent-runtime__circuit_breaker_record_failure({
    "agent_id": "researcher_agent",
    "failure_type": "timeout",
    "error_message": "API request timed out after 30s"
})

# List all circuit breakers
breakers = mcp__agent-runtime__circuit_breaker_list()
# Returns: {
#   "total_breakers": 10,
#   "open_circuits": ["failing_agent_1", "failing_agent_2"],
#   "half_open_circuits": ["recovering_agent"],
#   "breakers": [...]
# }

# Configure thresholds
mcp__agent-runtime__circuit_breaker_configure({
    "agent_id": "researcher_agent",
    "failure_threshold": 5,
    "window_seconds": 60,
    "cooldown_seconds": 300,
    "fallback_agent": "generalist"
})

# Manually trip (emergency stop)
mcp__agent-runtime__circuit_breaker_trip({
    "agent_id": "researcher_agent",
    "reason": "Manual intervention - debugging required"
})

# Reset after fix
mcp__agent-runtime__circuit_breaker_reset({
    "agent_id": "researcher_agent"
})

Cross-Session Resume

# Session 1: Create goal and start work
goal = mcp__agent-runtime__create_goal({"name": "Big Project", ...})
mcp__agent-runtime__decompose_goal({"goal_id": goal["id"]})
task1 = mcp__agent-runtime__get_next_task()
mcp__agent-runtime__update_task_status({"task_id": task1["id"], "status": "in_progress"})

# [Close Claude Code, restart later]

# Session 2: Resume exactly where left off
pending = mcp__agent-runtime__list_tasks({"status": "in_progress"})
# Returns: [task1] - still marked as in_progress
task1_updated = mcp__agent-runtime__update_task_status({
    "task_id": task1["id"],
    "status": "completed"
})
next_task = mcp__agent-runtime__get_next_task()
# Automatically gets task2 (next in dependency chain)

Requirements

  • Python: 3.10+
  • Dependencies: anthropic-mcp (MCP SDK)
  • Storage: ~/.claude/agent_runtime.db (SQLite)

Database Schema

Tables in ~/.claude/agent_runtime.db:

  • goals - High-level goals with status and metadata
  • tasks - Individual tasks with dependencies, priority, results
  • task_queue - Queue position and scheduling info
  • relay_pipelines - Relay race pipeline definitions (God Agent Phase 2)
  • relay_batons - Baton state for pipeline steps
  • circuit_breakers - Circuit breaker state and history (God Agent Phase 5)

Decomposition Strategies

Sequential

Task 1 → Task 2 → Task 3 → Task 4 → Task 5

Each task depends on previous. Linear execution.

Parallel

Task 1 (Backend)  ─┐
Task 2 (Frontend) ─┼─→ All run simultaneously
Task 3 (Testing)  ─┘

No dependencies. Maximum parallelism.

Hierarchical

Phase 1 (Foundation)
  ↓
Phase 2 (Core Implementation)
  ↓
Phase 3 (Integration)
  ↓
Phase 4 (Optimization)

Large phases that can be further decomposed.

Testing

# Run test suite
python3 test_agent_runtime.py

# Test relay protocol
python3 test_relay_protocol.py

# Test circuit breaker
python3 test_circuit_breaker.py

God Agent Integration

Phase 2: Relay Race Protocol

  • 48-agent sequential pipelines
  • Structured baton passing with context
  • Quality gates at each step
  • L-Score tracking for output quality
  • Single-step retry (no full restart)

Phase 5: Circuit Breaker (Tiny Dancer)

  • Automatic failure detection
  • State machine: CLOSED → OPEN → HALF_OPEN → CLOSED
  • Configurable thresholds and cooldowns
  • Fallback agent routing
  • Recovery monitoring

Links

  • GitHub: https://github.com/marc-shade/agent-runtime-mcp
  • Issues: https://github.com/marc-shade/agent-runtime-mcp/issues

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured