sdk-python
sdk-python copied to clipboard
[FEATURE] Include conversation summarization in parent limits, usage, and tracing
SDK Language
Python
Problem Statement
Default conversation summarization calls model.stream() directly. This bypasses Agent hooks, metrics, and tracing, so summarization usage does not debit parent limits or appear in invocation-total usage.
Proposed Solution
Have summarization participate in the request-scoped invocation context:
- Check and debit the shared budget.
- Add usage to the root invocation’s descendant total.
- Emit a standard model-call span.
- Accept the parent cancellation signal.
Alternatively, expose before/after-model callbacks or a fresh summarization-worker factory.
Use Case
Long-running Agent invocations can summarize context without creating unreported or unconstrained model usage.
Alternatives Solutions
No response
Additional Context
Current implementation: https://github.com/strands-agents/harness-sdk/blob/main/strands-py/src/strands/agent/conversation_manager/summarizing_conversation_manager.py