← Selected work

Open-source agent infrastructure

Mirage

Deterministic policy enforcement for routed agent HTTP requests, with recorded decisions and CI gates.

My roleBuilt the FastAPI gateway, policy engine, action traces, CLI, and React review console.

Open source · Published as mirage-ci

Explore the workflow

Interactive walkthrough

Put a proposed action through the gate.

Change the bid amount and inspect the policy decision, recorded trace, and CI outcome.

Proposed bid amount

Select a stage to inspect its role in the workflow.

Step 4: Gate the run. CI fails.

HTTP action / CI modepolicy_violation

POST /v1/submit_bid

bid_amount
99,999
enforce_bid_limitbid_amount ≤ 10,000
Run-scoped CI gateCI fails

Trace: policy_violation · exit 1

Step 04 / Inspect

CI fails.

gate-run checks the run's recorded actions. A policy violation produces a non-zero exit code that a CI job can use to fail the build.

mirage gate-run --run-id website-example
exit code: 1
enforce_bid_limit failed.

99,999 exceeds the 10,000 limit. CI fails.

Browser-local CI example using the documented bid rule, fixed supplier approval, and mocked responses.

Documented CI example

Results

  • Public source, Python distribution mirage-ci, Docker packaging, and GitHub Actions checks.
  • A bundled procurement harness demonstrates a compliant bid, an out-of-policy bid, and an unmatched route.
Engineering details

An agent's actions can have consequences beyond its generated text. Teams need a way to inspect routed requests, enforce explicit rules, and test the same boundary before deployment.

01

Make policy decisions deterministic

Requests routed through Mirage are evaluated against declarative YAML policies. The decision is rule-based, with no model judging whether the request passes.

02

Use the same policy in two settings

Gateway mode checks requests to real upstreams with log-only or enforcement behavior. CI mode uses mocked responses and run-scoped policy checks so a violation can fail the build.

03

Keep the action trace inspectable

Per-run records capture proposed HTTP actions and their policy decisions. The CLI and review console make those records available for debugging and review.