A small TypeScript harness for Anthropic's advisor tool — one principal agent, one stronger consultant.
The advisor tool lets a fast executor model (Sonnet, Haiku) consult a stronger advisor model (Opus) mid-generation. The advisor reads the full transcript, returns a short plan, and the executor continues. Most tokens stay at executor rates; you only pay Opus for the planning.
This repo is the smallest interesting wrapper around that pattern.
npm install
cp .env.example .env # then add your ANTHROPIC_API_KEYRequires Node 22+.
# default task — concurrent worker pool in Go
npm start
# any task you want
npm start -- "Refactor this Python script to stream results" Optional model overrides:
CONSEILLER_EXECUTOR=claude-haiku-4-5-20251001 \
CONSEILLER_ADVISOR=claude-opus-4-7 \
npm start -- "..."You'll see the executor's response, how many times it consulted the advisor, and a per-tier usage breakdown so you can sanity-check the cost shape:
─── usage ────────────────────────────────────────────
executor in=412 out=1230 cache_read=0
advisor in=823 out=531 cache_read=0
──────────────────────────────────────────────────────
Executor and advisor tokens are billed at their respective model rates.
src/prompts.ts— the recommended advisor system prompt blocks (timing, trust, conciseness)src/conseiller.ts— theConseillerclass. Owns the message history and thebeta.messages.createcall with the advisor tool wired insrc/index.ts— CLI entry point
The harness uses the advisor-tool-2026-03-01 beta header. Advisor caching ({type: "ephemeral", ttl: "5m"}) is on by default — pays off after ~3 advisor calls per conversation.
The advisor must be at least as capable as the executor. As of this writing:
| Executor | Advisor |
|---|---|
claude-haiku-4-5-20251001 |
claude-opus-4-7 |
claude-sonnet-4-6 |
claude-opus-4-7 |
claude-opus-4-6 |
claude-opus-4-7 |
claude-opus-4-7 |
claude-opus-4-7 |
- The advisor tool is in beta. Things may change.
- The
server_tool_useblock'sinputis always empty — the executor signals timing only; the server forwards the full transcript on its own. - The advisor's thinking tokens are dropped server-side; only the advice text returns.
max_tokensapplies to executor output only; it does not bound advisor output.