Skip to content

[FEATURE] Include compaction calls in token usage #5404

Description

@jimbrub

Human Overview

Need to add the token usage for compaction to the token usage tracked by the Strands SDK.

SDK Language

Both / Not language-specific

Problem Statement

Model.compact() calls the model outside the agent loop, for both the client-side default and native compaction. Anthropic reports native compaction usage in usage.iterations. Neither shows up in agent metrics or traces, so users can't see what summarization costs. The 0022 evals had to add it up by hand.

Proposed Solution

Use Case

A user compares the cost of compacting often against compacting rarely.

Additional Context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-contextSession or context relatedarea-modelRelated to models or model providersarea-otelOpen-telemetry relatedenhancementNew feature or request

Fields

Language

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions