Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Honeycomb 9 min read How-to mediumAdept

LLM Cost Optimization: 3 Patterns to Cut LLM Token Spend

LLM token spend is best reduced by using traces to find three waste patterns: repeated input context that doesn't improve results, retry storms and runaway agent loops, and output tokens that don't lift outcomes. For each, compare expensive and normal cohorts on high-cardinality attributes (prompt version, model, workflow step, tenant, retries) and apply targeted fixes such as filtering retrieval, summarizing history, retry limits, tighter termination conditions and structured outputs. Treat every cost cut as a production change: baseline cost per successful outcome, change one pattern at a time, and roll back if quality guardrails like completion, acceptance or parsing success regress.

Related posts

  • Everything We Talked About at O11yDay London 2026

    Honeycomb mediumAdept

    Across ten sessions at O11yDay London, the recurring bottleneck was not writing code but reviewing it, operating agents in production, and proving the spend is worth it. Speakers described instrumenting AI agents like any other production system: OpenTelemetry pipelines repaired to expose hidden Claude Agent SDK subagents, per-conversation Agent Timelines showing tokens and cost (about $1.70 and seven minutes for one review), and anomaly detection that tied a failure spike to a switch from per-PR to per-commit review. Concrete findings include roughly 80% of merged PRs at Honeycomb having no human-driven changes (prompting a rule that two developers must participate, one of whom may be a machine), Fin's measured wins from enforcing Claude Code configuration (brief mode cut output tokens ~20%, a hard nudge to cheaper models saved 7.4%), and HelloFresh seeing restores 20% faster but over 10% of investigations stalling. Corey Quinn closed by treating AI cost as an observability problem: put cost, price at time of request, and whether the result was accepted on every span, share one request ID across retries, use the OpenTelemetry GenAI semantic conventions, and enforce spend limits outside the agent loop.

  • Controlling costs when building with AI

    incident.io mediumAdept

    After hitting OpenAI billing limits broke its early AI features, incident.io built per-prompt cost attribution into its Go LLM abstraction, using reflection to capture each prompt's type name alongside token usage and emitting it to Grafana metrics and Postgres records for BI. Separate OpenAI projects per feature, mapped from source file patterns and provisioned with Terraform, give each surface its own billing limit to contain runaway spend. Daily Slack spend reports, per-message cost and latency in dev, backfill cost predictions from historical runs, and eval suites that report their cost keep spend visible to developers and let teams model feature costs before launch.

  • Building Deep Research: How we Achieved State of the Art

    Hugging Face mediumAdept

    Tavily's deep research agent reached state of the art on DeepResearch Bench while using 66% fewer tokens than LangChain's Open Deep Research, mainly through context engineering. Each tool output is distilled into a short reflection, and only past reflections are passed to the tool-calling model. Raw sources come back only for the final write-up. This turns token growth from quadratic (n·m(m+1)/2) into linear (n·m) across m iterations. Other lessons: keep orchestration simple so future model gains carry through, deduplicate sources through global state, expose a small toolset, design for failure modes, and treat LLM-as-judge evals as directional feedback rather than the optimization target.

  • Beyond LLMs: Why Scalable Enterprise AI Adoption Depends on Agent Logic

    Hugging Face easyNovice

    Agent logic, meaning deterministic software primitives such as program analysis, knowledge graphs, DAGs and planning algorithms running inside the agent harness, steers LLMs toward enterprise workflows and shrinks their context. IBM reports this yields better accuracy at far lower token cost than frontier-LLM-only or ReAct baselines. Reported results include ~30× fewer tokens for COBOL/PL/I app understanding in WCA4Z, 20-45% higher test coverage with up to 15× fewer tokens via Aster, up to 4× better incident root-cause analysis on ITBench with the Instana I3 agent, and 1.3-2× gains in compliance automation. Policy-as-code in CUGA improved task accuracy by 15-26%, and a DAG-guided maintenance agent cut token use by 77% and unsupported claims by 57%. The details are high-level and point to linked papers for methodology.

  • How we make AI coding more cost efficient without sacrificing task quality

    GitHub Engineering mediumAdept

    GitHub Copilot cut agent costs by optimizing for whole-task outcomes rather than per-tool-call token counts, after finding that aggressive shell-output compression (RTK) made agents reread or rerun commands and raised end-to-end cost. Four changes were validated with offline benchmarks and online A/B tests. They were selective output compression that preserves source-like output such as git diff and keeps a recovery path (5.5%), removing line-number prefixes from the view tool (3.1%), a meta-prompted task-tool prompt saving about 1,300 tokens per turn (2.9%), and batching background-task completion results to avoid retrieval turns (2.3%). The prompt rewrite initially serialized parallel agents, which shows that prompt behaviour needs regression tests and that savings must be measured in each workflow where a change ships.

The quest for software engineering knowledge.

Look:
Layout: