Skip to main content

🐉 Draco

An execution harness for RAG and agent systems.

CI License: MIT Python 3.11+ Status: alpha

📖 Documentation · 🤝 Contributing · 🛡️ Security · 🗺️ Roadmap · 📜 Changelog


🏗️ Overview

Draco is a lightweight Python package that runs any async workload under one lifecycle. Its only hard dependency is pydantic. It provides:

  • Access control: trusted identity, role-based authorization and default-deny tool policies.
  • Limits: budgets, rate limits and deadlines.
  • Reliability: idempotency and resumable steps.
  • Tracing: redacted traces.
  • Durable state: in-memory, SQLite or PostgreSQL.

It includes an agent registry and router, and a guarded tool runtime for native tools and, optionally, MCP tools. It also ships adapters for LangGraph, OpenAI-compatible providers and Anthropic.

🧩 Built on Draco: draco-rag is a FastAPI RAG and agent service that runs every chat, agent and resume request as a Draco workload. It started out in this repository as the starter app and now lives on its own.


🛠️ The Contract

Workload = Callable[[ExecutionContext, Any], Awaitable[Any]]

Anything matching this shape can be registered with the Harness:

import asyncio
from draco import Harness, Identity

async def greeter(ctx, name):
    return f"hello {name}"

async def main():
    h = Harness()
    h.register("greeter", greeter)
    r = await h.run("greeter", "world", identity=Identity("alice", "acme"))
    print(r.status, r.output, r.execution_id)   # Status.completed hello world <id>

asyncio.run(main())

run() always returns an ExecutionResult (completed | failed | cancelled | timeout | budget_exhausted | handoff | waiting). Failures are never reported as success; result.raise_for_status() re-raises them as typed DracoError.

🏛️ Architecture Layers

Package Responsibility Dependencies
draco.core ExecutionContext, Identity, Policy, budgets, results, typed errors, events pydantic
draco.harness Lifecycle: identity, auth, guardrails, execution, deadlines, persistence, resume()
draco.agents AgentRegistry, Router, handoffs, delegation, loop/depth limits
draco.tools Tool, ToolRegistry, ToolRuntime (policy, retries, untrusted output), MCP tools draco-harness[mcp]
draco.security Authorizer, audit events, Secret, FernetCipher (encryption at rest) draco-harness[crypto]
draco.state Execution/event/checkpoint stores (InMemory, Sqlite, Postgres); retention draco-harness[postgres]
draco.observability Tracer, redaction, JSONL and OpenTelemetry exporters draco-harness[otel]
draco.plugins Service registry, plugin host, input/output guardrails, rate limiting
draco.adapters Translation to external components (model_provider, providers, retrieval, ingestion, langgraph) see below

Dependency direction is enforced by tests: layers only import downward, and no Draco module imports application code.

⚙️ Installation

The package is named draco-harness; you still import draco. Once a release is on PyPI:

pip install draco-harness                  # native framework (pydantic only)
pip install "draco-harness[agents,providers]"

From a clone, for development (uv pip is recommended, but standard pip works identically):

uv pip install -e .              # Native framework
uv pip install -e ".[agents]"    # LangGraph adapter
uv pip install -e ".[providers]" # OpenAI-compatible / Anthropic model providers
uv pip install -e ".[postgres]"  # PostgreSQL state store
uv pip install -e ".[crypto]"    # Encryption at rest
uv pip install -e ".[mcp]"       # MCP tools
uv pip install -e ".[otel]"      # OpenTelemetry exporter
uv pip install -e ".[dev]"       # pytest, ruff, mypy

🔒 Security Model

Your application authenticates the caller and hands Draco an Identity(subject, tenant_id, roles).

  • User and tenant come from that identity. Child executions inherit it.
  • Nothing in input, tool arguments or metadata can override it.
  • Protected operations pass through an Authorizer before any side effect, and every decision is audited.
  • Tenant isolation covers resources, idempotency keys, resume and cancel.

👉 Full details: docs/api-guide.md#security

🔭 Observability & Persistence

  • Observability: Every lifecycle step emits an event. The Tracer redacts secrets and pseudonymises IDs before storing or exporting. A failing telemetry handler never breaks a run.
  • Persistence: Harness(store=SqliteStore(path)) persists executions, redacted events and step() checkpoints. resume(execution_id) re-runs under the same ID.
  • Retention: Purges old finished executions and never touches running or waiting ones. Encryption at rest (FernetCipher) covers input, output, error, event and step data.

🧪 Examples

Run via PYTHONPATH=src:. python -m examples.<name>. They also run as tests.

Example Description
a_simple Native workload, trace, persisted status
c_multi_agent Agent registry, capability routing, handoffs
d_tool Native tool, permissions, audit
e_recovery Steps, failure, resume
f_plugin Plugin with a service and hooks
g_secure_tenants Identity, tenant isolation, role grants
h_langgraph LangGraph graph through the adapter, interrupt and resume

A RAG example over a real retrieval service lives in draco-rag (examples/b_rag.py).


⚠️ Known Limitations

  • No authentication provider ships with Draco; you supply the Identity.
  • The rate limiter and the tracer's in-memory trace are per process.
  • Prompt-injection detection (draco.tools.safety) is a heuristic.
  • History rewritten (2026-11-27): runtime data and personal documents that were committed earlier were removed from every branch. Clones and forks made before that date still hold the old history, and GitHub may still serve old commits through closed pull requests. Details: docs/HISTORY_PURGE.md. To check a clone, run scripts/check_history_exposure.sh.

🗺️ Roadmap

Planned work, kept separate from what is implemented: docs/architecture/roadmap.md.


🤝 Contributing, Security & License

Contributions are welcome! Start with CONTRIBUTING.md for setup, CI checks, code and test standards, and pull request guidelines. Questions and ideas go to Discussions; see SUPPORT.md. Please read the Code of Conduct.

🚨 Found a vulnerability? Do not open a public issue. Follow SECURITY.md.

Quick development loop:

uv pip install -e ".[dev,providers]"
pytest tests/draco
ruff check src tests/draco examples
mypy src/draco

Licensed under the MIT License.

Metadata

Release files for draco-harness 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for draco-harness 0.1.0
File Size Uploaded Provenance Actions
draco_harness-0.1.0.tar.gz 61.6 kB With provenance Details for draco_harness-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for draco-harness 0.1.0
File Interpreter ABI Platform Actions
draco_harness-0.1.0-py3-none-any.whl Python 3 none any Details for draco_harness-0.1.0-py3-none-any.whl

Total release size: 140.3 kB

Release files / draco_harness-0.1.0.tar.gz

Download URL draco_harness-0.1.0.tar.gz
Size 61.6 kB
Tags Source
SHA-256 checksum
How to use checksums
878394cc4b6f73a52029372ed03a2cd132626c0289bd029a2a088e31c02205e8
BLAKE2b-256 checksum
How to use checksums
fdc73d8a02c35ea47fa9ee607ad78ca91eda02fdbdbbcee316a7b0a18468104b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / draco_harness-0.1.0-py3-none-any.whl

Download URL draco_harness-0.1.0-py3-none-any.whl
Size 78.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bda54856e1401155a4aeaf956aa62dfaec5062869f319db22429132c3cb6a8c
BLAKE2b-256 checksum
How to use checksums
e8b1023490e91ba1e7e6e085c8bd7e42d4d5f86c1d936cf67eb6454abf4413c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for draco-harness 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for draco_harness-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page