@agenticprimitives/orchestration-anthropic
v0.0.0-alpha.1
Published
Anthropic LLM binding for the @agenticprimitives/orchestration Planner port (the in-repo adapter, chain-state-viem pattern): createAnthropicPlanner turns a goal + exposed tools into a plan via Anthropic tool-use, plus a dependency-free fetch-based Anthrop
Maintainers
Readme
@agenticprimitives/orchestration-anthropic
The Anthropic LLM binding for the @agenticprimitives/orchestration Planner port —
the in-repo adapter (the chain-state / chain-state-viem pattern). The pure orchestration core stays
vendor-free; the Anthropic-specific translation lives here. Swap it in for the deterministic planner without
touching the loop.
Install
pnpm add @agenticprimitives/orchestration-anthropic @agenticprimitives/orchestrationQuick start
import { runIntent, type ToolSpec } from '@agenticprimitives/orchestration';
import { createAnthropicPlanner, createFetchAnthropicClient } from '@agenticprimitives/orchestration-anthropic';
const tools: ToolSpec[] = [
{ id: 'get_vault_record', description: 'Read a vault record by recordType.', inputSchema: { type: 'object', properties: { recordType: { type: 'string' } }, required: ['recordType'] } },
{ id: 'get_pii', description: 'Read the principal’s PII (high sensitivity).' },
];
// Dependency-free client — works in a Cloudflare Worker (no SDK, no node shims).
const client = createFetchAnthropicClient({ apiKey: env.ANTHROPIC_API_KEY });
const planner = createAnthropicPlanner({ client, model: 'claude-sonnet-4-6' });
const result = await runIntent(
{ goal: 'show me my profile' },
{ planner, tools, invoke: async (toolId, args) => myDelegatedMcpCall(toolId, args) },
);The model chooses which tool fits the goal; the chosen call still rides the task's on-chain delegation at the invoker (ADR-0041). The model never gains authority by being asked.
AnthropicLike
createAnthropicPlanner takes a structural AnthropicLike client (the minimal messages.create surface).
Pass either:
createFetchAnthropicClient({ apiKey })— dependency-free, Worker-friendly; or- the official
new Anthropic({ apiKey })— it satisfies the same shape.
This keeps the planner unit-testable with a fake and avoids a hard SDK dependency.
Boundaries
Imports only @agenticprimitives/orchestration (+ types). Forbidden: a2a, mcp-runtime, mcp-protocol,
delegation, service-agent. See spec.md + capability.manifest.json.
License
MIT
