Python 3.12+SDK v0.1.0
Python SDKConstructors & Config
Initialization & Configuration
Configure agent identity, deterministic security policies, audit logging, and connection parameters for both in-process and remote execution modes.
Initializing SecureAgent
SecureAgent is the primary in-process orchestrator. It manages the tool registry, policy engine, approval lifecycle service, and audit trail in memory.
init_secure_agent.py
from sictack import SecureAgent, Config, Policy
from sictack.core.policy import PolicyRule
# Initialize SecureAgent with explicit identity and scoped capabilities
agent = SecureAgent(
agent_id="customer-service-agent",
permissions=["crm:read", "email:send"],
config=Config(
policy=Policy(
rules=[
PolicyRule(tool_name="lookup_customer", action="allow"),
PolicyRule(tool_name="send_email", action="require_approval"),
PolicyRule(tool_name="delete_account", action="deny"),
],
default_action="deny", # Strict fail-closed policy
),
audit_enabled=True,
),
)Constructor Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| agent_id | str | "default-agent" | Unique identifier for the agent used in audit events and policy scoping. |
| permissions | list[str] | None | None | List of permission strings granted to this agent (e.g. ["db:read"]). |
| config | Config | None | None (defaults to standard Config) | Configuration object containing policy, audit settings, and timeout. |
Configuration Options (Config)
The Config model controls the execution guarantees and runtime behaviors:
config_schema.py
class Config(BaseModel):
policy: Optional[Policy] = None
audit_enabled: bool = True
fail_closed: bool = True
approval_timeout_seconds: int = 300- policy: An instance of
Policy. If omitted, all tools are permitted by default unless rules are provided. - audit_enabled: Whether audit events are captured in memory (
Trueby default). - fail_closed: When
True, any policy or validation ambiguity results in immediate denial. - approval_timeout_seconds: Maximum duration in seconds that a human approval token remains valid before expiring (default: 300 seconds / 5 minutes).
Defining Policies (Policy & PolicyRule)
Policies consist of ordered rules and a default fallback action:
| Action String | Effect |
|---|---|
| "allow" | Execution is permitted immediately without human intervention. |
| "require_approval" | Execution is paused. An approval ticket is issued and must be authorized. |
| "deny" | Execution is blocked immediately. Raises PermissionDeniedError. |
Initializing SictackClient
Use SictackClient when interacting with a centralized SICTACK backend instance:
init_client.py
import os
from sictack import SictackClient
# Initialize client using environment configuration
client = SictackClient(
api_key=os.environ["SICTACK_API_KEY"],
base_url=os.getenv("SICTACK_BASE_URL", "YOUR_SICTACK_API_URL"),
agent_id="reconciliation-worker",
timeout=10.0, # 10 second HTTP timeout
)Constructor Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| api_key | str | Required | Secret API key passed via the X-API-Key HTTP header. |
| base_url | str | "http://localhost:8000" | Root URL of the SICTACK backend service. |
| agent_id | str | "default-agent" | Agent identifier passed with each interception request. |
| timeout | float | 10.0 | HTTP request timeout in seconds. |
Environment Variables & Best Practices
API Key Security
Never commit your SICTACK_API_KEY into version control. Load it from a secrets manager (e.g. AWS Secrets Manager, HashiCorp Vault) or inject it via runtime environment variables.