Include model_id and provider in AGENT_COMPLETE events#71
Merged
Conversation
Copilot created this pull request from a session on behalf of
galuszkm
July 18, 2026 18:03
View session
galuszkm
marked this pull request as ready for review
July 18, 2026 18:04
galuszkm
requested changes
Jul 18, 2026
| "output_tokens": usage.get("outputTokens", 0), | ||
| "total_tokens": usage.get("totalTokens", 0), | ||
| }, | ||
| "model_id": model.model_id, |
Member
There was a problem hiding this comment.
Would be better to have it collected as “model”:{“model_id”:…, “provider”: …}
Contributor
Author
There was a problem hiding this comment.
Done in b8f8e0b — payload is now "model": {"model_id": ..., "provider": ...}.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the AGENT_COMPLETE event payload so consumers can attribute token usage to a specific model/provider without having to join against the SESSION_START manifest, which simplifies downstream cost calculation.
Changes:
- Exposes model descriptor extraction as
manifest.model_descriptor(agent)(renamed from a private helper) for reuse outside manifest building. - Enriches
EventPublisher’sAGENT_COMPLETEpayload with model identification data derived from the agent (model_id,provider). - Adds a regression test and updates the docs event reference table to reflect the new payload fields.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/runtime/test_event_stream.py | Adds coverage asserting AGENT_COMPLETE includes model identity info. |
| src/strands_compose/manifest.py | Makes model descriptor extraction a public helper used by multiple components. |
| src/strands_compose/hooks/event_publisher.py | Adds model identity information to AGENT_COMPLETE event data. |
| docs/configuration/Chapter_15.md | Documents the updated AGENT_COMPLETE payload fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Consumers of
EventPublisherhad to correlateAGENT_COMPLETEtoken usage against theSESSION_STARTmanifest by agent name just to look up which model produced the usage — extra state to track for a simple cost calculation.manifest._model_descriptorto publicmanifest.model_descriptor(agent), no logic change, now reusable outside manifest building.AGENT_COMPLETEpayload:EventPublisher._on_completenow callsmodel_descriptor(event.agent)and addsmodel_idandproviderto the eventdata, alongside the existingusage,text, andmessage.