Open-source agent infrastructure
Mirage
Deterministic policy enforcement for routed agent HTTP requests, with recorded decisions and CI gates.
- Status
- Open source · Published as mirage-ci
- My role
- Built the FastAPI gateway, policy engine, action traces, CLI, and React review console.
- Stack
Interactive walkthrough
Put a proposed action through the gate.
Change the bid amount and inspect the policy decision, recorded trace, and CI outcome.
Select a stage to inspect its role in the workflow.
Step 4: Gate the run. CI fails.
POST /v1/submit_bid
- bid_amount
- 99,999
bid_amount ≤ 10,000Trace: 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 exampleThe problem
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.
Approach
- 1
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.
- 2
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.
- 3
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.
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.