API Reference

Complete reference for LockStock Python and Rust SDKs

Agent Class

The core class for creating and managing cryptographic agent identities.

Agent.create(agent_id: str, secret_key: str) → Agent
Creates a new agent with cryptographic passport identity.
Parameter Type Description
agent_id str Unique identifier for the agent
secret_key str HMAC secret key for signing operations
agent = Agent.create("analytics-bot-001", "your-secret-key")
agent.execute_task(task_type: str, payload: dict) → TaskResult
Executes an authenticated task with automatic sequence increment and cryptographic seal generation.
Parameter Type Description
task_type str Task identifier (e.g., "PROCESS_DATA", "ANALYZE", "SYNC")
payload dict Task-specific data and parameters
result = await agent.execute_task("PROCESS_DATA", {
    "input": "customer_data.csv",
    "operation": "analyze"
})
agent.get_audit_trail() → List[AuditEntry]
Retrieves the complete cryptographically-verifiable audit trail for this agent.
audit_log = agent.get_audit_trail()
for entry in audit_log:
    print(f"Seq: {entry.sequence} | Task: {entry.task}")
agent.export_passport() → PassportData
Exports agent passport for teleportation to another server. Enables zero-loss agent migration.
passport_data = agent.export_passport()
# Transfer to new server
new_agent = Agent.import_passport(passport_data)

LockStock Guard API

Enterprise security monitoring and causal auditing.

Guard.monitor_velocity(agent_id: str, threshold: float) → VelocityStatus
Real-time velocity anomaly detection. Automatically triggers circuit breaker if threshold exceeded.
Parameter Type Description
agent_id str Agent to monitor
threshold float Max allowed state transitions per second
status = Guard.monitor_velocity("agent-001", threshold=50.0)
if status.is_anomaly:
    print("Rogue agent detected!")

Error Handling

AuthenticationError
Raised when HMAC signature verification fails. Agent's secret key does not match.
ReplayError
Raised when attempting to reuse a parent hash. Each state transition must have unique lineage.
VelocityExceededError
Raised when agent exceeds velocity threshold. Circuit breaker activated.

Need help? Email hello@d3cipher.ai or view the Quickstart Guide