---
title: "How we make AI coding more cost efficient without sacrificing task quality"
description: "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."
url: "https://swe.quest/articles/how-we-make-ai-coding-more-cost-efficient-without-sacrificing-task-quality-07be31d835dcfb01"
canonical: "https://github.blog/ai-and-ml/github-copilot/how-we-make-ai-coding-more-cost-efficient-without-sacrificing-task-quality/"
source: "GitHub Engineering"
published: "2026-09-02"
difficulty: "medium"
kind: "Case study"
reading_minutes: 10
tags: ["ai-agents","ai-coding","llms","evals","cost-optimization"]
---

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

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2026-09-02, 10 min read, Case study. Original: [https://github.blog/ai-and-ml/github-copilot/how-we-make-ai-coding-more-cost-efficient-without-sacrificing-task-quality/](https://github.blog/ai-and-ml/github-copilot/how-we-make-ai-coding-more-cost-efficient-without-sacrificing-task-quality/)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)

## Prerequisites

- LLM agent tool calling ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- A/B testing basics ([easy posts on Testing](https://swe.quest/tags/testing.md?difficulty=easy))

## Keywords

GitHub Copilot, Copilot CLI, RTK, Copilot code review, meta-prompting

## Related posts

- [Everything We Talked About at O11yDay London 2026](https://swe.quest/articles/everything-we-talked-about-at-o11yday-london-2026-0f7b0e96a8f38f57.md): Honeycomb · 2026-10-16 · Medium · 11 min read · AI agents, Observability, AI for coding, Code review, Cost optimization
  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.
- [Does it matter how you feed an agent its context?](https://swe.quest/articles/does-it-matter-how-you-feed-an-agent-its-context-9b5070d3af38ec07.md): OLX Tech · 2026-08-21 · Medium · 7 min read · AI for coding, AI agents, Cost optimization, Evaluation
  How context is packaged for a coding agent (one big prompt, handoff notes pointing to files, staged ICM pipeline) barely changed cost, speed or quality on a realistic 18–20 file change across three mature codebases.
- [Better tools made Copilot code review worse. Here’s how we actually improved it.](https://swe.quest/articles/better-tools-made-copilot-code-review-worse-here-s-how-we-actually-improved-it-d13b0645c05f1e51.md): GitHub Engineering · 2026-07-10 · Medium · 9 min read · AI agents, Code review, LLMs, Evaluation, Cost optimization
  Swapping Copilot code review's bespoke exploration tools for the shared Copilot CLI tools (grep, glob, view) initially raised review cost and reduced useful comments, because the tool instructions encouraged broad, repo-browsing behavior instead of diff-anchored investigation.
- [Designing the hf CLI as an agent-optimized way to work with the Hub](https://swe.quest/articles/designing-the-hf-cli-as-an-agent-optimized-way-to-work-with-the-hub-e1ef73909553085b.md): Hugging Face · 2026-06-04 · Medium · 14 min read · Developer tools, AI agents, AI for coding, Evaluation
  Hugging Face rebuilt its hf CLI to serve both humans and coding agents.
- [Is it agentic enough? Benchmarking open models on your own tooling](https://swe.quest/articles/is-it-agentic-enough-benchmarking-open-models-on-your-own-tooling-0278c737719b3002.md): Hugging Face · 2026-06-18 · Medium · 15 min read · Evaluation, AI agents, AI for coding, Developer tools, API design
  A benchmarking harness measures not just whether a coding agent solves a task with a library, but how much work it took: turns, tokens, time, errors, and behavior "markers" such as whether it used a CLI or the pipeline API.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
