@ignorenarrative/agent-builder-sdk
v0.1.0
Published
Client SDK for Agent Builder — thin wrapper over the official Anthropic SDK that points at a deployed agent's Anthropic-compatible endpoint.
Maintainers
Readme
@agent-builder/sdk
TypeScript client SDK for Agent Builder. A thin wrapper over the
official @anthropic-ai/sdk
that points your client at a deployed Agent Builder agent's
Anthropic Messages-compatible endpoint.
Phase 2 item 2.11 — pairs with the Anthropic-compatible endpoint shipped in Phase 2 item 2.15.
Install
npm install @agent-builder/sdk @anthropic-ai/sdk
# or
pnpm add @agent-builder/sdk @anthropic-ai/sdk
# or
yarn add @agent-builder/sdk @anthropic-ai/sdk@anthropic-ai/sdk is a peer dependency so you can pin your own
version.
Quick start
import { createAgentClient } from '@agent-builder/sdk';
const client = createAgentClient({
agentUrl: 'https://my-agent.agents.buildragent.ai',
apiKey: process.env.AGENT_BUILDER_API_KEY!,
});
// Non-streaming
const response = await client.messages.create({
model: 'claude-sonnet-4-6', // server-configured, ignored
max_tokens: 4096,
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(response.content);
// Streaming
const stream = client.messages.stream({
model: 'claude-sonnet-4-6',
max_tokens: 4096,
messages: [{ role: 'user', content: 'Write a poem.' }],
});
for await (const event of stream) {
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
process.stdout.write(event.delta.text);
}
}What's different from the raw Anthropic SDK
The deployed agent at agentUrl is configured with a specific
system prompt, model, tools, and other parameters that its
tenant chose at deploy time. When you call messages.create
through this SDK:
modelin your request is ignored. The agent's deployed model is always used.systemin your request is ignored. The agent's deployed system prompt is always used.toolsin your request is ignored. The agent's deployed tool set is always used.messages,max_tokens, and other per-turn fields work as expected.
The Authorization: Bearer <apiKey> header is attached
automatically — the tenant UI issues per-app API keys (Phase 1
item 1.3 Mode B) that the deployed agent's middleware validates.
Advanced
createAgentClient accepts any ClientOptions the Anthropic SDK
understands (minus baseURL and apiKey, which the wrapper
manages). Useful knobs:
createAgentClient({
agentUrl: '...',
apiKey: '...',
maxRetries: 5,
timeout: 60_000,
defaultHeaders: {
'x-request-id': 'my-correlation-id',
},
});Raw Anthropic SDK access
If you need the raw client for direct Anthropic API calls alongside your agent calls, import it from this package:
import { Anthropic } from '@agent-builder/sdk';
const rawClient = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY! });This avoids having to list @anthropic-ai/sdk separately in your
imports when you're already depending on this package.
