@@ -98,38 +98,62 @@ export class TurnResource extends APIResource {
9898}
9999
100100/**
101- * streamed agent turn completion response.
101+ * Streamed agent turn completion response.
102102 */
103103export interface AgentTurnResponseStreamChunk {
104+ /**
105+ * Individual event in the agent turn response stream
106+ */
104107 event : TurnResponseEvent ;
105108}
106109
107110/**
108111 * A single turn in an interaction with an Agentic System.
109112 */
110113export interface Turn {
114+ /**
115+ * List of messages that initiated this turn
116+ */
111117 input_messages : Array < Shared . UserMessage | Shared . ToolResponseMessage > ;
112118
113119 /**
114- * A message containing the model's (assistant) response in a chat conversation.
120+ * The model's generated response containing content and metadata
115121 */
116122 output_message : Shared . CompletionMessage ;
117123
124+ /**
125+ * Unique identifier for the conversation session
126+ */
118127 session_id : string ;
119128
129+ /**
130+ * Timestamp when the turn began
131+ */
120132 started_at : string ;
121133
134+ /**
135+ * Ordered list of processing steps executed during this turn
136+ */
122137 steps : Array <
123138 | AgentsAPI . InferenceStep
124139 | AgentsAPI . ToolExecutionStep
125140 | AgentsAPI . ShieldCallStep
126141 | AgentsAPI . MemoryRetrievalStep
127142 > ;
128143
144+ /**
145+ * Unique identifier for the turn within a session
146+ */
129147 turn_id : string ;
130148
149+ /**
150+ * (Optional) Timestamp when the turn finished, if completed
151+ */
131152 completed_at ?: string ;
132153
154+ /**
155+ * (Optional) Files or media attached to the agent's response
156+ */
133157 output_attachments ?: Array < Turn . OutputAttachment > ;
134158}
135159
@@ -193,6 +217,9 @@ export namespace Turn {
193217 * Note that URL could have length limits.
194218 */
195219 export interface URL {
220+ /**
221+ * The URL string pointing to the resource
222+ */
196223 uri : string ;
197224 }
198225 }
@@ -213,16 +240,31 @@ export namespace Turn {
213240 type : 'text' ;
214241 }
215242
243+ /**
244+ * A URL reference to external content.
245+ */
216246 export interface URL {
247+ /**
248+ * The URL string pointing to the resource
249+ */
217250 uri : string ;
218251 }
219252 }
220253}
221254
255+ /**
256+ * An event in an agent turn response stream.
257+ */
222258export interface TurnResponseEvent {
259+ /**
260+ * Event-specific payload containing event data
261+ */
223262 payload : TurnResponseEventPayload ;
224263}
225264
265+ /**
266+ * Payload for step start events in agent turn responses.
267+ */
226268export type TurnResponseEventPayload =
227269 | TurnResponseEventPayload . AgentTurnResponseStepStartPayload
228270 | TurnResponseEventPayload . AgentTurnResponseStepProgressPayload
@@ -232,72 +274,126 @@ export type TurnResponseEventPayload =
232274 | TurnResponseEventPayload . AgentTurnResponseTurnAwaitingInputPayload ;
233275
234276export namespace TurnResponseEventPayload {
277+ /**
278+ * Payload for step start events in agent turn responses.
279+ */
235280 export interface AgentTurnResponseStepStartPayload {
281+ /**
282+ * Type of event being reported
283+ */
236284 event_type : 'step_start' ;
237285
286+ /**
287+ * Unique identifier for the step within a turn
288+ */
238289 step_id : string ;
239290
240291 /**
241- * Type of the step in an agent turn.
292+ * Type of step being executed
242293 */
243294 step_type : 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval' ;
244295
296+ /**
297+ * (Optional) Additional metadata for the step
298+ */
245299 metadata ?: { [ key : string ] : boolean | number | string | Array < unknown > | unknown | null } ;
246300 }
247301
302+ /**
303+ * Payload for step progress events in agent turn responses.
304+ */
248305 export interface AgentTurnResponseStepProgressPayload {
306+ /**
307+ * Incremental content changes during step execution
308+ */
249309 delta : Shared . ContentDelta ;
250310
311+ /**
312+ * Type of event being reported
313+ */
251314 event_type : 'step_progress' ;
252315
316+ /**
317+ * Unique identifier for the step within a turn
318+ */
253319 step_id : string ;
254320
255321 /**
256- * Type of the step in an agent turn.
322+ * Type of step being executed
257323 */
258324 step_type : 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval' ;
259325 }
260326
327+ /**
328+ * Payload for step completion events in agent turn responses.
329+ */
261330 export interface AgentTurnResponseStepCompletePayload {
331+ /**
332+ * Type of event being reported
333+ */
262334 event_type : 'step_complete' ;
263335
264336 /**
265- * An inference step in an agent turn.
337+ * Complete details of the executed step
266338 */
267339 step_details :
268340 | AgentsAPI . InferenceStep
269341 | AgentsAPI . ToolExecutionStep
270342 | AgentsAPI . ShieldCallStep
271343 | AgentsAPI . MemoryRetrievalStep ;
272344
345+ /**
346+ * Unique identifier for the step within a turn
347+ */
273348 step_id : string ;
274349
275350 /**
276- * Type of the step in an agent turn.
351+ * Type of step being executed
277352 */
278353 step_type : 'inference' | 'tool_execution' | 'shield_call' | 'memory_retrieval' ;
279354 }
280355
356+ /**
357+ * Payload for turn start events in agent turn responses.
358+ */
281359 export interface AgentTurnResponseTurnStartPayload {
360+ /**
361+ * Type of event being reported
362+ */
282363 event_type : 'turn_start' ;
283364
365+ /**
366+ * Unique identifier for the turn within a session
367+ */
284368 turn_id : string ;
285369 }
286370
371+ /**
372+ * Payload for turn completion events in agent turn responses.
373+ */
287374 export interface AgentTurnResponseTurnCompletePayload {
375+ /**
376+ * Type of event being reported
377+ */
288378 event_type : 'turn_complete' ;
289379
290380 /**
291- * A single turn in an interaction with an Agentic System.
381+ * Complete turn data including all steps and results
292382 */
293383 turn : TurnAPI . Turn ;
294384 }
295385
386+ /**
387+ * Payload for turn awaiting input events in agent turn responses.
388+ */
296389 export interface AgentTurnResponseTurnAwaitingInputPayload {
390+ /**
391+ * Type of event being reported
392+ */
297393 event_type : 'turn_awaiting_input' ;
298394
299395 /**
300- * A single turn in an interaction with an Agentic System.
396+ * Turn data when waiting for external tool responses
301397 */
302398 turn : TurnAPI . Turn ;
303399 }
@@ -395,6 +491,9 @@ export namespace TurnCreateParams {
395491 * Note that URL could have length limits.
396492 */
397493 export interface URL {
494+ /**
495+ * The URL string pointing to the resource
496+ */
398497 uri : string ;
399498 }
400499 }
@@ -415,7 +514,13 @@ export namespace TurnCreateParams {
415514 type : 'text' ;
416515 }
417516
517+ /**
518+ * A URL reference to external content.
519+ */
418520 export interface URL {
521+ /**
522+ * The URL string pointing to the resource
523+ */
419524 uri : string ;
420525 }
421526 }
0 commit comments