Skip to content

docs(sdk): document per-call prompt token composition metrics - #757

Open
georgeglarson wants to merge 4 commits into
OpenHands:mainfrom
georgeglarson:feat/llm-prompt-composition-metrics
Open

docs(sdk): document per-call prompt token composition metrics#757
georgeglarson wants to merge 4 commits into
OpenHands:mainfrom
georgeglarson:feat/llm-prompt-composition-metrics

Conversation

@georgeglarson

@georgeglarson georgeglarson commented Aug 24, 2026

Copy link
Copy Markdown
Contributor
  • I have read and reviewed the documentation changes to the best of my ability.
  • If the change is significant, I have run the documentation site locally and confirmed it renders as expected.

Summary of changes

Companion documentation for the prompt token composition metrics feature (SDK PR OpenHands/software-agent-sdk#4623).

  • New guide sdk/guides/llm-prompt-composition.mdx: documents the per-call PromptComposition record on Metrics (system prompt / tool schemas / conversation history / latest message), how to join records to provider-reported usage by response_id, the estimates-vs-authoritative-usage contract, and the always-on counting cost.
  • sdk/guides/metrics.mdx: adds prompt_compositions to the Metrics field list and a Next Steps link.
  • docs.json: registers the page under SDK → Guides → LLM Features.

Validation: npx mint broken-links reports no broken links.

georgeglarson and others added 3 commits August 25, 2026 02:31
Companion to the PromptComposition feature on
software-agent-sdk feat/llm-prompt-composition-metrics: per-call
decomposition of prompt tokens into system prompt, tool schemas,
conversation history, and latest message, recorded in LLM Metrics.

Co-authored-by: openhands <openhands@all-hands.dev>
Address review findings: join compositions to token usage by response_id
instead of positionally, qualify tool_tokens > 0 as native-FC agent steps
(mock-tools renders schemas into prompt text), note litellm's tool
serialization convention and fallback tokenizer, and document the
linear-in-prompt-size counting cost.

Co-authored-by: openhands <openhands@all-hands.dev>
Mirrors the SDK docstring caveat (OpenHands/software-agent-sdk#4623):
subscription mode folds the system prompt into the first user message,
so those tokens count as history/latest on that transport.

Co-authored-by: openhands <openhands@all-hands.dev>
@georgeglarson
georgeglarson force-pushed the feat/llm-prompt-composition-metrics branch from cafa8a3 to 3784e95 Compare August 25, 2026 06:32
Address rajshah4's review on software-agent-sdk#4623: composition
recording is now opt-in (default off), so the page leads with enabling
the flag and examples show it; the metrics field list notes the gate.

Co-authored-by: openhands <openhands@all-hands.dev>
@georgeglarson
georgeglarson marked this pull request as ready for review August 25, 2026 08:00
@georgeglarson
georgeglarson requested a review from enyst as a code owner August 25, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant