From ac53de380be7cb3011341c7175568dd2772f43c9 Mon Sep 17 00:00:00 2001 From: Nur Date: Mon, 24 Aug 2026 23:19:55 -0700 Subject: [PATCH] =?UTF-8?q?docs(agent):=20clarify=20ContextOverflowStrateg?= =?UTF-8?q?y=20=E2=80=94=20condenses=20working=20context,=20not=20stored?= =?UTF-8?q?=20history?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The enum docstring inaccurately said SUMMARIZE 'replaces the full chat history'. Corrected to explain context condensation manages the working context sent to the model on a run (not Shared Memory or stored session history, which is always retained); TRUNCATE is the default (removes oldest unprotected turns); SUMMARIZE adds latency and model cost; available 0.2.46+; precedence per-run > saved > engine default. Regenerated the API-reference block to match. Co-Authored-By: Claude Opus 4.8 --- aixplain/v2/agent.py | 19 ++++++++++++++++--- .../api-reference/python/aixplain/v2/agent.md | 12 +++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/aixplain/v2/agent.py b/aixplain/v2/agent.py index fbbd8526..e0e3393e 100644 --- a/aixplain/v2/agent.py +++ b/aixplain/v2/agent.py @@ -126,11 +126,24 @@ class OutputFormat(str, Enum): class ContextOverflowStrategy(str, Enum): - """Strategy applied when input messages exceed the model's context window. + """Strategy for condensing the working context when a run exceeds the model's context window. + + Context condensation shapes only the working context sent to the model on a + given run. It does not modify Shared Memory or the stored session history — + the complete session history is always retained. Attributes: - TRUNCATE: Remove the oldest chat-history messages until the context fits. - SUMMARIZE: Replace the full chat history with an LLM-generated summary. + TRUNCATE: Default. Remove the oldest unprotected turns until the context fits. + SUMMARIZE: Summarize older context into a shorter form the model can still + use. Retains more of the conversation's meaning than truncation, but + adds latency and model cost. + + Notes: + Available in SDK 0.2.46+ (use the current 0.2.47). Set it as the agent's + saved default (``agent.context_overflow_strategy``) or override it per run + via ``execution_params={"context_overflow_strategy": ...}``. Precedence, + highest first: per-run override -> saved agent setting -> Agent Engine + default (``truncate``). """ TRUNCATE = "truncate" diff --git a/docs/api-reference/python/aixplain/v2/agent.md b/docs/api-reference/python/aixplain/v2/agent.md index f0d29160..1c68101c 100644 --- a/docs/api-reference/python/aixplain/v2/agent.md +++ b/docs/api-reference/python/aixplain/v2/agent.md @@ -77,12 +77,18 @@ class ContextOverflowStrategy(str, Enum) [[view_source]](https://github.com/aixplain/aiXplain/blob/main/aixplain/v2/agent.py#L128) -Strategy applied when input messages exceed the model's context window. +Strategy for condensing the working context when a run exceeds the model's context window. + +Context condensation shapes only the working context sent to the model on a given run. It does not modify Shared Memory or the stored session history — the complete session history is always retained. **Attributes**: -- `TRUNCATE` - Remove the oldest chat-history messages until the context fits. -- `SUMMARIZE` - Replace the full chat history with an LLM-generated summary. +- `TRUNCATE` - Default. Remove the oldest unprotected turns until the context fits. +- `SUMMARIZE` - Summarize older context into a shorter form the model can still use. Retains more of the conversation's meaning than truncation, but adds latency and model cost. + +**Notes**: + +Available in SDK 0.2.46+ (use the current 0.2.47). Set it as the agent's saved default (`agent.context_overflow_strategy`) or override it per run via the `execution_params` argument (`context_overflow_strategy`). Precedence, highest first: per-run override, then the saved agent setting, then the Agent Engine default (`truncate`). ### AgentRunParams Objects