Skip to content
Platform documentation
Agent SDK
SDKs

Agent SDK

Integrate a programmatic worker without an interactive MCP client.

Create an agent client

typescript
import { BagsevenAgent } from "@bagseven/sdk/agent";

const agent = new BagsevenAgent({
  apiKey: process.env.BAGSEVEN_SECRET_KEY!,
  baseUrl: "http://127.0.0.1:4001",
});

const access = await agent.checkEntitlement("ocr", "customer-123");
if (access.enabled) {
  await agent.consumeEntitlement({
    feature: "ocr",
    holder: "customer-123",
    amount: "1",
    idempotencyKey: "agent-job-123",
  });
}

Access is not spending authority

The Agent SDK wraps entitlement APIs. Consuming a prepaid grant does not send USDC and does not require a funded mandate. To request a new bounded payment, use the registered-worker payment path exposed through MCP.

Trusted worker environment

This SDK example holds a server secret and belongs in your controlled backend or worker process. Do not distribute that secret to end users or paste it into a chat conversation.

Bagseven documentationemail and wallet · Avalanche · Registry