Durable execution, policy gating, and objective evaluation for tool-using AI agents.
The reference demo is a narrow e-commerce refund agent backed by mock commerce services. The system owns the runtime loop, policy gateway, execution receipts, replay, and deployment controls needed to test agent changes without handing correctness to an orchestration framework.
- Phase 0: domain models, mock commerce world, tool registry, and config loader.
- Phase 1: durable runtime with deterministic idempotency keys, receipts, retries, dead lettering, and crash-resume tests.
- Phase 2: deterministic policy gateway with schema, authorization, risk, budget, and durable approval pause checks.
- Phase 3: thin model loop that proposes structured tool calls while the runtime and gateway own execution.
- Phase 4: 50-scenario regression dataset, binary end-state oracle, weighted trajectory rubric, and evaluation CLI.
- Phase 5: structured logs, OpenTelemetry traces, Prometheus runtime metrics, FastAPI control plane, and React dashboard.
- Phase 6: SQLite/Postgres storage, SQLite/Redis queue paths, separate workers, dependency fault injection, and in-process/subprocess crash proofs with duplicate-effect metrics.
- Phase 7 (in progress): integrity-checked replay bundles verified in clean processes, fail-closed side-effect isolation, first-divergence analysis, paired version comparison, API, and dashboard; replay CLI/lineage and advanced workflows remain.
- Phase 8: durable deployment registry, evidence gates, side-effect-free shadow runs, deterministic canary rollback, freeze/kill switches, two-person overrides, multi-window canary health, and automatic promotion of failed canary/shadow runs into the regression corpus.
For the detailed tracker, see implementation.md.
py -3 -m pip install -e ".[dev]"
py -3 -m pytest tests/ -qCurrent backend verification on 2026-07-19: 176 passed, 2 skipped optional external-backend tests. The last dashboard verification reported 5 passed and a successful production build.
Run the deterministic crash proof locally:
agentops chaos crash-proof --iterations 100
agentops chaos fault-matrixRun a separate process that claims and resumes durable runtime jobs:
agentops worker --db agentops.sqlite3 --max-jobs 10Omit --max-jobs for a continuously polling worker. Failed handlers retry up to
--max-attempts and then move to the durable dead-letter table.
The crash-proof command isolates each run, kills execution after the refund effect but before the runtime receipt is written, resumes from the durable checkpoint, and reports the measured fault-recovery rate and duplicate refund count. The fault matrix separately exercises latency, HTTP 500, malformed JSON, missing-field, stale-data, and unavailable-dependency failures. Transient cases must recover; persistent variants are tested to dead-letter without duplicating side effects. The SQLite job store also locks the claim transaction before selecting work, so concurrent store instances cannot claim the same queued job; expired in-flight claims become eligible again after their visibility timeout.
Start the FastAPI control plane from the repository root:
py -3 -m uvicorn agentops.api:create_app --factory --reloadBy default, it stores control-plane records in agentops.db and loads scenarios from
scenarios/refund-regression/. Set AGENTOPS_DB_PATH to choose a different SQLite file.
Interactive API documentation is available at http://127.0.0.1:8000/docs.
In a second terminal, start the React dashboard:
cd dashboard
npm install
npm run devOpen http://127.0.0.1:5173. Vite proxies dashboard /api/* requests to the FastAPI
server at http://127.0.0.1:8000. The dashboard supports run/trace inspection and
durable approval decisions with required operator reasons. Persisted evaluation reports
render as oracle-first scorecards with per-scenario failure details. Registered agent
versions and configured scenarios can be selected to launch new durable runs. Replay
comparisons and deployment environment pointers/promotion history are also visible.
The main workflow is:
POST /versionsto register an agent configuration andGET /versionsto list versions.GET /scenariosto list the configured scenario catalog.POST /runsto run a named scenario.GET /runs/{run_id}/traceto inspect its persisted trajectory.GET /approvalsandPOST /approvals/{approval_id}to operate durable pauses.POST /evaluationsto produce a persisted oracle-first scorecard.POST /replay/compareto compare paired baseline and candidate runs without executing tools.POST /deployments/versionsto register a deployable version.POST /deployments/promotionsto promote only when supplied evidence passes every gate.GET /deployments/{name}/statusand/historyto inspect environment pointers and promotion audit records.GET /metricsfor Prometheus scraping.
Replay bundles contain the persisted run, steps, receipts, tool schemas, and config/model/prompt/policy fingerprints behind an integrity hash. A bundle can be loaded and replayed in a spawned Python interpreter without access to its source store, producing the same structured report while keeping side effects mocked. Replay fails closed for unknown tools or changed side-effect classifications. Paired comparison reports sample counts and regressions through the control API and dashboard.
Deployment control has a separate CLI entry point:
agentops-deploy --help
agentops-deploy status --db agentops-deploy.db --name refund-agent --environment staging
agentops-deploy history --db agentops-deploy.db --name refund-agentPromotions use explicit evidence for dataset/version identity, sample size, freshness, oracle pass rate, policy violations, p95 latency, cost, and regression count. Shadow execution never calls tool handlers, and canary routing/rollback remains an explicitly simulated control-plane feature.
The default config at configs/refund-agent.yaml uses the deterministic mock provider:
model:
provider: mock
model: mock-refund-scriptedThis is the preferred path for tests and evals because it is repeatable and exercises the runtime, gateway, and commerce tools without network access.
An OpenAI-backed provider exists behind provider: openai. It requires the optional llm extra, the openai package, and OPENAI_API_KEY in the environment:
py -3 -m pip install -e ".[dev,llm]"The model may propose tool calls, but it never executes tools directly. Every action still flows through the deterministic gateway and durable runtime.