ant_ai.llm.exceptions
ContextWindowExceededError
Bases: Exception
The conversation no longer fits the model's context window.
Backends raise this in place of their provider's own error (LiteLLM's
ContextWindowExceededError, OpenAI's BadRequestError with code
context_length_exceeded, ...) so the condition can be recognised without
importing the provider. The provider's exception is chained as __cause__
for logs.
The message is written here, not copied from the provider, so it carries no
prompt content or endpoint detail and is safe to forward to whoever called
the agent — which A2AExecutor does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
str | None
|
The model that refused the request, kept for logs. |
None
|
Source code in src/ant_ai/llm/exceptions.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |