Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions aixplain/v2/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 9 additions & 3 deletions docs/api-reference/python/aixplain/v2/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading