Public API
Functions
Section titled “Functions”| Export | Description |
|---|---|
createAgent(options) |
Creates an in-memory Agent instance. |
query(params) |
One-shot async generator helper. |
tool(name, description, inputSchema, handler) |
Creates a custom tool definition. |
skill(options) |
Creates an in-memory skill definition. |
loadSkill(path) |
Loads a skill from a directory containing SKILL.md. |
createClaudeCodeTools(options) |
Creates opt-in Claude Code-style built-in tools. |
const agent = createAgent(options);
for await (const message of agent.query(prompt)) { console.log(message);}
const result = await agent.prompt(prompt);| Export | Description |
|---|---|
SDKMessage |
Union of all emitted SDK events. |
AgentOptions |
Agent construction options. |
ToolDefinition |
Tool shape passed to an agent. |
SkillDefinition |
Reusable instruction bundle passed to an agent. |
PermissionDecision |
Allow or deny decision returned by a permission callback. |
ModelClient |
Interface for custom or mocked model clients. |
Errors
Section titled “Errors”| Error | Description |
|---|---|
APIError |
Provider request or response failure. |
ToolExecutionError |
Tool handler failure. |
MaxTurnsError |
Agent loop reached maxTurns. |
AbortError |
Request was aborted. |