Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@agentick/anthropic

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentick/anthropic

Anthropic adapter for Agentick

latest
Source
npmnpm
Version
0.14.68
Version published
Maintainers
2
Created
Source

@agentick/anthropic

Native Anthropic Messages API adapter for Agentick.

Installation

pnpm add @agentick/anthropic @anthropic-ai/sdk

Usage

import { anthropic } from "@agentick/anthropic";
import { createApp } from "@agentick/core";

const model = anthropic("claude-sonnet-4-20250514");

// Use with createApp
const app = createApp(MyAgent, { model });
const session = await app.session();
await session.run({ messages: [{ role: "user", content: [{ type: "text", text: "Hello!" }] }] });

// Or with config object
const model = anthropic({
  model: "claude-opus-4-20250514",
  maxTokens: 8192,
  apiKey: process.env.ANTHROPIC_API_KEY,
});

JSX Component Pattern

import { AnthropicModel } from "@agentick/anthropic";

function MyAgent() {
  return (
    <AnthropicModel model="claude-sonnet-4-20250514" maxTokens={4096}>
      <System>You are helpful.</System>
      <Timeline />
    </AnthropicModel>
  );
}

Features

  • Streaming - Full streaming support with deltas
  • Tool calling - Native Anthropic tool use
  • Extended thinking - Reasoning/thinking blocks from supported models
  • Vision - Image understanding via base64 or URL
  • Prompt caching - Anthropic cache control support
  • Documents - PDF and document content blocks

Configuration

OptionTypeDescription
modelstringModel name (e.g., claude-sonnet-4-20250514)
apiKeystring?API key (env: ANTHROPIC_API_KEY)
baseURLstring?Custom API endpoint (env: ANTHROPIC_BASE_URL)
maxTokensnumber?Maximum tokens to generate
headersobject?Additional request headers
timeoutnumber?Request timeout in milliseconds
maxRetriesnumber?Maximum retry attempts
clientAnthropic?Pre-configured Anthropic SDK client instance
customBlocksobject?Custom block definitions to intercept from output
deltaTransformfunction?User-facing delta transform

Environment Variables

VariableDescription
ANTHROPIC_API_KEYAnthropic API key
ANTHROPIC_BASE_URLCustom API endpoint

Models

  • claude-opus-4-20250514
  • claude-sonnet-4-20250514
  • claude-3-5-haiku-20241022
  • claude-3-5-sonnet-20241022

Exports

  • anthropic(configOrModel) - Factory function returning ModelClass
  • createAnthropicModel(config) - Same as anthropic()
  • AnthropicModel - JSX component for declarative usage

Keywords

adapter

FAQs

Package last updated on 19 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts