guardrail/examples/api-cookbook.md
caelum0x 2d2b15c7fe feat: full guardrail-alpha system + CLI modularization + Vercel deploy config
- Rust engine: real bootstrap/wiring preflight (guardrail-agent), execution layer (retry/router/pre-trade/post-trade/reconciliation), guardrail-doctor diagnostics with allowlist-drift guard.

- guardrail-cli: extracted pure helpers into util.rs (split in progress).

- 6 Track-2 skills + ensemble; python-lab analytics (regime/drawdown/montecarlo/dossier/ensemble/journal/seed); clients (ts/py/go/mcp/langchain/web-lite/proof-verifier); alert relay; scenarios; helm/k8s/compose; docs.

- dashboard/vercel.json + docs/VERCEL_DEPLOY.md for Vercel deployment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:02:22 +03:00

1.3 KiB

API cookbook

Start the API (reads the SQLite event log written by the agent):

DATABASE_URL=sqlite://data/guardrail_alpha.db cargo run -p guardrail-api
# serves on http://localhost:8080

Live state

curl localhost:8080/health
curl localhost:8080/cockpit
curl localhost:8080/portfolio
curl localhost:8080/risk
curl localhost:8080/alerts
curl localhost:8080/proof
curl localhost:8080/events
curl localhost:8080/history          # NAV equity series
curl localhost:8080/metrics          # Prometheus text

Research

# Single backtest (strategy vs buy-and-hold), with preset + sentiment
curl "localhost:8080/backtest?steps=60&fear_greed=70&preset=balanced"

# Rolling walk-forward windows
curl "localhost:8080/walkforward?windows=6&steps=30&preset=aggressive"

# Sentiment sweep
curl "localhost:8080/sweep?steps=40&fear_greed=20,40,60,80&preset=conservative"

Natural-language policy

curl "localhost:8080/policy/compile?mandate=Trade%20CAKE%20max%20drawdown%2020%25%20kill%20switch%2025%25%20stable%20reserve%2010%25"

Reports & proof

curl localhost:8080/report                 # JSON run report
curl localhost:8080/report/markdown        # Markdown report
curl localhost:8080/export/submission.md   # submission artifact