Pure Planning and Capability Brokering for LegiVellum
DeleGate is a task delegation framework that decomposes high-level intent into structured execution Plans. It brokers capability between principals (AI agents) and self-describing workers (MCP servers), but DeleGate itself never executes work—it only produces Plans.
Specification: v0 (DRAFT) Implementation: Phase 1 MVP (Initial Draft)
See: SPEC-DG-0000.txt for complete specification.
# Install dependencies
pip install -e ".[dev]"
# Set environment variables
export DELEGATE_DATABASE_URL="postgresql+asyncpg://postgres:postgres@localhost:5432/delegate"
export DELEGATE_RECEIPTGATE_URL="http://localhost:8003"
export DELEGATE_RECEIPTGATE_API_KEY="dg_your-secret-api-key-here"
export DELEGATE_MEMORYGATE_URL="http://localhost:8001" # deprecated
export DELEGATE_ASYNCGATE_URL="http://localhost:8002"
# Run database migrations
alembic upgrade head
# Start the server
python -m delegate.main
src/delegate/
- __init__.py # Package exports
- models.py # Pydantic models (Plan, Steps, Workers, Trust)
- config.py # Configuration via environment
- database.py # PostgreSQL async connection
- registry.py # Worker registry with capability matching
- planner.py # Plan generation logic
- receipts.py # ReceiptGate receipt emission
- mcp_http.py # MCP HTTP JSON-RPC interface
- main.py # Application entry point
CRITICAL INVARIANT: If output is not a valid Plan, DeleGate has failed.
DeleGate is a pure planner:
- Input: Intent (natural language or structured) + optional context
- Output: Plan (structured, validated) OR Escalation (cannot plan)
- Never: Executes work, tracks progress, retries, or makes decisions for principals
Plans consist of three sections:
- Metadata - plan_id, confidence, scope, trust policy
- Steps - Five step types: call_worker, queue_execution, wait_for, aggregate, escalate
- References - Input sources (MemoryGate) and expected outputs (AsyncGate)
DeleGate maintains a live registry of available workers through MCP introspection:
- Workers self-register with tool manifests
- Semantic capability matching
- Trust tier validation (trusted, verified, sandbox, untrusted)
- Performance hints (latency, cost, availability)
- call_worker - Direct synchronous execution
- queue_execution - Async execution via AsyncGate
- wait_for - Block until receipts/tasks complete
- aggregate - Request synthesis by principal
- escalate - Cannot proceed, deliver report and request decision
Trust is NOT transitive. Principal trusting DeleGate ≠ auto-trusting Workers.
Trust tiers:
- Trusted (tier 3): Signed by root authority, full access
- Verified (tier 2): Code audit, organization-approved
- Sandbox (tier 1): Isolated execution, limited resources
- Untrusted (tier 0): Manual approval, full audit
create_delegation_plan- Create plan from intentanalyze_intent- Analyze intent without creating planregister_worker- Register worker with capabilitiessearch_workers- Search workers by capabilitylist_workers- List all registered workers
DeleGate exposes MCP over HTTP at /mcp with JSON-RPC methods:
tools/listtools/call
pytest tests/ -vProprietary - Technomancy Labs