- 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>
Guardrail SDK Examples
Runnable end-to-end quickstarts for both Guardrail client SDKs. Each one runs the same guided sequence against the read-only Guardrail Alpha API and prints a concise summary of each call.
Prerequisites
Start the API first (from the repo root):
cargo run -p guardrail-api
By default it listens on http://localhost:8080. Point the examples elsewhere
with the GUARDRAIL_BASE_URL environment variable.
Both examples degrade gracefully: if the API is unreachable they print a
friendly notice and exit 0 (never a stack trace), so they are safe to run
even before the API is up.
Python (python_quickstart.py)
Stdlib-only. Reuses the published SDK at ../python/guardrail_client by adding
that directory to sys.path (no install required).
# from the repo root
python3 clients/examples/python_quickstart.py
# against a custom host
GUARDRAIL_BASE_URL=http://127.0.0.1:9000 python3 clients/examples/python_quickstart.py
Node (node_quickstart.mjs)
Dependency-free. Requires Node 18+ (uses the global fetch). It mirrors the
TypeScript SDK's method set and routes (../typescript/src/index.ts) using
fetch directly, so it runs without a tsc build step.
# from the repo root
node clients/examples/node_quickstart.mjs
# against a custom host
GUARDRAIL_BASE_URL=http://127.0.0.1:9000 node clients/examples/node_quickstart.mjs
What they demonstrate
Both scripts walk the same six-step flow, exercising the core SDK surface:
| Step | SDK call | Route | Shows |
|---|---|---|---|
| 1 | health() |
/health |
API + database status |
| 2 | compile_policy(...) / compilePolicy(...) |
/policy/compile |
NL mandate -> validated policy hash |
| 3 | backtest(steps=60, fear_greed=70, preset=balanced) |
/backtest |
strategy vs benchmark, returns, drawdown |
| 4 | walkforward() |
/walkforward |
rolling out-of-sample windows |
| 5 | regime() |
/regime |
current market regime |
| 6 | compete() |
/compete |
competition status |
The compiled mandate used in step 2 is:
Trade CAKE max drawdown 20% kill switch 25%