Skip to content

feat(adk): add summarization middleware#729

Merged
mrh997 merged 1 commit intoalpha/08from
feat/mrh/summarize
Feb 4, 2026
Merged

feat(adk): add summarization middleware#729
mrh997 merged 1 commit intoalpha/08from
feat/mrh/summarize

Conversation

@mrh997
Copy link
Contributor

@mrh997 mrh997 commented Jan 30, 2026

Description

Add a middleware that automatically summarizes conversation history when token count exceeds the configured threshold.

Example

maxTokens := 8000
middleware := summarization.New(ctx, &summarization.Config{
    Model:        chatModel,
    TokenCounter: tokenCounter,
    Trigger: summarization.TriggerCondition{
        MaxTokens: &maxTokens,
    },
})

@mrh997 mrh997 force-pushed the feat/mrh/summarize branch 2 times, most recently from bf1135a to 14ea445 Compare January 30, 2026 07:24
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 74.55621% with 86 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (alpha/08@b1fbde2). Learn more about missing BASE report.

Files with missing lines Patch % Lines
adk/middlewares/summarization/summarization.go 76.59% 47 Missing and 19 partials ⚠️
adk/middlewares/summarization/prompt.go 64.28% 14 Missing and 6 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             alpha/08     #729   +/-   ##
===========================================
  Coverage            ?   80.43%           
===========================================
  Files               ?      137           
  Lines               ?    14369           
  Branches            ?        0           
===========================================
  Hits                ?    11557           
  Misses              ?     1930           
  Partials            ?      882           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mrh997 mrh997 force-pushed the feat/mrh/summarize branch 8 times, most recently from 3fb8234 to 1022ca7 Compare February 2, 2026 06:12
@mrh997 mrh997 force-pushed the feat/mrh/summarize branch 4 times, most recently from 6a1f86d to 2f423b5 Compare February 2, 2026 08:55
@mrh997 mrh997 force-pushed the feat/mrh/summarize branch 4 times, most recently from 16fd2cf to 07a3050 Compare February 4, 2026 03:57
@mrh997 mrh997 force-pushed the feat/mrh/summarize branch 2 times, most recently from ce45405 to e6321d4 Compare February 4, 2026 07:11
@mrh997 mrh997 force-pushed the feat/mrh/summarize branch from e6321d4 to 977c059 Compare February 4, 2026 07:49
@mrh997 mrh997 merged commit a74b18b into alpha/08 Feb 4, 2026
16 checks passed
@mrh997 mrh997 deleted the feat/mrh/summarize branch February 4, 2026 08:03
mrh997 added a commit that referenced this pull request Feb 4, 2026
mrh997 added a commit that referenced this pull request Feb 4, 2026
# Conflicts:
#	adk/middlewares/summarization/customized_action.go
#	adk/middlewares/summarization/summarization.go
mrh997 added a commit that referenced this pull request Feb 4, 2026
# Conflicts:
#	adk/middlewares/summarization/customized_action.go
#	adk/middlewares/summarization/summarization.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants