Quickstart Guide
Get up and running with SICTACK in under five minutes. Protect your first tool call, enforce fail-closed policies, and implement human-in-the-loop approvals.
Two Integration Models
SICTACK is built to support two distinct operational topologies depending on your security architecture:
In-Process Security (SecureAgent)
Zero network latency. Runs directly inside your Python process. Evaluates policies in-memory, wraps native callables, manages the approval lifecycle, and produces immutable tamper-evident audit logs.
Remote Authorization (SictackClient)
Centralized enterprise policy gateway. Connects via HTTPS to the SICTACK backend. Verifies API keys, correlates task-scoped Intent Contexts, logs events to PostgreSQL, and feeds the SOC Dashboard in real-time.
Tutorial A: In-Process Security with SecureAgent
1. Setup & Tool Registration
Create an agent with an explicit policy and register your native Python functions with the internal registry:
from sictack import SecureAgent, ToolCall, Config, Policy
from sictack.exceptions import PermissionDeniedError, ApprovalRequiredError
# 1. Define explicit deterministic security policy
policy = Policy(
allowed_permissions=["db:read"],
require_approval_permissions=["db:write"],
denied_permissions=["db:admin"],
)
# 2. Instantiate SecureAgent with agent identity and permissions
agent = SecureAgent(
agent_id="data-analysis-agent",
permissions=["db:read", "db:write"],
config=Config(policy=policy),
)
# 3. Register native Python tools
def run_query(sql: str) -> str:
return f"Results for: {sql}"
agent.register_tool(
name="read_query",
func=run_query,
description="Executes read-only SQL queries",
)
# 4. Execute tool call - evaluated deterministically before running
call = ToolCall(tool_name="read_query", arguments={"sql": "SELECT id, name FROM users LIMIT 10;"})
result = agent.execute(call)
print("Query result:", result)
# Output: Results for: SELECT id, name FROM users LIMIT 10;2. Catching Policy Denials
When an agent requests an action that violates policy, SecureAgent halts execution immediately and raises PermissionDeniedError:
from sictack import ToolCall
from sictack.exceptions import PermissionDeniedError
try:
forbidden_call = ToolCall(tool_name="drop_table", arguments={"table": "users"})
agent.execute(forbidden_call)
except PermissionDeniedError as e:
print(f"Blocked by policy: {e}")
# Output: Blocked by policy: Tool drop_table is denied by policy3. Human-in-the-Loop Approval Workflow
When a policy rule specifies require_approval, execution pauses and an approval ticket is issued. The approval token is cryptographically bound to the canonical action hash:
from sictack import ToolCall
from sictack.exceptions import ApprovalRequiredError
sensitive_call = ToolCall(
tool_name="update_db",
arguments={"table": "users", "query": "UPDATE users SET active = 1"}
)
try:
agent.execute(sensitive_call)
except ApprovalRequiredError as e:
print(f"Approval required for tool '{e.tool_name}'!")
print(f"Approval Request ID: {e.approval_id}")
print(f"Canonical Action Hash: {e.action_hash}")
# Simulated operator review and approval
agent.approve(e.approval_id)
# Resume execution with single-use approval token
result = agent.execute_with_approval(sensitive_call, approval_id=e.approval_id)
print("Execution succeeded after approval:", result)Approval tokens cannot be reused. Calling execute_with_approval a second time with the same approval ID raises an ApprovalReplayError.
4. Inspecting Audit Events
Retrieve immutable in-memory audit logs containing SHA-256 action hashes, timestamps, and verdicts:
events = agent.get_audit_events()
for event in events:
print(f"[{event.timestamp}] Tool: {event.tool_name} | Verdict: {event.verdict} | Action Hash: {event.action_hash[:12]}...")Tutorial B: Remote Gateway with SictackClient
1. Client Initialization & Interception
Use SictackClient to query your centralized SICTACK backend before executing external side effects:
from sictack import SictackClient
from sictack.models import DecisionVerdict
# 1. Initialize client pointing to your SICTACK backend
client = SictackClient(
api_key="your-api-key-here",
base_url="YOUR_SICTACK_API_URL",
agent_id="financial-reconciliation-agent",
timeout=10.0,
)
# 2. Intercept an action before calling any real external system
decision = client.intercept(
tool_name="transfer_funds",
arguments={"recipient": "ACC-9921", "amount": 250.0},
context_id="intent-ctx-991204", # Optional task context
)
# 3. Deterministically inspect the returned verdict
if decision.verdict == DecisionVerdict.ALLOW:
# Safely execute your underlying tool
print("Action allowed! Proceeding with transaction.")
elif decision.verdict == DecisionVerdict.REQUIRE_APPROVAL:
approval_id = decision.metadata.get("approval_id")
print(f"Suspended for operator review. Approval ID: {approval_id}")
elif decision.verdict == DecisionVerdict.DENY:
print(f"Blocked by policy gateway. Risk Score: {decision.risk_score}")Notice that SictackClient.intercept() returns a Decision object; it does not execute the tool itself. Your application code retains complete custody of the underlying API keys and callable execution.