Skip to content

ACP server (copilot --acp) does not expose token/context usage in any protocol message #4174

Closed

Description

@maxplangg

acp-evidence-1784403354951.log

Describe the feature or problem you'd like to solve

The ACP server (copilot --acp --stdio / --port) does not expose any token usage, context consumption, or cost information anywhere in the protocol — not in the initialize response, not in session/update notifications, and not in the final session/prompt result. This makes it impossible for any ACP client (IDE integration, CI/CD orchestration, cost-monitoring tooling) to track how much a session consumed, which matters especially for CI/CD use cases, since ACP is explicitly listed as a supported use case for "orchestrating agentic coding tasks in automated workflows."

Proposed solution

Surface token/context usage as part of the ACP protocol, for example:

An additional field in the session/prompt result (e.g. usage: { inputTokens, outputTokens }), similar to how other agent protocols report usage per turn.
And/or a dedicated session/update notification (or a _meta extension field on existing updates) reporting cumulative usage per session, so long-running sessions can be monitored incrementally rather than only at the end.

Example prompts or workflows

  • Running an ACP session inside a CI/CD job and failing the build if a step exceeds a token budget.
  • An IDE (e.g. Zed) showing a live token/cost meter next to the agent panel during an ACP session.
  • A cost-monitoring dashboard aggregating token consumption across multiple concurrent ACP sessions.
  • A multi-agent orchestrator comparing cost across turns/agents to decide whether to continue or stop a task.
  • Engineering leads attributing Copilot CLI cost per repository/per CI job when it's invoked via ACP in automated workflows.

Additional context

I ran a full session end-to-end (initialize → session/new → session/prompt → final response) and inspected every single raw NDJSON message exchanged (176 messages total). None of them contain any field related to token, usage, cost, credit, billing, or quota. The final result of session/prompt is simply:

{"jsonrpc":"2.0","id":3,"result":{"stopReason":"end_turn"}}

For comparison, this isn't a hypothetical ask — community ACP bridges for other agents already do this:

  • codex-acp (both cola-io/codex-acp and the agentclientprotocol/codex-acp org package) explicitly lists token usage as one of the event types it maps into ACP session/update notifications, sourced from Codex's own EventMsg::TokenCount events.
  • The acp-adapter project (bridging both Codex and Claude Code to ACP) maps a thread/tokenUsage/updated event from the underlying CLI into the ACP session stream.

In both cases, the underlying CLI already tracks token usage internally, and the ACP bridge simply forwards it. Copilot CLI's ACP server is implemented natively (not as a third-party bridge), so there's no external translation layer blocking this.

Copilot CLI version at time of testing: 1.0.72-1 (from the initialize response's agentInfo)
ACP protocol version: 1
Reproduction: copilot --acp --stdio, send initialize → session/new → session/prompt, capture and inspect every raw NDJSON line exchanged.
Related: #2947 ("Enable token usage to be reported in CLI for any session") — same underlying gap, different surface (ACP vs. interactive CLI).

Activity

  1. added
    area:context-memoryContext window, memory, compaction, checkpoints, and instruction loading
    area:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation
    and removed on Jul 19, 2026
  2. self-assigned this
    on Jul 27, 2026
  3. DinahK-2SO commented on Aug 4, 2026

    @DinahK-2SO

    Hi @devm33 , thanks for adding session usage in acp. By any chance would you also add the cost field in the session usage object ?
    I opened another bug to track:

  4. maxplangg commented on Aug 4, 2026

    @maxplangg
    Author

    Confirmed — GitHub Copilot CLI 1.0.78.

    Re-ran the same test as in the original report (copilot --acp --stdio, initialize → session/new → session/prompt), and the session/prompt result now includes a usage object:

    {
      "inputTokens": 13140,
      "outputTokens": 403,
      "totalTokens": 13543,
      "thoughtTokens": 256,
      "cachedReadTokens": 0,
      "cachedWriteTokens": 0
    }
    

    Exactly what was requested in the original report. Thanks for picking this up, @devm33!

  5. douglasjunior commented on Aug 6, 2026

    @douglasjunior

    I noticed that Copilot is reporting usage cumulatively, that is, on each turn it returns the tokens consumed over the whole session rather than the tokens consumed in that turn.

    This is different from what Claude and Codex do, for example; those two return only the tokens consumed during that particular turn.

    In fact, this is a contradiction in the ACP specification, which I reported here: agentclientprotocol/agent-client-protocol#1860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingarea:non-interactiveNon-interactive mode (-p), CI/CD, ACP protocol, and headless automation

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions