@@ -451,7 +451,7 @@ def __init__(
451451 ] = None ,
452452 memory : Optional [AgentMemory ] = None ,
453453 message_window_size : Optional [int ] = None ,
454- summarize_threshold : Optional [int ] = None ,
454+ summarize_threshold : Optional [int ] = 50 ,
455455 token_limit : Optional [int ] = None ,
456456 output_language : Optional [str ] = None ,
457457 tools : Optional [List [Union [FunctionTool , Callable ]]] = None ,
@@ -525,6 +525,11 @@ def __init__(
525525 f"summarize_threshold must be between 0 and 100, "
526526 f"got { summarize_threshold } "
527527 )
528+ logger .info (
529+ f"Automatic context compression is enabled. Will trigger "
530+ f"summarization when context window exceeds "
531+ f"{ summarize_threshold } % of the total token limit."
532+ )
528533 self .summarize_threshold = summarize_threshold
529534 self ._reset_summary_state ()
530535
@@ -1023,9 +1028,6 @@ def _calculate_next_summary_threshold(self) -> int:
10231028 Returns:
10241029 int: The token count threshold for next summarization.
10251030 """
1026- if self .summarize_threshold is None :
1027- return 0
1028-
10291031 token_limit = self .model_backend .token_limit
10301032 summary_token_count = self ._summary_token_count
10311033
@@ -2389,7 +2391,7 @@ def _step_impl(
23892391 ):
23902392 logger .info (
23912393 f"Summary tokens ({ summary_token_count } ) "
2392- f"exceed, full compression."
2394+ f"exceed limit , full compression."
23932395 )
23942396 # Summarize everything (including summaries)
23952397 summary = self .summarize (include_summaries = True )
@@ -2710,7 +2712,7 @@ async def _astep_non_streaming_task(
27102712 ):
27112713 logger .info (
27122714 f"Summary tokens ({ summary_token_count } ) "
2713- f"exceed, full compression."
2715+ f"exceed limit , full compression."
27142716 )
27152717 # Summarize everything (including summaries)
27162718 summary = await self .asummarize (
0 commit comments