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.
- Navigate to Governance → Policies
- Click Create Policy
- Select the policy type and workflow
- Configure thresholds, conditions, and actions
- 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
| Action | Behavior |
|---|---|
warn | Log warning and create alert, continue execution |
block | Stop execution and raise exception |
review | Queue for human review before output |
notify | Send notification to configured channels |
Best Practices
- Start with
warnactions while tuning thresholds - Use
blockonly for critical cost or safety limits - Set realistic budgets based on historical data
- Review policy violations regularly to adjust thresholds