Add optional tool output rendering for context window hints (#61452)

## What changed

Add the token-budget setting `context_window_as_tool_output`, defaulting to `false`. When enabled, render agent identity, context window IDs, and associated hints as an `agent.thread_hint` tool output. Use the same format for agent identity updates in forked threads.

Preserve this setting when applying model token-budget defaults without treating it as an explicit budget override.

## Testing

Update fork scenario snapshots to cover tool output rendering, including a child agent's window hint after its inherited parent context and a prediction fork above the compaction threshold.

GitOrigin-RevId: e1a7089935bd0aed44ffd15f0ae3ec41a2607218
This commit is contained in:
Ruslan Nigmatullin
2026-11-14 02:55:41 +00:00
committed by copyberry
parent d26406987e
commit c2c1ebba0a
14 changed files with 191 additions and 104 deletions
+3
View File
@@ -415,6 +415,9 @@ pub struct TokenBudgetConfigToml {
/// Whether to expose the built-in history and notes extension.
#[serde(skip_serializing_if = "Option::is_none")]
pub use_history_notes_extension: Option<bool>,
/// Render the context window and its hints as an agent.thread_hint tool output.
#[serde(skip_serializing_if = "Option::is_none")]
pub context_window_as_tool_output: Option<bool>,
/// Number of tokens remaining before auto-compaction when the wrap-up reminder is emitted.
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(range(min = 1))]