docs(sdk): document per-call prompt token composition metrics - #757
Open
georgeglarson wants to merge 4 commits into
Open
docs(sdk): document per-call prompt token composition metrics#757georgeglarson wants to merge 4 commits into
georgeglarson wants to merge 4 commits into
Conversation
1 task
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
force-pushed
the
feat/llm-prompt-composition-metrics
branch
from
August 25, 2026 06:32
cafa8a3 to
3784e95
Compare
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
marked this pull request as ready for review
August 25, 2026 08:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Companion documentation for the prompt token composition metrics feature (SDK PR OpenHands/software-agent-sdk#4623).
sdk/guides/llm-prompt-composition.mdx: documents the per-callPromptCompositionrecord onMetrics(system prompt / tool schemas / conversation history / latest message), how to join records to provider-reported usage byresponse_id, the estimates-vs-authoritative-usage contract, and the always-on counting cost.sdk/guides/metrics.mdx: addsprompt_compositionsto the Metrics field list and a Next Steps link.docs.json: registers the page under SDK → Guides → LLM Features.Validation:
npx mint broken-linksreports no broken links.