SidClaw

Client

Initialize and configure the AgentIdentityClient for communicating with the SidClaw API.

AgentIdentityClient

The AgentIdentityClient is the main entry point for the SDK. It handles authentication, request retries, and communication with the SidClaw API.

Import

import { AgentIdentityClient } from '@sidclaw/sdk';

Constructor

const client = new AgentIdentityClient(config: ClientConfig);

ClientConfig

PropertyTypeRequiredDefaultDescription
apiKeystringYes--Your SidClaw API key (e.g., sk_live_...)
apiUrlstringYes--Base URL of the SidClaw API
agentIdstringYes--The registered agent ID this client acts on behalf of
maxRetriesnumberNo3Maximum retries for transient failures (5xx and network errors)
retryBaseDelayMsnumberNo500Base delay in milliseconds for exponential backoff

Example

import { AgentIdentityClient } from '@sidclaw/sdk';

const client = new AgentIdentityClient({
  apiKey: process.env.AGENT_IDENTITY_API_KEY!,
  apiUrl: 'https://api.sidclaw.com',
  agentId: 'ag_customer-support-bot',
});

Methods

The client exposes three methods:

MethodDescription
evaluate(action)Evaluate an action against the policy engine
waitForApproval(id, options?)Poll for an approval decision
recordOutcome(traceId, outcome)Record the result after executing an action

Retry Behavior

The client automatically retries requests that fail due to:

  • 5xx server errors -- retried with exponential backoff and jitter
  • Network errors -- retried with exponential backoff and jitter
  • 429 rate limit errors -- retried after the Retry-After header duration

Client errors (4xx other than 429) are not retried and throw immediately.

The backoff formula is:

delay = retryBaseDelayMs * 2^attempt * jitter

Where jitter is a random multiplier between 0.5 and 1.5.

Authentication

The client sends your API key in the Authorization header as a Bearer token on every request:

Authorization: Bearer sk_live_...

No additional authentication setup is required.