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/sdk

Usage

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

ParameterTypeDefaultDescription
namestringrequiredName for the Reminix agent
modelstring"claude-sonnet-4-20250514"The model to use
systemstringundefinedOptional system prompt
maxTokensnumber4096Maximum tokens in the response
metadataRecord<string, unknown>undefinedOptional metadata for the agent

Handler Mapping

Reminix HandlerAnthropic Method
onInvokeclient.messages.create()
onInvokeStreamclient.messages.stream()
onChatclient.messages.create()
onChatStreamclient.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}'

On this page