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
2 changes: 2 additions & 0 deletions .konflux/requirements-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ hatchling==1.33.0
# logfire
# logfire-sdk
# pydantic-ai
# pydantic-ai-harness
# pydantic-ai-skills
# pydantic-ai-slim
# pydantic-evals
Expand Down Expand Up @@ -95,6 +96,7 @@ uv-dynamic-versioning==0.14.1
# via
# genai-prices
# pydantic-ai
# pydantic-ai-harness
# pydantic-ai-slim
# pydantic-evals
# pydantic-graph
Expand Down
3 changes: 3 additions & 0 deletions .konflux/requirements.hashes.source.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ presidio-anonymizer==2.2.366 \
pydantic-ai==2.38.0 \
--hash=sha256:2dc423fefdaf04998889440404ec84ea9060f7bc9dfadbc94be1f5c8cbcc0324 \
--hash=sha256:90fff4dd3b1db9994861bd102c786d471b81e07a3165c751f403b414bd02e3f9
pydantic-ai-harness==0.30.0 \
--hash=sha256:226d35fc3602852e92adf26b5a29717721d66da0f99d5cbff6043bf49ecb0fee \
--hash=sha256:f9eaa6c19abf47e7af9a84c86124e96c59b432afe8b9f7deae3d9e98fa4677ef
pydantic-ai-skills==1.4.0 \
--hash=sha256:7303e0738a837218415f8b2e7bd5b5cbc0ceeb74850b1902c2d079550e0b9b83 \
--hash=sha256:bce8731a042f50c45965acc520dc883163e511c34b208f720eb62067ef5be686
Expand Down
14 changes: 13 additions & 1 deletion docs/devel_doc/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -13417,12 +13417,24 @@
"title": "Buffer max ratio",
"description": "Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns.",
"default": 0.3
},
"summary_prompt": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Summary prompt",
"description": "Prompt template for summarizing older turns in the Pydantic AI compaction. The conversation transcript replaces the {messages} placeholder, which is required; no other replacement field is allowed, so double any literal braces. When unset, the default prompt is used."
}
},
"additionalProperties": false,
"type": "object",
"title": "CompactionConfiguration",
"description": "Configuration for conversation history compaction.\n\nCompaction summarizes older conversation turns when their estimated\ntoken count approaches the context window limit, keeping the\nconversation usable instead of failing with HTTP 413. The\nconfiguration here controls when compaction triggers and how much\nrecent context is preserved verbatim.\n\nAttributes:\n enabled: Master switch. When False, compaction never triggers\n and other fields are inert.\n threshold_ratio: Trigger compaction when estimated input tokens\n exceed this fraction of the model's context window\n (clamped to 0.0..1.0).\n token_floor: Minimum estimated token count before compaction\n can trigger, regardless of threshold_ratio. Prevents\n triggering on very small context windows.\n buffer_turns: Initial number of recent turns to keep verbatim.\n The runtime applies a degrading guard \u2014 if these turns\n exceed the available budget, it reduces buffer_turns by\n one repeatedly until the budget fits, down to zero.\n buffer_max_ratio: Hard cap on the fraction of the context\n window the buffer zone may occupy, regardless of\n buffer_turns."
"description": "Configuration for conversation history compaction.\n\nCompaction summarizes older conversation turns when their estimated\ntoken count approaches the context window limit, keeping the\nconversation usable instead of failing with HTTP 413. The\nconfiguration here controls when compaction triggers and how much\nrecent context is preserved verbatim.\n\nAttributes:\n enabled: Master switch. When False, compaction never triggers\n and other fields are inert.\n threshold_ratio: Trigger compaction when estimated input tokens\n exceed this fraction of the model's context window\n (clamped to 0.0..1.0).\n token_floor: Minimum estimated token count before compaction\n can trigger, regardless of threshold_ratio. Prevents\n triggering on very small context windows.\n buffer_turns: Initial number of recent turns to keep verbatim.\n The runtime applies a degrading guard \u2014 if these turns\n exceed the available budget, it reduces buffer_turns by\n one repeatedly until the budget fits, down to zero.\n buffer_max_ratio: Hard cap on the fraction of the context\n window the buffer zone may occupy, regardless of\n buffer_turns.\n summary_prompt: Optional prompt template for summarizing older\n turns in the Pydantic AI compaction. It must contain the\n ``{messages}`` placeholder and no other replacement field;\n when unset, the default prompt is used."
},
"Configuration": {
"properties": {
Expand Down
5 changes: 5 additions & 0 deletions docs/devel_doc/openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6078,6 +6078,10 @@ Attributes:
buffer_max_ratio: Hard cap on the fraction of the context
window the buffer zone may occupy, regardless of
buffer_turns.
summary_prompt: Optional prompt template for summarizing older
turns in the Pydantic AI compaction. It must contain the
``{messages}`` placeholder and no other replacement field;
when unset, the default prompt is used.


| Field | Type | Description |
Expand All @@ -6087,6 +6091,7 @@ Attributes:
| token_floor | integer | Minimum token count before compaction can trigger. Prevents triggering on very small context windows. |
| buffer_turns | integer | Number of recent turns to keep verbatim. |
| buffer_max_ratio | number | Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns. |
| summary_prompt | | Prompt template for summarizing older turns in the Pydantic AI compaction. The conversation transcript replaces the {messages} placeholder, which is required; no other replacement field is allowed, so double any literal braces. When unset, the default prompt is used. |


## Configuration
Expand Down
9 changes: 8 additions & 1 deletion docs/models/successful_responses.json
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@
},
"CompactionConfiguration": {
"additionalProperties": false,
"description": "Configuration for conversation history compaction.\n\nCompaction summarizes older conversation turns when their estimated\ntoken count approaches the context window limit, keeping the\nconversation usable instead of failing with HTTP 413. The\nconfiguration here controls when compaction triggers and how much\nrecent context is preserved verbatim.\n\nAttributes:\n enabled: Master switch. When False, compaction never triggers\n and other fields are inert.\n threshold_ratio: Trigger compaction when estimated input tokens\n exceed this fraction of the model's context window\n (clamped to 0.0..1.0).\n token_floor: Minimum estimated token count before compaction\n can trigger, regardless of threshold_ratio. Prevents\n triggering on very small context windows.\n buffer_turns: Initial number of recent turns to keep verbatim.\n The runtime applies a degrading guard \u2014 if these turns\n exceed the available budget, it reduces buffer_turns by\n one repeatedly until the budget fits, down to zero.\n buffer_max_ratio: Hard cap on the fraction of the context\n window the buffer zone may occupy, regardless of\n buffer_turns.",
"description": "Configuration for conversation history compaction.\n\nCompaction summarizes older conversation turns when their estimated\ntoken count approaches the context window limit, keeping the\nconversation usable instead of failing with HTTP 413. The\nconfiguration here controls when compaction triggers and how much\nrecent context is preserved verbatim.\n\nAttributes:\n enabled: Master switch. When False, compaction never triggers\n and other fields are inert.\n threshold_ratio: Trigger compaction when estimated input tokens\n exceed this fraction of the model's context window\n (clamped to 0.0..1.0).\n token_floor: Minimum estimated token count before compaction\n can trigger, regardless of threshold_ratio. Prevents\n triggering on very small context windows.\n buffer_turns: Initial number of recent turns to keep verbatim.\n The runtime applies a degrading guard \u2014 if these turns\n exceed the available budget, it reduces buffer_turns by\n one repeatedly until the budget fits, down to zero.\n buffer_max_ratio: Hard cap on the fraction of the context\n window the buffer zone may occupy, regardless of\n buffer_turns.\n summary_prompt: Optional prompt template for summarizing older\n turns in the Pydantic AI compaction. It must contain the\n ``{messages}`` placeholder and no other replacement field;\n when unset, the default prompt is used.",
"properties": {
"enabled": {
"default": false,
Expand Down Expand Up @@ -901,6 +901,13 @@
"description": "Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns.",
"title": "Buffer max ratio",
"type": "number"
},
"summary_prompt": {
"type": "string",
"nullable": true,
"default": null,
"description": "Prompt template for summarizing older turns in the Pydantic AI compaction. The conversation transcript replaces the {messages} placeholder, which is required; no other replacement field is allowed, so double any literal braces. When unset, the default prompt is used.",
"title": "Summary prompt"
}
},
"title": "CompactionConfiguration",
Expand Down
5 changes: 5 additions & 0 deletions docs/models/successful_responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ Attributes:
buffer_max_ratio: Hard cap on the fraction of the context
window the buffer zone may occupy, regardless of
buffer_turns.
summary_prompt: Optional prompt template for summarizing older
turns in the Pydantic AI compaction. It must contain the
``{messages}`` placeholder and no other replacement field;
when unset, the default prompt is used.


| Field | Type | Description |
Expand All @@ -427,6 +431,7 @@ Attributes:
| token_floor | integer | Minimum token count before compaction can trigger. Prevents triggering on very small context windows. |
| buffer_turns | integer | Number of recent turns to keep verbatim. |
| buffer_max_ratio | number | Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns. |
| summary_prompt | string | Prompt template for summarizing older turns in the Pydantic AI compaction. The conversation transcript replaces the {messages} placeholder, which is required; no other replacement field is allowed, so double any literal braces. When unset, the default prompt is used. |


## Configuration
Expand Down
14 changes: 13 additions & 1 deletion docs/user_doc/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,10 @@ <h2 id="compactionconfiguration">CompactionConfiguration</h2>
&#x2014; if these turns exceed the available budget, it reduces buffer_turns by
one repeatedly until the budget fits, down to zero. buffer_max_ratio:
Hard cap on the fraction of the context window the buffer zone may
occupy, regardless of buffer_turns.</p>
occupy, regardless of buffer_turns. summary_prompt: Optional prompt
template for summarizing older turns in the Pydantic AI compaction. It
must contain the <code>{messages}</code> placeholder and no other
replacement field; when unset, the default prompt is used.</p>
<table>
<colgroup>
<col style="width: 26%"/>
Expand Down Expand Up @@ -599,6 +602,15 @@ <h2 id="compactionconfiguration">CompactionConfiguration</h2>
<td>Maximum fraction of context window the buffer zone can occupy,
regardless of buffer_turns.</td>
</tr>
<tr>
<td>summary_prompt</td>
<td>string</td>
<td>Prompt template for summarizing older turns in the Pydantic AI
compaction. The conversation transcript replaces the {messages}
placeholder, which is required; no other replacement field is allowed,
so double any literal braces. When unset, the default prompt is
used.</td>
</tr>
</tbody>
</table>
<h2 id="configuration">Configuration</h2>
Expand Down
9 changes: 8 additions & 1 deletion docs/user_doc/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@
},
"CompactionConfiguration": {
"additionalProperties": false,
"description": "Configuration for conversation history compaction.\n\nCompaction summarizes older conversation turns when their estimated\ntoken count approaches the context window limit, keeping the\nconversation usable instead of failing with HTTP 413. The\nconfiguration here controls when compaction triggers and how much\nrecent context is preserved verbatim.\n\nAttributes:\n enabled: Master switch. When False, compaction never triggers\n and other fields are inert.\n threshold_ratio: Trigger compaction when estimated input tokens\n exceed this fraction of the model's context window\n (clamped to 0.0..1.0).\n token_floor: Minimum estimated token count before compaction\n can trigger, regardless of threshold_ratio. Prevents\n triggering on very small context windows.\n buffer_turns: Initial number of recent turns to keep verbatim.\n The runtime applies a degrading guard — if these turns\n exceed the available budget, it reduces buffer_turns by\n one repeatedly until the budget fits, down to zero.\n buffer_max_ratio: Hard cap on the fraction of the context\n window the buffer zone may occupy, regardless of\n buffer_turns.",
"description": "Configuration for conversation history compaction.\n\nCompaction summarizes older conversation turns when their estimated\ntoken count approaches the context window limit, keeping the\nconversation usable instead of failing with HTTP 413. The\nconfiguration here controls when compaction triggers and how much\nrecent context is preserved verbatim.\n\nAttributes:\n enabled: Master switch. When False, compaction never triggers\n and other fields are inert.\n threshold_ratio: Trigger compaction when estimated input tokens\n exceed this fraction of the model's context window\n (clamped to 0.0..1.0).\n token_floor: Minimum estimated token count before compaction\n can trigger, regardless of threshold_ratio. Prevents\n triggering on very small context windows.\n buffer_turns: Initial number of recent turns to keep verbatim.\n The runtime applies a degrading guard — if these turns\n exceed the available budget, it reduces buffer_turns by\n one repeatedly until the budget fits, down to zero.\n buffer_max_ratio: Hard cap on the fraction of the context\n window the buffer zone may occupy, regardless of\n buffer_turns.\n summary_prompt: Optional prompt template for summarizing older\n turns in the Pydantic AI compaction. It must contain the\n ``{messages}`` placeholder and no other replacement field;\n when unset, the default prompt is used.",
"properties": {
"enabled": {
"default": false,
Expand Down Expand Up @@ -422,6 +422,13 @@
"description": "Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns.",
"title": "Buffer max ratio",
"type": "number"
},
"summary_prompt": {
"type": "string",
"nullable": true,
"default": null,
"description": "Prompt template for summarizing older turns in the Pydantic AI compaction. The conversation transcript replaces the {messages} placeholder, which is required; no other replacement field is allowed, so double any literal braces. When unset, the default prompt is used.",
"title": "Summary prompt"
}
},
"title": "CompactionConfiguration",
Expand Down
23 changes: 14 additions & 9 deletions docs/user_doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,20 @@ Attributes:
buffer_max_ratio: Hard cap on the fraction of the context
window the buffer zone may occupy, regardless of
buffer_turns.


| Field | Type | Description |
|------------------|---------|-------------- |
| enabled | boolean | When true, older conversation turns are summarized when estimated tokens approach the context window limit. |
| threshold_ratio | number | Trigger compaction when estimated tokens exceed this fraction of the model's context window (0.0-1.0). |
| token_floor | integer | Minimum token count before compaction can trigger. Prevents triggering on very small context windows. |
| buffer_turns | integer | Number of recent turns to keep verbatim. |
| buffer_max_ratio | number | Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns. |
summary_prompt: Optional prompt template for summarizing older
turns in the Pydantic AI compaction. It must contain the
``{messages}`` placeholder and no other replacement field;
when unset, the default prompt is used.


| Field | Type | Description |
|------------------|---------|-------------- |
| enabled | boolean | When true, older conversation turns are summarized when estimated tokens approach the context window limit. |
| threshold_ratio | number | Trigger compaction when estimated tokens exceed this fraction of the model's context window (0.0-1.0). |
| token_floor | integer | Minimum token count before compaction can trigger. Prevents triggering on very small context windows. |
| buffer_turns | integer | Number of recent turns to keep verbatim. |
| buffer_max_ratio | number | Maximum fraction of context window the buffer zone can occupy, regardless of buffer_turns. |
| summary_prompt | string | Prompt template for summarizing older turns in the Pydantic AI compaction. The conversation transcript replaces the {messages} placeholder, which is required; no other replacement field is allowed, so double any literal braces. When unset, the default prompt is used. |


## Configuration
Expand Down
Loading
Loading