Add opt-in retention for turn tool outputs (#52686)

## What changed

Add an optional `retain` flag to `TurnToolOutput` for `turn/start`. When set to `true`, pass the output to the core with a retention annotation to request retention in the thread's model history. The flag defaults to `false`, preserving existing behavior.

Update the generated JSON schemas, TypeScript types, and Python bindings to expose the flag.

## Testing

Add an integration test verifying that a retained tool output reaches the model and preserves client-authored sender metadata in persisted history, including the receiver message ID.

GitOrigin-RevId: 52893a8fcb308f26e77ba8f0bee9990073b26d54
This commit is contained in:
Won Park
2026-10-09 20:02:18 +00:00
committed by copyberry
parent c261727370
commit 45311351c2
12 changed files with 126 additions and 2 deletions
@@ -11832,6 +11832,10 @@ class TurnToolOutput(BaseModel):
name: str
namespace: str | None = None
output: FunctionCallOutputBody
retain: Annotated[
bool | None,
Field(description="Requests retention of this output in the thread's model history."),
] = None
class TurnsPage(BaseModel):