Sessions and steering
Create an execution session, append turns that steer active work or queue as follow-ups, set structured output and reasoning effort, and read how each input was delivered.
Use an execution session when a user needs to continue a conversation. Keep its ID in your application and append later messages to that session. Creating a new session starts separate context; it does not continue the last run automatically.
These examples use the authenticated client and project from the Quickstart.
Steer or queue input
Steering is the default for active work: the input joins the turn already running. Queued input (delivery_mode="queue") creates an independent follow-up.
The first message starts a turn. A steering message changes that active turn. A queued message waits and runs as its own follow-up. list_session_inputs shows how each input was delivered.
Keep input receipt IDs because late steering can move to a follow-up run.
Session responses are dictionaries where the API declares open objects; run responses such as runs.start use generated models. A session preserves context across turns. Keep its ID to continue the conversation.
Set structured output and reasoning effort
Set these controls when creating a session:
These controls do not select a model vendor. Inspect the run’s final output and terminal status rather than treating intermediate events as the schema-constrained result.
To explore another approach from a completed turn, see Session branching. For recurring input, see Schedules.
Read delivery and progress
The append response records admission of an input. Keep its receipt and inspect list_session_inputs to determine how it was delivered, especially when steering arrives near completion. Observe the associated run using Runs and tool requests.
An accepted turn is not the final answer.
- Use a stable idempotency key per logical input. Retrying the same input should preserve its key and payload; a genuinely new message needs a new key.
- Map sessions to your authenticated application users so one user cannot continue another user’s conversation by supplying its ID.
- A session pins its release and model. Start a new session to use a newly active release.
- Branch only when you want a separate conversation based on an eligible saved snapshot.
