Python 3.12+SDK v0.1.0
Python SDKExceptions Reference
Error Handling & Exceptions
SICTACK provides an exhaustive, typed exception hierarchy. Every exception carries structured attributes for programmatic inspection without parsing error message strings.
Exception Hierarchy
All SDK exceptions inherit from SictackError (aliased to IntentLockError for compatibility):
Exception Tree
SictackError (Base, alias: IntentLockError)
├── PolicyError
├── ToolNotRegisteredError
├── PermissionDeniedError
├── ApprovalRequiredError
├── ApprovalExpiredError
├── ApprovalReplayError
├── ApprovalMismatchError
├── ArgumentValidationError
├── ReplayDetectedError
└── AuditErrorStructured Context Attributes
You never need to regex parse error messages. Exceptions dynamically store contextual arguments as typed instance attributes:
| Exception Class | Context Attributes | Trigger Condition |
|---|---|---|
| PermissionDeniedError | .tool_name, .policy_id, .action_hash, .reason | Action blocked by explicit "deny" rule or fail-closed default. |
| ApprovalRequiredError | .approval_id, .action_hash, .tool_name | Tool execution suspended awaiting human operator approval. |
| ApprovalExpiredError | .approval_id | Approval ticket presented after its TTL expiration. |
| ApprovalReplayError | .approval_id | Attempted reuse of an already-consumed single-use approval token. |
| ApprovalMismatchError | .approval_id, .expected_hash, .actual_hash | Action parameters altered after approval token was issued. |
| ToolNotRegisteredError | .tool_name | Agent attempted to call a tool not registered in its registry. |
| ArgumentValidationError | .tool_name, .errors | Supplied arguments fail schema validation. |
| ReplayDetectedError | .action_hash, .tool_name | Exact duplicate action hash detected in non-idempotent context. |
Recommended Catch Pattern
Handle expected security states gracefully while alerting on replay or tampering anomalies:
robust_exception_handling.py
from sictack.exceptions import (
IntentLockError,
PermissionDeniedError,
ApprovalRequiredError,
ApprovalExpiredError,
ApprovalReplayError,
ApprovalMismatchError,
ToolNotRegisteredError,
ArgumentValidationError,
)
try:
result = agent.execute(tool_call)
except ApprovalRequiredError as e:
# Trigger operator approval flow
print(f"Action suspended. Approval ID: {e.approval_id}")
print(f"Tool: {e.tool_name}, Hash: {e.action_hash}")
except PermissionDeniedError as e:
# Deterministic policy denial
print(f"Action denied by policy '{e.policy_id}': {e.reason}")
except ApprovalExpiredError as e:
# Approval token exceeded TTL
print(f"Approval {e.approval_id} has expired. A new request must be created.")
except ApprovalReplayError as e:
# Security violation: token reuse attempt
print(f"SECURITY ALERT: Approval {e.approval_id} has already been consumed.")
except ApprovalMismatchError as e:
# Security violation: parameters tampered
print(f"SECURITY ALERT: Parameter mismatch! Expected {e.expected_hash}, got {e.actual_hash}")
except ToolNotRegisteredError as e:
print(f"Tool '{e.tool_name}' is not registered with this agent.")
except ArgumentValidationError as e:
print(f"Invalid tool arguments for '{e.tool_name}': {e.errors}")
except SictackError as e:
# Catch-all for any other SICTACK runtime exceptions
print(f"SICTACK security fault: {e.message}")