Skip to main content

Context Compaction

Call needsCompaction before each turn in a long-running session and feed the output of buildCompactPrompt back into query() to keep token usage under control.

Cost Tracking

SDK Reference

Full API reference for query(), tool(), buildTool(), and hooks

SDK Quickstart

Install the SDK and run your first query()

Telemetry

Emit session cost and token usage as OpenTelemetry metrics

Models & Providers

Configure per-model pricing used in cost calculations