agents: report tokens + $ cost on every agent comment
Each run now appends a report to the agent's reply: the tool calls it made plus input/output token totals and the dollar cost. opencode's --format json emits per-step `tokens` and `cost` (USD, priced from the model) on step_finish events; build-activity-log.sh sums them across the run. - build-activity-log.sh: compute for EVERY agent (not just devs — @pm/@qa also call tools and cost money); output a collapsed <details> report (summary line shows "N tool calls · in X · out Y · $Z"; body lists the tools + a token/cost breakdown). Zero-tool runs get a one-line "$Z · in X · out Y" footer. - publish.sh: build $activity once (near the top) and append it to every agent's reply — @pm plan/finalize, @qa verdict/recommendations, and dev PR comments. - agent.yml: rename the step accordingly. Models without pricing (self-hosted ollama) report cost $0.0000. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
af38a44d86
commit
6334ebe8c6
@@ -185,7 +185,7 @@ jobs:
|
||||
FILES: ${{ steps.imgs.outputs.files }} # opencode -f image flags (vision agents only)
|
||||
run: bash "$SCRIPTS/run-agent.sh"
|
||||
|
||||
- name: Build activity log (tool calls + reasoning) from the event stream
|
||||
- name: Build run report (tool calls + input/output tokens + $ cost) from the event stream
|
||||
id: log
|
||||
env:
|
||||
SCRIPTS: ${{ runner.temp }}/agents-scripts
|
||||
|
||||
Reference in New Issue
Block a user