Skip to content

Agent API

Import the public agent facade from duclaw-cli/sdk.

ts
import { createAgent, type SdkAgentConfig, type SdkRunResult } from "duclaw-cli/sdk";

createAgent(config)

Creates an SDK agent with a .run() method.

ts
const agent = createAgent(config);
const result = await agent.run({
  input: "Summarize this repository.",
  context: { userId: "user_001" },
});

SdkAgentConfig

FieldTypeRequired
systemstringyes
modelLLMClientyes
storageStorage<Message[]>yes
toolsTool[]yes
maxIterationsnumberno

SdkRunResult

ts
type SdkRunResult = {
  output: string;
  raw: AgentResult;
};

Low-level Core Access

Use createCoreAgent only when you need the internal agent loop contract directly.

ts
import { createCoreAgent } from "duclaw-cli/sdk/core";

Released as part of the duclaw-cli package.