Skip to content

Duclaw SDKTyped agent runtime contracts

Compose agents with explicit LLM, storage, tool, event, and channel dependencies.

Install

sh
npm install duclaw-cli

For TypeScript projects, add a tsconfig.json that can resolve the SDK subpath export:

json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "strict": true,
    "skipLibCheck": true,
    "types": ["node"]
  }
}

Continue with the SDK overview or jump to the core API reference.

Minimal Runtime

ts
import {
  anthropic,
  createAgent,
  memoryStorage,
  tool,
} from "duclaw-cli/sdk";

const agent = createAgent({
  model: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY! }),
  storage: memoryStorage(),
  tools: [
    tool({
      name: "lookup_account",
      description: "Look up an account by id.",
      inputSchema: {
        type: "object",
        properties: {
          accountId: { type: "string" },
        },
        required: ["accountId"],
      },
      async run({ accountId }) {
        return { id: accountId, plan: "pro" };
      },
    }),
  ],
  system: "You are a precise SDK example agent.",
});

const result = await agent.run({
  input: "Check account acc_123.",
  context: { userId: "developer" },
});

Released as part of the duclaw-cli package.