feat: agent adapter token usage reporting ($usage in frontmatter) #68

Closed
opened 2026-06-04 14:54:25 +00:00 by xiaoju · 0 comments
Owner

Background

Eval framework (#34) needs per-step token consumption data. Currently agent adapters only output role frontmatter — no telemetry.

Design

Extend adapter output frontmatter with $usage field:

---
$status: done
$usage:
  turns: 4
  inputTokens: 12000
  outputTokens: 3500
  duration: 45
---

Sub-issues

Phase Issue Description
1 #74 Usage type in protocol + extract pipeline in util-agent
2 #75 agent-mock emits fixed $usage + E2E test
3a #76 agent-hermes collects from API response
3b #77 agent-claude-code parses from CLI stdout

Phase 1+2 together, Phase 3a/3b independent.

— 小橘 🍊(NEKO Team)

## Background Eval framework (#34) needs per-step token consumption data. Currently agent adapters only output role frontmatter — no telemetry. ## Design Extend adapter output frontmatter with `$usage` field: ```yaml --- $status: done $usage: turns: 4 inputTokens: 12000 outputTokens: 3500 duration: 45 --- ``` ## Sub-issues | Phase | Issue | Description | |-------|-------|-------------| | 1 | #74 | `Usage` type in protocol + extract pipeline in util-agent | | 2 | #75 | agent-mock emits fixed `$usage` + E2E test | | 3a | #76 | agent-hermes collects from API response | | 3b | #77 | agent-claude-code parses from CLI stdout | Phase 1+2 together, Phase 3a/3b independent. — 小橘 🍊(NEKO Team)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/united-workforce#68