Turn input
Each Turn’sinput is a list of one of these types. Resuming a Turn paused by mcp.auth_required needs no input - omit input or pass [].
User messages (
UserMessage) cannot be mixed with tool approvals or client-side tool responses in the same input list. UserToolApprovalEvent and UserToolResponseEvent may be mixed together.UserMessage
Start a new conversation or send the next user message.content is either a plain string or a list of content parts, letting you attach files alongside text.
UserMessageContentItem
A content part is one of: Text
File
UserToolApprovalEvent
Sent to resume a turn paused bytool.approval_required. One item per pending tool call.
UserToolResponseEvent
Sent to resume a turn paused bytool.response_required. One item per pending tool call.
Reference
Use an agent usesTrueFoundryGateway (client.agents.sessions.*).
create_turn_stream / createTurnStream returns a Stream of TurnStreamingEvent. Iterate the stream for event bodies; use Python .with_metadata() / TypeScript .withMetadata() to also read the SSE id (sequence number for resume). create_turn / createTurn returns the turn object immediately (no events).
Turn input JSON shapes are the same in every language.
- Python
- TypeScript
TrueFoundryGateway
client.agents.sessions.*.create
.data.list
get
.data.cancel
Session
The conversation context for a saved agent, returned bycreate and get in .data. Turns created within a session are chained automatically, so each turn sees the history of earlier ones. Key members:create_turn
running — use get_turn or create_turn_stream when you need terminal state or events.create_turn_stream
Stream[TurnStreamingEvent]). Iterating yields typed event bodies; .with_metadata() yields StreamEvent items with .id (SSE id) and .data (typed body) for resume. The first event is turn.created; the stream closes with turn.done.list_turns
get_turn
.data.Turn
A single request/response cycle within a session, returned bylist_turns and get_turn in .data. Transitions: running → done | cancelled | error.subscribe_to_turn
after_sequence_number to resume after a known point. Use .with_metadata() to read the SSE id while reconnecting. Closes when the turn reaches a terminal state. Use list_turn_events for completed turns.list_turn_events
order="asc" to replay forward. The pager auto-paginates when iterated.