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

ParameterTypeDefaultDescription
agent_idstr"default-agent"Unique identifier for the agent used in audit events and policy scoping.
permissionslist[str] | NoneNoneList of permission strings granted to this agent (e.g. ["db:read"]).
configConfig | NoneNone (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 (True by 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 StringEffect
"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

ParameterTypeDefaultDescription
api_keystrRequiredSecret API key passed via the X-API-Key HTTP header.
base_urlstr"http://localhost:8000"Root URL of the SICTACK backend service.
agent_idstr"default-agent"Agent identifier passed with each interception request.
timeoutfloat10.0HTTP 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.