@noetaris/harness-anthropic
v0.3.1
Published
Anthropic Claude adapter for @noetaris/harness
Readme
@noetaris/harness-anthropic
Anthropic Claude adapter for @noetaris/harness.
Status: not yet released. Implementation tracked in F20.
Overview
@noetaris/harness-anthropic provides a Claude class that implements the LLM and ObserverAware interfaces from @noetaris/harness. It handles translation between the harness message format and the Anthropic SDK format, and emits telemetry events (token usage, model ID) through an attached Observer.
Installation
pnpm add @noetaris/harness-anthropicPeer dependencies:
pnpm add @noetaris/harness @noetaris/harness-typesRequires Node.js ≥ 22.
Usage
import { Claude } from '@noetaris/harness-anthropic'
const llm = new Claude({ apiKey: process.env.ANTHROPIC_API_KEY })
// Wire into a harness provider slot
h.provide('model', runtime())
const agent = createAgent(h, { prompts: { system: '...' } })
const run = agent.run(initialState, { model: llm })API
Claude
Implements LLM and ObserverAware.
invoke(messages, options?)— translates harnessMessage[]andTool[]to Anthropic SDK format, callsclient.messages.create(), and maps the response back toLLMResponse.bindObserver(observer)— attaches anObserver; after eachinvoke, emits an"llm.response"event with{ tokens: { input, output }, modelId }.
MockClaude
A deterministic test double for use in tests and demos without a real API key.
Related Packages
@noetaris/harness— core execution engine@noetaris/harness-types— shared LLM type contract@noetaris/harness-openai— OpenAI adapter@noetaris/harness-google— Google Gemini adapter@noetaris/harness-otel— OpenTelemetry observer bridge
License
MIT
