@sidclaw/sdk

Governance for AI agents. Identity, policy, approval, and audit.
Documentation · Quick Start · Examples
Quick Start
1. Install
npm install @sidclaw/sdk
2. Initialize
import { AgentIdentityClient } from '@sidclaw/sdk';
const client = new AgentIdentityClient({
apiKey: process.env.AGENT_IDENTITY_API_KEY,
apiUrl: 'https://api.sidclaw.com',
agentId: 'your-agent-id',
});
3. Govern your agent's actions
import { withGovernance } from '@sidclaw/sdk';
const sendEmail = withGovernance(client, {
operation: 'send_email',
target_integration: 'email_service',
resource_scope: 'customer_emails',
data_classification: 'confidential',
}, async (to, subject, body) => {
});
await sendEmail('customer@example.com', 'Follow-up', '...');
Integrations
MCP Governance Server
Wrap any MCP server with governance — intercepts tool calls automatically.
import { AgentIdentityClient, GovernanceMCPServer } from '@sidclaw/sdk';
const server = new GovernanceMCPServer({
client,
upstream: { transport: 'stdio', command: 'npx', args: ['your-mcp-server'] },
toolMappings: [
{ toolName: 'query', data_classification: 'confidential' },
{ toolName: 'list_tables', skip_governance: true },
],
});
await server.start();
LangChain.js
import { governTools } from '@sidclaw/sdk/langchain';
const governedTools = governTools(myTools, { client });
Vercel AI SDK
import { governVercelTool } from '@sidclaw/sdk/vercel-ai';
const governedTool = governVercelTool('myTool', myTool, { client });
OpenAI Agents SDK
import { governOpenAITool } from '@sidclaw/sdk/openai-agents';
const governedTool = governOpenAITool(myTool, { client });
Webhook Verification
import { verifyWebhookSignature } from '@sidclaw/sdk/webhooks';
const isValid = verifyWebhookSignature(rawBody, signatureHeader, webhookSecret);
OpenClaw Integration
Add governance to any OpenClaw MCP server:
- Install the skill:
openclaw skills install sidclaw-governance
- Replace your MCP server config in
openclaw.json:
{
"mcpServers": {
"my-server": {
"command": "npx",
"args": ["-y", "@sidclaw/sdk", "mcp-proxy"],
"env": {
"SIDCLAW_API_KEY": "ai_...",
"SIDCLAW_AGENT_ID": "agent-...",
"SIDCLAW_UPSTREAM_CMD": "npx",
"SIDCLAW_UPSTREAM_ARGS": "-y,@modelcontextprotocol/server-postgres,postgresql://..."
}
}
}
}
Every tool call is now evaluated against your SidClaw policies.
Error Handling
import { ActionDeniedError, ApprovalTimeoutError } from '@sidclaw/sdk';
try {
await governedAction();
} catch (error) {
if (error instanceof ActionDeniedError) {
console.log('Denied:', error.reason, 'Trace:', error.traceId);
}
}
License
Apache 2.0