API Reference¶
Complete SDK API documentation.
GovernanceSteward¶
Main class for evaluating agent actions against blueprints.
Constructor¶
GovernanceSteward(
blueprint_file: Optional[str] = None,
blueprint_dict: Optional[Dict[str, Any]] = None,
blueprint_id: Optional[str] = None,
registry: Optional[BlueprintRegistry] = None,
state_storage: Optional[StateStorage] = None,
conformance_level: str = "minimal",
enable_warnings: bool = True,
)
Parameters:
- blueprint_file: Path to blueprint YAML file (loaded by steward at initialization)
- blueprint_dict: Blueprint as dictionary (for testing/development)
- blueprint_id: Blueprint ID to load from registry
- registry: Blueprint registry client
- state_storage: State storage for stateful tripwires
- conformance_level: "minimal", "standard", or "complete"
- enable_warnings: Enable production warnings for Minimal conformance
Blueprint Selection - Steward-Side
You must provide one of blueprint_file, blueprint_dict, or blueprint_id.
Important: Blueprints are configured on the steward, not by agents. The steward automatically selects the appropriate blueprint for each evaluation based on agent scope, inheritance rules, and request context. This maintains proper separation of concerns and prevents agents from bypassing governance.
Methods¶
evaluate()¶
Evaluate a cognitive trace against the blueprint and return intervention recommendation.
Parameters:
- trace: CognitiveTrace object
- context: Optional context dictionary
Returns:
- InterventionResult with intervention type and message
get_metrics()¶
Get governance metrics including evaluation counts and intervention statistics.
CognitiveTrace¶
Represents agent reasoning and planned action.
Constructor¶
CognitiveTrace(
reasoning: Optional[str] = None,
action: str,
parameters: Dict[str, Any] = {},
confidence: Optional[float] = None,
trace_id: Optional[str] = None,
agent_id: Optional[str] = None,
agent_tier: Optional[str] = None,
)
InterventionResult¶
Result of governance evaluation.
Attributes¶
intervention: InterventionType - One of OK, NUDGE, FLAG, ESCALATE, BLOCK, HALTmessage: str - Human-readable explanationtrace_id: str - ID of the evaluated tracetimestamp: datetime - When the evaluation completedgovernance_status: Optional[GovernanceStatus] - Evaluation status detailsmetadata: Dict[str, Any] - Additional evaluation metadata
Blueprint¶
Governance policy configuration loaded from YAML or dictionary.
Attributes¶
id: str - Unique blueprint identifier (e.g., 'finance/trading@1.0')version: str - Blueprint version (semantic versioning)description: str - Blueprint descriptioninherits: Optional[str] - Parent blueprint ID to inherit fromscope: Optional[BlueprintScope] - Scope restrictionstripwires: List[BlueprintTripwire] - Tripwire configurationschecks: List[BlueprintCheck] - CTQ check configurationsevidence: Optional[EvidenceRequirements] - Evidence requirementsscoring: Optional[ScoringThresholds] - Scoring thresholdstrust_debt: Optional[TrustDebtConfig] - Trust debt configuration
BlueprintTripwire¶
Tripwire configuration within a blueprint.
Attributes¶
id: str - Unique tripwire identifierwhen: TripwireCondition - When to evaluate (hook, tool filter)condition: str - Condition expression to evaluateeval_tier: int - Evaluation tier (0 or 1)latency_budget_ms: Optional[int] - Per-tripwire latency budgetseverity: TripwireSeverity - Tripwire severity levelrequires_state: bool - Whether tripwire needs stateful storageon_fail: TripwireOnFail - Action when condition fails
TrustDebtConfig¶
Trust debt tracking configuration.
Attributes¶
enabled: bool - Whether trust debt is enabledaccumulation: TrustDebtAccumulation - Debt accumulation rates per interventiondecay: TrustDebtDecay - Decay configurationrecovery: Optional[TrustDebtRecovery] - Recovery configurationthresholds: TrustDebtThresholds - Action thresholds
Decorators¶
@guard¶
Zero-config governance decorator.
from acgp import guard
@guard(tripwires=["spend < 50"], blocked_keywords=["password"])
def process_refund(amount: float, reason: str):
# Function is automatically governed
return refund_service.process(amount, reason)
Parameters:
- tripwires: List of simple tripwire strings (e.g., ["spend < $50", "no_pii"])
- rules: List of custom rule dictionaries
- max_spend: Maximum spend limit (shortcut for spend tripwire)
- blocked_keywords: Keywords to block in reasoning
- action_name: Name of the action (defaults to function name)
- on_deny: Callback function called when action is denied
- on_review: Callback function called when action needs review
Enums¶
InterventionType¶
class InterventionType(str, Enum):
OK = "OK"
NUDGE = "NUDGE"
FLAG = "FLAG"
ESCALATE = "ESCALATE"
BLOCK = "BLOCK"
HALT = "HALT"
TripwireSeverity¶
RiskLevel¶
class RiskLevel(str, Enum):
LOW_RISK = "low_risk"
ELEVATED_RISK = "elevated_risk"
CRITICAL_RISK = "critical_risk"
Exceptions¶
| Exception | Description |
|---|---|
ACGPError |
Base exception for all ACGP errors |
PolicyError |
Invalid policy/blueprint configuration |
TripwireViolation |
Tripwire limit exceeded |
BudgetExceeded |
Performance budget exceeded |
AgentHalted |
Agent has been halted |
Type Aliases¶
from acgp import (
InterventionType, # Enum with OK, NUDGE, FLAG, ESCALATE, BLOCK, HALT
RiskLevel, # Enum with LOW_RISK, ELEVATED_RISK, CRITICAL_RISK
TripwireSeverity, # Enum with STANDARD, CRITICAL, SEVERE
)