Real-Time Guards

Evaluate calls against cost efficiency and runaway policies locally. Returns an AurexDecision without network I/O.

Agent hint

Use for pre_call_check / preCallCheck, proceed/downgrade/compress/block actions.

In scope

  • pre_call_check API
  • Decision actions
  • auditor.ignore()

Out of scope

  • BudgetGuard config table — see BudgetGuard
  • wrap() — see Context Wrappers
proceed

No violation; call proceeds normally.

downgrade

Swap to a cheaper suggested model.

compress

Prune duplicate system prompts from context.

block

Halt call when budget or policy violated.

Python
from aurex_sdk import AurexAuditor, AurexDecision

auditor = AurexAuditor()

decision: AurexDecision = auditor.pre_call_check(
    model="gpt-4o",
    prompt="Generate python code...",
    workflow_id="user_session_123",
)

if decision.action == "block":
    raise Exception(f"Blocked: {decision.reason}")
elif decision.action == "downgrade":
    model = decision.suggested_model
elif decision.action == "compress":
    messages = decision.compressed_messages
Node.js
const decision = auditor.preCallCheck({
  model: "gpt-4o",
  prompt: "Generate python code...",
  workflowId: "user_session_123",
});

if (decision.action === "block") {
  throw new Error(`Blocked: ${decision.reason}`);
}

See also