Policies

Set up cost limits, latency budgets, and governance rules for AI agents

Overview

Policies let you define rules and limits for your AI agent workflows. Set cost budgets, latency thresholds, and custom conditions that trigger alerts or actions when violated.

Configuring Policies

Policies are configured in the TuringPulse platform, not in your application code. This lets you adjust limits and conditions without redeploying.

  1. Navigate to Governance → Policies
  2. Click Create Policy
  3. Select the policy type and workflow
  4. Configure thresholds, conditions, and actions
  5. Save and enable

Cost Policies

Set cost limits and budgets for your workflows:

  • Per-run cost limit — Alert or block when a single run exceeds a dollar amount
  • Daily budget — Track cumulative spend and alert at configurable thresholds
  • Alert threshold — Trigger warnings at a percentage of the limit (e.g., 80%)

Latency Policies

Monitor and enforce latency targets:

  • Max latency — Alert when execution time exceeds a threshold
  • P95 target — Track percentile latency and alert on regressions

Content Policies

Define content moderation rules:

  • Blocked keywords — Flag or block outputs containing specific terms
  • Confidence thresholds — Route low-confidence outputs for review
  • Output length limits — Enforce token count boundaries

HITL Policies

Combine governance with conditional logic. The SDK enables governance on a workflow; the platform evaluates conditions:

from turingpulse_sdk import instrument, GovernanceDirective

@instrument(
    name="reviewed-agent",
    governance=GovernanceDirective(
        hitl=True,
        hatl=True,
        reviewers=["team@company.com"],
    )
)
def reviewed_agent(query: str):
    return process(query)
ℹ️
Conditional Triggers
Condition-based policies (e.g., trigger HITL only when cost > $1 or confidence < 0.7) are configured in the platform under Governance → Policies, not in application code.

Policy Actions

ActionBehavior
warnLog warning and create alert, continue execution
blockStop execution and raise exception
reviewQueue for human review before output
notifySend notification to configured channels

Best Practices

  • Start with warn actions while tuning thresholds
  • Use block only for critical cost or safety limits
  • Set realistic budgets based on historical data
  • Review policy violations regularly to adjust thresholds