Skip to content

NDJSON: subagent token usage is not reported #213

Closed

Description

@byapparov

Problem

aictrl run --format json reports subagent_start for child sessions created by the task tool. The child's model usage (input, output, reasoning and cache tokens) never shows up in the NDJSON, so the totals a consumer adds up from message_complete events undercount every run that delegates. This is the same on 0.4.8 and the 0.5.0 candidate.

In the benchmark's subagent search task, the parent's reported usage covered only the parent's own turns.

Proposal

Without changing the meaning of the parent's events, do one of the following:

  • A. Emit the child's message_complete (or a dedicated subagent_usage) with its sessionID / subagentSessionID.
  • B. Add a subagent_complete event carrying the child's aggregated usage.

Whichever is chosen, document in EVENTS.md how to compute the total cost of a run.

Acceptance criteria

  • A fake-provider test whose run delegates through task reports the child's tokens, and a consumer can sum parent + children to get the provider-side total.
  • The change is additive under schema v1.

Activity

  1. added
    bugSomething isn't working
    P2Could have - Medium
    telemetryNDJSON events, usage and observability
    on Oct 18, 2026
  2. added 2 commits that reference this issue on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Could have - MediumbugSomething isn't workingtelemetryNDJSON events, usage and observability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions