Skip to content

Commit c2f9a45

Browse files
authored
fix(DATAGO-128008):- enable auto-compaction out the gate & provide docs (#1279)
1 parent e7a5410 commit c2f9a45

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

docs/docs/documentation/installing-and-configuring/session-storage.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,22 @@ Parameters:
303303
- `database_url`: Connection string for the agent's database
304304
- `default_behavior`: `"PERSISTENT"` (reuse sessions) or `"RUN_BASED"` (new session per run)
305305

306+
### Auto-Compaction for Long Conversations
307+
308+
Agents automatically compact conversation history when context limits are exceeded. This feature is enabled by default and requires no configuration.
309+
310+
When an LLM returns a context window overflow error, the system intercepts it and automatically compacts the first N% of conversation turns (where N is the compaction_percentage), then retries the request. You can control what percentage of history is compacted using the `compaction_percentage` setting:
311+
312+
```yaml
313+
auto_summarization:
314+
# Compact 50% of conversation history when limits are reached
315+
# Default: 0.25 (25%)
316+
# Range: 0.0 - 1.0 (e.g., 0.25 = 25%, 0.5 = 50%, 0.8 = 80%)
317+
compaction_percentage: 0.5
318+
```
319+
320+
The system always compacts up to the nearest complete conversation turn and preserves at least one recent turn uncompacted.
321+
306322
### Environment Variables
307323

308324
Each agent can have its own database credentials:

examples/shared_config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ shared_config:
144144

145145
# default auto_summarization settings.
146146
auto_summarization: &default_auto_summarization
147-
# Enable/disable automatic conversation history summarization
148-
# Set to true to enable, false to disable (default: false)
149-
enabled: ${SAM_ENABLE_AUTO_SUMMARIZATION, false}
150-
151147
# Percentage of conversation to compact when summarisation is triggered
152148
# Conservative default: 0.25 = 25%
153149
# Range: 0.0 - 1.0 (e.g., 0.25 = 25%, 0.5 = 50%, 0.8 = 80%)

src/solace_agent_mesh/agent/adk/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ async def run_adk_async_task_thread_wrapper(
14081408
"""
14091409
# Read auto-summarization config from component (per-agent configuration)
14101410
auto_sum_config = component.auto_summarization_config
1411-
compaction_enabled = auto_sum_config.get("enabled", False)
1411+
compaction_enabled = auto_sum_config.get("enabled", True)
14121412
compaction_percentage = auto_sum_config.get("compaction_percentage", 0.25)
14131413

14141414
logical_task_id = a2a_context.get("logical_task_id", "unknown_task")

src/solace_agent_mesh/agent/adk/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ def initialize_session_service(component) -> BaseSessionService:
519519

520520
# Check if auto-summarization is enabled from component config
521521
auto_sum_config = component.auto_summarization_config
522-
if auto_sum_config.get("enabled", False):
522+
if auto_sum_config.get("enabled", True):
523523
# Wrap with FilteringSessionService to automatically filter ghost events
524524
# This ensures ALL get_session() calls across the codebase get filtered sessions
525525
# There is a risk of spilling summary events in case if flag flips between True/False - and no filtering.

src/solace_agent_mesh/agent/sac/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __init__(self, **kwargs):
206206
)
207207
self.auto_summarization_config = self.get_config(
208208
"auto_summarization", {
209-
"enabled": False,
209+
"enabled": True,
210210
"compaction_percentage": 0.25
211211
}
212212
)

src/solace_agent_mesh/workflow/component.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def __init__(self, **kwargs):
9292
workflow_config = self.get_config("workflow")
9393
self.auto_summarization_config = self.get_config(
9494
"auto_summarization", {
95-
"enabled": False,
95+
"enabled": True,
9696
"compaction_percentage": 0.25
9797
}
9898
)

templates/shared_config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,8 @@ shared_config:
9090
max_result_preview_bytes: 4096
9191

9292
# Auto-summarization configuration (prevents "too many tokens" errors)
93-
# DISABLED by default - agents must explicitly enable it
93+
# Enabled by default to prevent context limit issues in long conversations
9494
auto_summarization: &default_auto_summarization
95-
# Enable/disable automatic conversation history summarization
96-
# Set to true to enable, false to disable (default: false)
97-
enabled: ${SAM_ENABLE_AUTO_SUMMARIZATION, false}
98-
9995
# Percentage of conversation to compact when threshold exceeded
10096
# Conservative default: 0.25 = 25%
10197
# Range: 0.0 - 1.0 (e.g., 0.25 = 25%, 0.5 = 50%, 0.8 = 80%)

0 commit comments

Comments
 (0)