Skip to content

Runtime context_window_compression parameter #796 - 8#807

Closed
adk-bot wants to merge 1 commit into
mainfrom
agent-changes-20251022-210838
Closed

Runtime context_window_compression parameter #796 - 8#807
adk-bot wants to merge 1 commit into
mainfrom
agent-changes-20251022-210838

Conversation

@adk-bot

@adk-bot adk-bot commented Oct 22, 2025

Copy link
Copy Markdown
Collaborator

This pull request adds documentation for the new context_window_compression attribute in RunConfig, as requested in issue #796.

@joefernandez joefernandez changed the title Update ADK doc according to issue #796 - 8 Update ADK doc according to issue #796 - 8 - Runtime context_window_compression parameter Nov 4, 2025
Comment thread docs/runtime/runconfig.md
| `output_audio_transcription` | `Optional[types.AudioTranscriptionConfig]` | `AudioTranscriptionConfig` (nullable via `@Nullable`) | `None` / `null` | Configures transcription of generated audio output using the `AudioTranscriptionConfig` type. |
| `max_llm_calls` | `int` | `int` | `500` / `500` | Limits total LLM calls per run. `0` or negative means unlimited (warned); `sys.maxsize` raises `ValueError`. |
| `support_cfc` | `bool` | *Currently not supported* | `False` / N/A | **Python:** Enables Compositional Function Calling. Requires `streaming_mode=SSE` and uses the LIVE API. **Experimental.** |
| `context_window_compression` | `Optional[types.ContextWindowCompressionConfig]` | | `None` | Configuration for context window compression. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not sufficient to document this feature. What are the settings of the ContextWindowCompressionConfig class? What's a minimal example of setting this config?

@jcwriter74

jcwriter74 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Issue is closed given the below information

#19 Runtime context_window_compression parameter #807

Reasoning:

As part of the RunConfig, the ContextWindowCompressionConfig class serves as a way to manage the model’s context window. This feature helps by not exceeding the number of tokens of working memory of the model by compressing or sliding the model’s conversation history.

Implementation Example:

In a standard ADK agent.py or script using RunConfig, it is typically configured like this:

from google.adk.agents import RunConfig
from google.genai import types

run_config = RunConfig(
    context_window_compression=types.ContextWindowCompressionConfig(
        trigger_tokens=60000,
        sliding_window=types.SlidingWindow(target_tokens=5000)
    )
)

ContextWindowCompressionConfig class’ settings

The class’ settings are the following:

  • trigger_tokens (int): describes a threshold amount of tokens after which the compression of the model’s conversation history mechanism is activated.

  • sliding_window (types.SlidingWindow): defines how the context should be handled once triggered:
    ** target_tokens (int): specifies the number of tokens that should remain in the context after compression. The system will effectively "slide" the window, retaining only the most recent tokens up to this target amount.
    ** Example Usage: sliding_window=types.SlidingWindow(target_tokens=4000)

@jcwriter74 jcwriter74 closed this Jun 5, 2026
@jcwriter74 jcwriter74 changed the title Update ADK doc according to issue #796 - 8 - Runtime context_window_compression parameter Runtime context_window_compression parameter #796 - 8 Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants