ALEX evaluates the governance context of every request before your LLM generates a single token — deciding whether to speak, constrain, or stay silent. Works with Claude, GPT, Gemini, Mistral, and any internal model.
A bank may already have Claude or GPT. The hard problem is: how do you let that model communicate with clients, advisors, and portfolio managers without losing control?
Call ALEX first. If the decision is REMAIN_SILENT, don't call your LLM. If it's SPEAK_WITH_CONSTRAINTS, inject the constraint_preamble into your system prompt.
# 1. Evaluate the governance context BEFORE calling your LLM curl -X POST https://alex-finance.onrender.com/v1/govern \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "context_type": "investment_guidance", "domain_signals": { "vix": 22.4, "regime_conf": 0.68, "stakes": 0.82, "information_reliability": 0.61 }, "session_id": "hashed-session-ref" }' # 2. Route on the decision: # SPEAK → call LLM normally # SPEAK_WITH_CONSTRAINTS → prepend constraint_preamble to system prompt # REMAIN_SILENT → do NOT forward to LLM # # v2 will add: jurisdiction, channel, user_class, policy_profile
import httpx # 1. Evaluate governance context BEFORE calling your LLM gov = httpx.post( "https://alex-finance.onrender.com/v1/govern", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "context_type": "investment_guidance", "domain_signals": { "vix": 22.4, "regime_conf": 0.68, "stakes": 0.82, "information_reliability": 0.61, }, "session_id": "hashed-session-ref", } ).json() # 2. Route on the governance decision if gov["decision"] == "REMAIN_SILENT": return "This request has been blocked by your governance policy." system_prompt = your_base_system if gov["decision"] == "SPEAK_WITH_CONSTRAINTS": system_prompt = gov["constraint_preamble"] + "\n\n" + system_prompt # 3. Call your LLM — store gov["trace_id"] for audit log response = your_llm.complete(system=system_prompt, user=user_query)
// 1. Evaluate governance context BEFORE calling your LLM const gov = await fetch('https://alex-finance.onrender.com/v1/govern', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ context_type: 'investment_guidance', domain_signals: { vix: 22.4, regime_conf: 0.68, stakes: 0.82, information_reliability: 0.61, }, session_id: 'hashed-session-ref', }) }).then(r => r.json()); // 2. Route on the governance decision if (gov.decision === 'REMAIN_SILENT') { return 'Blocked by governance policy.'; } let systemPrompt = yourBaseSystem; if (gov.decision === 'SPEAK_WITH_CONSTRAINTS') { systemPrompt = gov.constraint_preamble + '\n\n' + systemPrompt; } // 3. Call your LLM — store gov.trace_id in your audit log
{
"trace_id": "3f7a9b2c-e841-...",
"decision": "SPEAK_WITH_CONSTRAINTS",
"signals": {
"crf": 0.61,
"ir": 0.82,
"cs": 0.75,
"ob": 0.45
},
"triggered_rules": [
"crf_elevated",
"high_irreversibility"
],
"constraint_preamble": "⚠ Governance note:
Market volatility elevated (CRF 0.61);
high real-world consequences.
Treat as one perspective, not a directive.",
"decision_reason": "CRF 0.61 above threshold;
high irreversibility",
"latency_ms": 8,
"runtime_version": "V5.0",
"policy_version": "v2.6"
}/v1/govern with your context_type and optional market signals. Takes 5–15ms.