The Interactions API is currently in Beta. Features and API signatures may change.
Method
string
required
The unique identifier of the interaction to retrieve
boolean
default:"false"
If true, the generated content will be streamed incrementally. Returns
Stream[InteractionSSEEvent] instead of Interaction.boolean
default:"false"
If true, includes the original input in the response
string
Optional. If set, resumes the interaction stream from the next chunk after the event marked by this ID. Can only be used if
stream is true.Response
string
Unique identifier for the interaction
string
The model used for the interaction
Input
The input provided (only if
include_input=True)Output
The generated output from the model
string
State of the interaction:
PENDING: Waiting to startRUNNING: Currently processingCOMPLETED: Finished successfullyFAILED: Encountered an errorCANCELLED: Cancelled by user
string
ISO 8601 timestamp when the interaction was created
string
ISO 8601 timestamp of the last update
object
Token usage statistics
string
ID of the previous interaction in the chain (if any)
Usage
Retrieve an Interaction
Include Original Input
Stream Retrieved Interaction
Resume Streaming from Event
Monitor Background Interaction
Check Usage Statistics
Handle Different States
Retrieve Interaction Chain
Error Handling
Compare Interaction Timing
Notes
- Only stored interactions can be retrieved (created with
store=True) - Streaming a retrieved interaction replays or continues the response
- Use
last_event_idto resume interrupted streams - Background interactions can be polled until completion
- Token usage is available after interaction completes
Streaming Behavior
Whenstream=True:
- If the interaction is complete, the full response is streamed
- If the interaction is in progress, streaming continues from the current position
- Use
last_event_idto resume from a specific point - Each event has a unique ID for resumption
See Also
- interactions.create - Create a new interaction