Anthropic SDK
Wrap Anthropic clients for use with the Reminix runtime
The Anthropic adapter wraps an Anthropic client for use with the Reminix runtime.
Installation
npm install @reminix/runtime @reminix/adapters @anthropic-ai/sdk
# or
pnpm add @reminix/runtime @reminix/adapters @anthropic-ai/sdkUsage
import Anthropic from '@anthropic-ai/sdk';
import { fromAnthropic } from '@reminix/adapters/anthropic';
import { serve } from '@reminix/runtime';
const client = new Anthropic();
const agent = fromAnthropic(client, {
name: 'claude-agent',
model: 'claude-sonnet-4-20250514',
system: 'You are a helpful assistant.',
});
serve(agent);Options
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | required | Name for the Reminix agent |
model | string | "claude-sonnet-4-20250514" | The model to use |
system | string | undefined | Optional system prompt |
maxTokens | number | 4096 | Maximum tokens in the response |
metadata | Record<string, unknown> | undefined | Optional metadata for the agent |
Handler Mapping
| Reminix Handler | Anthropic Method |
|---|---|
onInvoke | client.messages.create() |
onInvokeStream | client.messages.stream() |
onChat | client.messages.create() |
onChatStream | client.messages.stream() |
Example: Streaming Response
import Anthropic from '@anthropic-ai/sdk';
import { fromAnthropic } from '@reminix/adapters/anthropic';
import { serve } from '@reminix/runtime';
const client = new Anthropic();
const agent = fromAnthropic(client, {
name: 'claude-stream',
model: 'claude-sonnet-4-20250514',
system: 'You are a creative writing assistant.',
maxTokens: 2048,
});
serve(agent, { port: 8080 });Test streaming:
curl -X POST http://localhost:8080/agent/claude-stream/invoke \
-H "Content-Type: application/json" \
-d '{"input": {"prompt": "Write a haiku about coding."}, "stream": true}'