Skip to content

Conversation

vamgan
Copy link
Contributor

@vamgan vamgan commented Sep 8, 2025

Adds cacheReadInputTokens and cacheWriteInputTokens to span attributes
in both end_model_invoke_span and end_agent_span methods to enable
monitoring of cache token usage for cost calculation.

Closes #776

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@JackYPCOnline
Copy link
Contributor

JackYPCOnline commented Sep 10, 2025

Can you rebase from main and resolve the conflicts?

@vamgan vamgan force-pushed the feat/add-cache-usage-metrics-to-span branch from cb21348 to 0623c43 Compare September 10, 2025 19:48
@vamgan vamgan force-pushed the feat/add-cache-usage-metrics-to-span branch from 0623c43 to 1e6ba4d Compare September 10, 2025 19:56
@vamgan
Copy link
Contributor Author

vamgan commented Sep 10, 2025

Can you rebase from main and resolve the conflicts?

done, thanks!

Copy link
Contributor

@JackYPCOnline JackYPCOnline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contribution!

@JackYPCOnline JackYPCOnline enabled auto-merge (squash) September 11, 2025 14:47
Adds cacheReadInputTokens and cacheWriteInputTokens to span attributes
in both end_model_invoke_span and end_agent_span methods to enable
monitoring of cache token usage for cost calculation.

Closes strands-agents#776
@vamgan vamgan force-pushed the feat/add-cache-usage-metrics-to-span branch from 1e6ba4d to 8779c5a Compare September 11, 2025 14:53
@JackYPCOnline JackYPCOnline enabled auto-merge (squash) September 11, 2025 15:03
@JackYPCOnline JackYPCOnline merged commit bf4e3e4 into strands-agents:main Sep 11, 2025
11 of 12 checks passed
@vamgan vamgan deleted the feat/add-cache-usage-metrics-to-span branch September 11, 2025 15:09
This was referenced Sep 17, 2025
Unshure pushed a commit to Unshure/sdk-python that referenced this pull request Sep 24, 2025
…nds-agents#825)

Adds cacheReadInputTokens and cacheWriteInputTokens to span attributes
in both end_model_invoke_span and end_agent_span methods to enable
monitoring of cache token usage for cost calculation.

Closes strands-agents#776

Co-authored-by: Vamil Gandhi <[email protected]>
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.

[FEATURE] Include cache usage metrics in span

5 participants