Expose IDE Task subagent token usage through local hooks

Feature request for product/service

Cursor SDK

Describe the request

We’ve integrated Cursor into a multi-agent orchestration workflow with Planner, Builder, Test and Validator roles. We need to understand token consumption by role and phase, automatically within the developer’s execution environment.

On Cursor 3.27.22, much of the integration works. The remaining gap is token usage from IDE Task children.

What we need What we’ve observed
Root token counters Input, output and cache values delivered through afterAgentResponse / stop
Child identity Lifecycle events provide identities we can correlate with dispatched roles
Native tool reporting Tool names and outcomes are captured
Child-to-role correlation Demonstrated in a bounded live test
Child token counters Not supplied by the measured child hooks

Without the child counters, parent observations cannot establish how much the orchestration consumed or which roles accounted for it.

Why this is a separate requirement from the Admin API

This builds on the earlier Cursor Hooks: Token Usage Support and How to obtain token usage per request? - #11 by kevinn.

We understand the Admin API recommendation for combined usage reporting. Our integration, however, must operate in ordinary developer environments without team-admin permissions, additional administrative credentials, or a separate service retrieving account usage. Manual exports also cannot serve as the normal collection mechanism.

We need locally delivered execution telemetry, using the operator’s existing runtime access. This does not mean local model inference.

What our investigation suggests

Source inspection of this build indicates that the child agent’s runStream computes usage and emits a turnEnded update containing five token axes. The problem appears to be exposure: those counters do not reach the child hooks or another supported local interface we could use.

That is a source-analysis finding, separate from our live hook observations. We can provide exact build fingerprints and sanitized technical evidence for engineering review.

We already have the identity chain needed to associate a Task child with its orchestration role. We are not asking Cursor to understand our role names or build our reporting layer.

A small extension to existing hooks

Could subagentStop, or an equivalent local event, expose the authentic usage for each child iteration?

For example, an illustrative proposed payload—not a payload Cursor currently emits:

{
“child_conversation_id”: “”,
“tool_call_id”: “”,
“usage_id”: “”,
“usage_scope”: “iteration”,
“usage”: {
“input_tokens”: 1200,
“output_tokens”: 180,
“cache_read_tokens”: 900,
“cache_write_tokens”: 0,
“reasoning_tokens”: 40
}
}

The exact field names are flexible. The important details are:

  • Missing counters remain absent rather than becoming zero.
  • Stable identities distinguish new usage from duplicate delivery.
  • Scope identifies whether values are per iteration or cumulative.
  • Completion and interruption semantics let consumers detect missing or partial usage.
  • Parent/child and cache/input inclusion relationships are documented so consumers can avoid double counting.
    No prompts, responses, tool arguments or outputs are needed in the usage data.

Why it matters

A parent can perform relatively little work while its Builder and Validator children consume most of the tokens. Parent-only reporting cannot reveal that distribution or tell us whether a workflow improvement reduced consumption or simply moved it into children.

Our Codex and Claude integrations can access native child-usage records locally. The current Cursor gap therefore limits comparable per-role reporting and becomes a practical runtime-selection consideration for these workflows.

Is this feasible as an additive hook enhancement, or is there an existing supported local interface we have overlooked?

I can provide sanitized measurements and a minimal reproduction, and would be happy to validate an early implementation with one parent and one Task child.

Hey @Derrick_Meade,

There isn’t a supported local interface for this on your current build, so you didn’t miss anything! Per-subagent token counts on subagentStop are something the team is looking at. Keep an eye on future releases.