Skip to main content

sidclaw

PyPI version License: Apache-2.0 Python

Python SDK for SidClaw — governance for AI agents.

Identity. Policy. Approval. Trace. Four primitives that give you control over what your AI agents can do.

Install

pip install sidclaw

Quick Start

from sidclaw import SidClaw

client = SidClaw(api_key="ai_...", agent_id="your-agent-id")

# Evaluate an action against the policy engine
decision = client.evaluate({
    "operation": "send_email",
    "target_integration": "email_service",
    "resource_scope": "outbound_email",
    "data_classification": "confidential",
})

if decision.decision == "allow":
    send_email(...)
    client.record_outcome(decision.trace_id, {"status": "success"})
elif decision.decision == "approval_required":
    approval = client.wait_for_approval(decision.approval_request_id)
    if approval.status == "approved":
        send_email(...)
        client.record_outcome(decision.trace_id, {"status": "success"})
elif decision.decision == "deny":
    print(f"Denied: {decision.reason}")

Governance Decorator

from sidclaw import SidClaw
from sidclaw.middleware import with_governance, GovernanceConfig

client = SidClaw(api_key="ai_...", agent_id="your-agent-id")

@with_governance(client, GovernanceConfig(
    operation="send_email",
    target_integration="email_service",
    data_classification="confidential",
))
def send_email(to: str, subject: str, body: str) -> None:
    email_service.send(to=to, subject=subject, body=body)

send_email("customer@example.com", "Follow-up", "Hello...")
# allow -> executes immediately
# approval_required -> waits for human approval, then executes
# deny -> raises ActionDeniedError

Async

from sidclaw import AsyncSidClaw

async with AsyncSidClaw(api_key="ai_...", agent_id="...") as client:
    decision = await client.evaluate({
        "operation": "send_email",
        "target_integration": "email_service",
        "resource_scope": "outbound_email",
        "data_classification": "confidential",
    })

Framework Integrations

pip install sidclaw[langchain]      # LangChain
pip install sidclaw[crewai]         # CrewAI
pip install sidclaw[openai-agents]  # OpenAI Agents SDK
pip install sidclaw[pydantic-ai]    # Pydantic AI
pip install sidclaw[mcp]            # MCP governance proxy
pip install sidclaw[all]            # Everything

LangChain

from sidclaw.middleware.langchain import govern_tools

governed = govern_tools(my_tools, client=client)
agent = create_react_agent(llm, governed)

CrewAI

from sidclaw.middleware.crewai import govern_crewai_tool

governed_tool = govern_crewai_tool(my_tool, client=client)

OpenAI Agents SDK

from sidclaw.middleware.openai_agents import govern_function_tool

tool, handler = govern_function_tool(tool_def, my_handler, client=async_client)

MCP Governance Proxy

from sidclaw.mcp import GovernanceMCPServer, GovernanceMCPServerConfig

server = GovernanceMCPServer(GovernanceMCPServerConfig(
    api_key="ai_...",
    agent_id="agent-001",
    upstream_command="npx",
    upstream_args=["-y", "@modelcontextprotocol/server-postgres", "postgresql://..."],
))
await server.start()

Or use the CLI:

SIDCLAW_API_KEY=ai_... SIDCLAW_AGENT_ID=agent-001 \
SIDCLAW_UPSTREAM_CMD=npx SIDCLAW_UPSTREAM_ARGS="-y,@modelcontextprotocol/server-postgres,postgresql://..." \
sidclaw-mcp-proxy

Webhook Verification

from sidclaw import verify_webhook_signature

is_valid = verify_webhook_signature(
    payload=request.body,
    signature=request.headers["X-Webhook-Signature"],
    secret="whsec_...",
)

Error Handling

from sidclaw import ActionDeniedError, ApprovalTimeoutError, RateLimitError

try:
    decision = client.evaluate(...)
except ActionDeniedError as e:
    print(f"Denied: {e.reason}, trace: {e.trace_id}")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after}s")
except ApprovalTimeoutError as e:
    print(f"Approval timed out for {e.approval_request_id}")

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sidclaw-0.2.1.tar.gz (29.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sidclaw-0.2.1-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

Details for the file sidclaw-0.2.1.tar.gz.

File metadata

  • Download URL: sidclaw-0.2.1.tar.gz
  • Upload date:
  • Size: 29.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for sidclaw-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d193c1374d3e30892057058d5a61b6c1e95c66189f6d6e842c53ac8edf27e52f
MD5 fc972d52ae536fc6877df1966c480b9f
BLAKE2b-256 71358c27e5cddd4e05aaa174a8846a9a11489a4cdd9fb52dbb0b2a646b816bf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for sidclaw-0.2.1.tar.gz:

Publisher: release.yml on sidclawhq/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sidclaw-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sidclaw-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for sidclaw-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c4175240cdfde84b02867596605da6cfb1ae67609ea8ca5dceb050e744b6738
MD5 312a5c7319a8e511410fa324af69c4c7
BLAKE2b-256 707b22b57b61951bc9cc502367349dcbb26e9777c7d4acbc049b40773e623e96

See more details on using hashes here.

Provenance

The following attestation bundles were made for sidclaw-0.2.1-py3-none-any.whl:

Publisher: release.yml on sidclawhq/python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page