# Budget Controls — AI Agent Spending Limits & Cost Caps Source: https://docs.polaxis.io/budget-controls Set hard spending limits per AI agent, per session, or per day. Auto-block when thresholds are hit. Full cost breakdowns with real-time alerts. Prevent runaway AI agent bills before they arrive. # Budget Controls Set hard spending limits on your agents. Auto-block when thresholds are hit. ## Why this matters Uber burned its entire annual AI budget in 4 months after giving 5,000 engineers Claude Code access. One SaaS team (35 engineers) got a \$50,000 April bill from Claude Code, Cursor, and custom agents combined. Budget controls put a hard ceiling on what any agent can spend — per session, per day, or per month. ## Configure a budget ```python theme={null} from polaxis import Polaxis guard = Polaxis( api_key="ag_prod_...", agent_id="billing-agent", daily_budget_usd=50.00, # Hard stop at $50/day session_budget_usd=5.00, # Hard stop at $5/session alert_at_pct=80, # Slack alert at 80% of limit ) ``` Or via the dashboard: **Agents → Select agent → Budget tab**. ## Pass estimated cost on each call ```python theme={null} result = await guard.evaluate( "call_llm", {"prompt": "..."}, estimated_cost_usd=0.05 ) # After the tool runs, record actual cost: await guard.record_completion( tool_name="call_llm", actual_cost_usd=0.032, duration_ms=1240 ) ``` Polaxis tracks cumulative spend in real time and blocks the next call if the budget is exceeded. ## What happens when the limit is hit ```python theme={null} from polaxis import BlockedError try: result = await guard.evaluate("call_llm", inputs, estimated_cost_usd=0.05) except BlockedError as e: if e.reason == "budget_exceeded": print(f"Daily limit reached: {e.details['spent_usd']} / {e.details['limit_usd']}") ``` The agent raises `BlockedError` with `reason="budget_exceeded"`. Your code decides whether to fail gracefully, notify the user, or queue for the next day. ## Budget types | Type | Config key | Resets | | ----------- | -------------------- | ----------------------------- | | Per session | `session_budget_usd` | Each new `Polaxis()` instance | | Per day | `daily_budget_usd` | Midnight UTC | | Per month | `monthly_budget_usd` | 1st of each month | All three can be set simultaneously. The first limit hit triggers a block. ## Set budgets via API ```bash theme={null} PATCH /api/v1/agents/{agent_id}/budget { "daily_budget_usd": 100, "session_budget_usd": 10, "alert_at_pct": 75 } ``` ## View spend in the dashboard **Dashboard → Budgets** shows: * Current spend per agent (today, this month) * Spend rate over time * Blocked calls due to budget limits * Per-tool cost breakdown ## Soft alerts before the hard stop Set `alert_at_pct` to get a Slack notification before the limit is hit: ```python theme={null} guard = Polaxis( api_key="ag_prod_...", agent_id="research-agent", daily_budget_usd=100.00, alert_at_pct=80, # Slack alert at $80 spent ) ``` The alert gives your team time to intervene before the agent stops cold. # Compliance Reports — SOC 2, GDPR, OWASP, EU AI Act for AI Agents Source: https://docs.polaxis.io/compliance-reports Generate auditor-ready compliance reports for AI agents on demand. SOC 2 Type II, GDPR, EU AI Act, OWASP Agentic Top 10 (10/10 coverage), HIPAA, and Insurance Evidence reports. One click, 60 seconds. # Compliance Reports One-click PDF. Auditor-ready in 60 seconds. ## Generate a report ```bash theme={null} POST /api/v1/compliance/reports/generate { "framework": "soc2", "agent_id": "billing-agent", "date_from": "2026-01-01", "date_to": "2026-03-31" } ``` The report is ready in under 60 seconds. Download it: ```bash theme={null} GET /api/v1/compliance/reports/{report_id}/download ``` ## Supported frameworks | Framework | Coverage | | ------------------------ | ------------------------------------------------------------------------------------------------- | | **SOC 2 Type II** | CC6, CC7, CC8 — change management, logical access, system operations | | **GDPR** | Article 22 (automated decision-making), Article 30 (records of processing), Article 32 (security) | | **HIPAA** | 164.312 (technical safeguards), 164.308 (administrative safeguards), audit controls | | **EU AI Act** | High-risk AI system requirements, human oversight, logging obligations | | **OWASP Agentic Top 10** | All 10 categories — prompt injection, excessive agency, insecure output handling | ## What's in each report Every report includes: * **Audit log summary** — total tool calls, blocked, escalated, approved * **Policy coverage** — which policies were active and triggered * **Risk score timeline** — threat levels across the reporting period * **Human oversight record** — all escalations and approval decisions * **Data access log** — which data types were touched and by which agents * **SHA-256 hash chain** — tamper-evident proof of log integrity ## From the dashboard 1. Go to **Dashboard → Compliance** 2. Select framework and date range 3. Click **Generate Report** 4. Download PDF ## What it looks like in practice > *"Your enterprise security review asks: show me the audit log for every action your agent took. You click generate. 60 seconds later you hand them a PDF."* This is the document that unblocks enterprise deals. ## Retention policy Configure how long audit data is retained: ```bash theme={null} POST /api/v1/compliance/retention-policy { "retain_days": 365, "auto_anonymise_after_days": 90 } ``` # Human-in-the-Loop Approvals — AI Agent Oversight Source: https://docs.polaxis.io/human-approvals Pause high-risk AI agent actions and route them to Slack or dashboard for human approval. One-click approve or reject. The agent waits for your decision. No code change beyond the initial evaluate() call. # Human Approvals Require a human decision before high-risk agent actions execute. ## How it works 1. Agent calls `guard.evaluate("charge_card", {...})` 2. Policy matches — action is `escalate` 3. Polaxis sends a Slack notification to your team 4. SDK pauses and waits (up to 10 minutes by default) 5. Human clicks **Approve** or **Reject** in Slack 6. Agent proceeds or `BlockedError` is raised No code change needed beyond the initial `evaluate()` call. ## Set up Slack notifications 1. Go to **Dashboard → Settings → Slack** 2. Click **Connect Slack** 3. Choose the channel where approvals should appear 4. Test with the **Send test notification** button Or via API: ```bash theme={null} POST /api/v1/auth/test-slack { "webhook_url": "https://hooks.slack.com/services/..." } ``` ## What the Slack message looks like ``` 🚨 Polaxis — Approval Required Agent: billing-agent Tool: charge_card Input: { "amount": 4999, "currency": "usd", "customer": "acme-corp" } Policy: escalate_large_charges [✅ Approve] [❌ Reject] ``` One click. The agent either continues or stops. ## Handle approval in your code ```python theme={null} from polaxis import Polaxis, BlockedError, PendingApprovalError guard = Polaxis(api_key="ag_prod_...", agent_id="billing-agent") try: result = await guard.evaluate("charge_card", { "amount": 4999, "customer_id": "cust_123" }) # Execution reaches here only after human approval print("Approved — proceeding with charge") except BlockedError as e: print(f"Rejected: {e.reason}") except PendingApprovalError as e: print(f"Timed out waiting for approval: {e.approval_id}") ``` ## Approval timeout Default timeout is 10 minutes. Configure per agent: ```python theme={null} guard = Polaxis( api_key="ag_prod_...", agent_id="billing-agent", timeout_seconds=300 # 5 minutes ) ``` ## View approval history ```bash theme={null} GET /api/v1/approvals/history ``` Every approval and rejection is logged with timestamp, approver, and reason. # Integrations — LangGraph, CrewAI, OpenAI, PydanticAI, MCP Source: https://docs.polaxis.io/integrations Add AI agent security and governance to any framework. Polaxis works with LangGraph, CrewAI, PydanticAI, OpenAI Agents SDK, LangChain, AutoGen, MCP Protocol, and raw Python agents. # Integrations Drop Polaxis into your existing agent framework in minutes. ## LangGraph ```python theme={null} from polaxis.adapters.langgraph import PolaxisGuard guard = PolaxisGuard(api_key="ag_prod_...", agent_id="my-agent") # Wrap your tool node @guard.protect async def tool_node(state): tool_name = state["tool_name"] tool_input = state["tool_input"] # Polaxis evaluates before this runs return await execute_tool(tool_name, tool_input) ``` ## CrewAI ```python theme={null} from polaxis.adapters.crewai import PolaxisGuard guard = PolaxisGuard(api_key="ag_prod_...", agent_id="crew-agent") class MyTool(BaseTool): name = "send_email" @guard.before_tool def _run(self, to: str, subject: str, body: str): # Polaxis evaluates before execution return send_email(to, subject, body) ``` ## PydanticAI ```python theme={null} from polaxis.adapters.pydanticai import PolaxisGuard guard = PolaxisGuard(api_key="ag_prod_...", agent_id="pydantic-agent") agent = Agent( "claude-sonnet-4", tools=[guard.wrap(send_email), guard.wrap(charge_card)] ) ``` ## Raw Python (no framework) ```python theme={null} from polaxis import Polaxis, BlockedError guard = Polaxis(api_key="ag_prod_...", agent_id="my-agent") async def safe_tool_call(tool_name: str, tool_input: dict): try: await guard.evaluate(tool_name, tool_input) return await execute_tool(tool_name, tool_input) except BlockedError as e: return {"error": f"Blocked: {e.reason}"} ``` ## OpenAI Agents SDK ```python theme={null} from polaxis import Polaxis, BlockedError guard = Polaxis(api_key="ag_prod_...", agent_id="openai-agent") async def before_tool_call(tool_name: str, tool_input: dict): """Hook into OpenAI Agents SDK tool execution.""" await guard.evaluate(tool_name, tool_input) ``` ## Sync support If your framework is synchronous: ```python theme={null} # Use evaluate_sync instead of await evaluate result = guard.evaluate_sync("send_email", {"to": "user@co.com"}) ``` ## Record actual cost after execution Track real spend against your budget: ```python theme={null} result = await guard.evaluate("call_llm", inputs, estimated_cost_usd=0.05) # After the tool runs: await guard.record_completion( tool_name="call_llm", actual_cost_usd=0.032, duration_ms=1240 ) ``` # Polaxis — AI Agent Security & Governance Platform Source: https://docs.polaxis.io/introduction Polaxis is the runtime security and governance layer for AI agents. Intercepts every tool call, blocks threats, enforces policies, and generates SOC 2 / GDPR / OWASP compliance reports. # Introduction **Polaxis** is the security and governance layer for AI agents. It sits between your agents and every tool they call — intercepting, evaluating, and blocking dangerous actions before they execute. ## The problem AI agents are shipping to production without guardrails. When something goes wrong — and it does — there's no audit trail, no kill switch, no way to explain what happened. * **April 2026:** An AI agent deleted an entire production database in 9 seconds via Railway API * **December 2025:** Claude Code ran `terraform destroy` on 1.9 million rows * **2025:** 28.65 million secrets exposed on GitHub — AI-related leaks up 81% ## The solution One SDK. Three lines. Every tool call governed. ```python theme={null} from polaxis import Polaxis guard = Polaxis(api_key="ag_prod_...", agent_id="billing-agent") result = await guard.evaluate(tool_name, tool_input) # → allow | block (raises BlockedError) | escalate (waits for human) ``` ## What Polaxis does **7-layer firewall** on every tool call: 1. **Regex scan** — pattern matching, \<1ms 2. **Risk scorer** — threat level 0–100 3. **LLM gate** — semantic analysis, fires only when needed 4. **Behavioral baseline** — anomaly detection 5. **Session graph** — cross-call correlation 6. **Threat intel** — known attack patterns 7. **Policy engine** — your custom rules **89% of calls never touch an LLM.** Pure Python speed. ## Four pillars | Pillar | What it does | | ---------------------- | -------------------------------------------------------------------------- | | **Policy Engine** | YAML rules that block, allow, or escalate any tool call | | **Human Approvals** | Slack notifications for high-risk actions — one click to approve or reject | | **Budget Controls** | Session and daily spend caps. Hard stop when limit hit. | | **Compliance Reports** | SOC 2, GDPR, HIPAA, EU AI Act, OWASP — one-click PDF | ## Key stats * **\<1ms** policy decision latency * **Sub-50ms** full firewall * **89%** of calls evaluated in pure Python (no LLM cost) * **5 frameworks** covered in one compliance report ## Pricing | Plan | Price | Evaluations | Agents | | ---------- | ----------- | --------------- | --------- | | Free | \$0 | 10,000/month | 1 | | Pro | \$149/month | 500,000/month | Unlimited | | Scale | \$499/month | 5,000,000/month | Unlimited | | Enterprise | Custom | Unlimited | Unlimited | [Start for free →](https://polaxis.io) # Policy Engine — AI Agent Policy Enforcement Source: https://docs.polaxis.io/policy-engine Define rules that block, allow, or escalate any AI agent tool call. Configure policies by tool name, parameters, agent identity, spend threshold, or custom conditions. Evaluated in under 1ms. # Policy Engine Define exactly what your agents can and cannot do. ## Overview Policies are rules that run on every tool call before it executes. Each policy has conditions and an action: `allow`, `block`, or `escalate`. ``` Tool call → Policy Engine → allow / block / escalate ``` Policies evaluate in priority order. First match wins. ## Create a policy Go to **Dashboard → Policies → New Policy**, or via API: ```python theme={null} import httpx headers = {"Authorization": "Bearer ag_prod_..."} policy = { "agent_id": "billing-agent", "name": "Block large transactions", "conditions": { "tool_name": "charge_card", "amount_gt": 10000 }, "action": "escalate", "priority": 10 } httpx.post("https://api.polaxis.io/api/v1/policies", json=policy, headers=headers) ``` ## Policy examples ### Block dangerous operations ```json theme={null} { "name": "Block DELETE on production", "conditions": { "tool_name": {"in": ["delete_records", "drop_table", "truncate"]}, "environment": "production" }, "action": "block" } ``` ### Require approval for large payments ```json theme={null} { "name": "Escalate large charges", "conditions": { "tool_name": "charge_card", "tool_input.amount": {"gt": 500} }, "action": "escalate" } ``` ### Allow only specific email domains ```json theme={null} { "name": "Block external email", "conditions": { "tool_name": "send_email", "tool_input.to": {"not_contains": "@yourcompany.com"} }, "action": "block" } ``` ### Enforce data access scope ```json theme={null} { "name": "Healthcare — PHI access control", "conditions": { "tool_name": {"in": ["read_patient", "update_record"]}, "tool_input.patient_id": {"not_in": "$session.authorized_patients"} }, "action": "block" } ``` ## Test a policy before deploying ```bash theme={null} POST /api/v1/policies/simulate { "policy_id": "pol_xxx", "tool_name": "charge_card", "tool_input": {"amount": 9999} } # → { "would_trigger": true, "action": "escalate" } ``` ## Policy templates Pre-built policy sets for your industry: | Template | Frameworks | | ------------------ | --------------------- | | `fintech-bsa-aml` | BSA, AML, CFPB | | `healthcare-hipaa` | HIPAA, OCR | | `hr-gdpr` | GDPR, EU AI Act, CCPA | | `legal-privilege` | ABA Model Rules | | `devops-soc2` | SOC 2 Type II | Apply a template: ```bash theme={null} POST /api/v1/policy-templates/{template_id}/apply { "agent_id": "your-agent-id" } ``` # Quick Start — Add AI Agent Security in 5 Minutes Source: https://docs.polaxis.io/quickstart Install Polaxis and add runtime security, policy enforcement, and governance to any AI agent in under 5 minutes. Works with OpenAI, LangChain, CrewAI, and any custom agent. # Quick Start Get Polaxis running in under 5 minutes. ## Install ```bash theme={null} pip install polaxis ``` ## Get your API key 1. Sign up at [polaxis.io](https://polaxis.io) 2. Go to **Dashboard → Agents → Create Agent** 3. Copy your API key — it starts with `ag_` ## Add to your agent ```python theme={null} from polaxis import Polaxis guard = Polaxis( api_key="ag_prod_...", agent_id="your-agent-id" ) # Before every tool call: result = await guard.evaluate("send_email", { "to": "customer@example.com", "subject": "Invoice", "body": "..." }) # → allow | escalate (block raises BlockedError) ``` That's it. Every tool call your agent makes is now governed. ## What happens next | Decision | Meaning | Action | | ---------- | -------------------- | ---------------------------------- | | `allow` | Safe to proceed | Tool call executes | | `block` | Policy violation | `BlockedError` raised | | `escalate` | Needs human approval | SDK waits, Slack notification sent | ## Full example ```python theme={null} import asyncio from polaxis import Polaxis, BlockedError guard = Polaxis(api_key="ag_prod_...", agent_id="billing-agent") async def run_agent(): tools = [ ("send_email", {"to": "user@co.com", "body": "Your invoice is ready"}), ("charge_card", {"amount": 4999, "currency": "usd"}), ("delete_records", {"table": "users", "where": "inactive=true"}), ] for tool_name, tool_input in tools: try: result = await guard.evaluate(tool_name, tool_input) print(f"✓ {tool_name} — {result.decision}") # ... execute your tool here except BlockedError as e: print(f"✗ {tool_name} blocked — {e.reason}") asyncio.run(run_agent()) ```