Governance Overview
Implement human oversight for your AI agents with flexible governance patterns.
Why Governance?
As AI agents become more autonomous, human oversight becomes critical for:
- Safety - Prevent harmful or unintended actions
- Compliance - Meet regulatory requirements
- Quality - Ensure outputs meet standards
- Trust - Build confidence in AI systems
- Learning - Improve agents from human feedback
Governance Patterns
TuringPulse supports three governance patterns, each suited for different use cases:
đđđī¸
Human-in-the-Loop (HITL)
Require approval BEFORE agent action
Human-after-the-Loop (HATL)
Review and audit AFTER agent action
Human-on-the-Loop (HOTL)
Real-time monitoring with intervention
Comparison
| Pattern | When | Latency Impact | Use Case |
|---|---|---|---|
| HITL | Before execution | High (blocks) | High-risk actions, financial transactions |
| HATL | After execution | None | Quality audits, compliance reviews |
| HOTL | During execution | None (async) | Real-time monitoring, anomaly response |
Quick Start
Enable Governance via SDK
agent.py
from turingpulse import instrument, GovernanceDirective
@instrument(
agent_id="financial-advisor",
governance=GovernanceDirective(
# Human-in-the-Loop for high-value transactions
hitl=True,
hitl_condition=lambda ctx: ctx.metadata.get("amount", 0) > 10000,
# Human-after-the-Loop for all transactions
hatl=True,
hatl_sample_rate=1.0, # Review 100%
# Reviewers
reviewers=["compliance@company.com"],
escalation_timeout=3600, # Escalate after 1 hour
)
)
def process_transaction(user_id: str, amount: float, action: str):
return execute_transaction(user_id, amount, action)Enable Governance via UI
- Go to Governance â Policies
- Click Create Policy
- Select the workflow and governance type
- Configure conditions and reviewers
- Save and enable the policy
Review Queue
All items requiring human review appear in the Review Queue:
- HITL Pending - Actions waiting for approval
- HATL Review - Completed actions to audit
- HOTL Alerts - Real-time issues requiring attention
Review Actions
- Approve - Allow the action to proceed (HITL)
- Reject - Block the action (HITL)
- Modify - Edit and approve with changes (HITL)
- Flag - Mark for follow-up (HATL)
- Acknowledge - Confirm review (HATL)
âšī¸
Review Queue Access
Navigate to Governance â Review Queue to see all pending reviews.
Review Policies
Policies define when and how governance is applied:
Policy Configuration
| Option | Description |
|---|---|
workflow_id | Apply to specific workflow or "*" for all |
type | hitl, hatl, or hotl |
condition | When to trigger (always, conditional) |
sample_rate | Percentage of runs to review (HATL) |
reviewers | List of reviewer emails or groups |
escalation_timeout | Seconds before escalation |
auto_approve_after | Auto-approve after N seconds (HITL) |
Conditional Governance
Apply governance only when certain conditions are met:
conditional.py
from turingpulse import GovernanceDirective
# Only require HITL for high-risk actions
governance = GovernanceDirective(
hitl=True,
hitl_condition=lambda ctx: (
ctx.metadata.get("risk_score", 0) > 0.8 or
ctx.metadata.get("action_type") in ["delete", "transfer"] or
ctx.metadata.get("amount", 0) > 10000
),
reviewers=["security@company.com"],
)
# Sample-based HATL review
governance = GovernanceDirective(
hatl=True,
hatl_sample_rate=0.1, # Review 10% of runs
hatl_condition=lambda ctx: (
ctx.result.get("confidence", 1.0) < 0.7 # Always review low confidence
),
reviewers=["qa@company.com"],
)Escalation
Configure escalation for unreviewed items:
governance = GovernanceDirective(
hitl=True,
reviewers=["level1@company.com"],
escalation_timeout=1800, # 30 minutes
escalation_reviewers=["level2@company.com", "manager@company.com"],
escalation_channels=["pagerduty://critical"],
)â ī¸
HITL Timeouts
For HITL, consider setting
auto_approve_after orauto_reject_after to prevent indefinite blocking.Review Insights
Track governance metrics and reviewer performance:
- Review Volume - Items reviewed per day/week
- Review Time - Average time to review
- Approval Rate - Percentage approved vs rejected
- Escalation Rate - Percentage escalated
- Reviewer Load - Distribution across reviewers
Next Steps
- Review Policies - Configure policies
- Review Queue - Process reviews
- HITL - Pre-execution approval
- HATL - Post-execution audit
- HOTL - Real-time monitoring