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
| Field | Type | Required |
|---|---|---|
system | string | yes |
model | LLMClient | yes |
storage | Storage<Message[]> | yes |
tools | Tool[] | yes |
maxIterations | number | no |
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";