Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Openai Openai python Realtime Conversation Management

From Leeroopedia
Knowledge Sources
Domains Realtime_Communication, Conversation
Last Updated 2026-02-15 00:00 GMT

Overview

An event-driven interaction pattern for sending conversation items and triggering model responses over a persistent Realtime API connection.

Description

Conversation management in the Realtime API involves two primary operations: adding items to the conversation (user messages, function call outputs) and triggering model responses. Unlike request-response APIs, these are separate events sent over the WebSocket. The model can also generate responses automatically based on voice activity detection (VAD).

Items can be inserted at specific positions using previous_item_id, and responses can override session-level settings for specific turns.

Usage

Use this principle to send user input and trigger model responses in a Realtime session. Call conversation.item.create() to add a message, then response.create() to trigger generation. In VAD mode, responses may be triggered automatically after detected speech.

Theoretical Basis

Conversation management follows an Event Sourcing pattern:

# 1. Add conversation item (user message)
connection.conversation.item.create(item={
    "type": "message",
    "role": "user",
    "content": [{"type": "input_text", "text": "Hello"}]
})

# 2. Trigger model response
connection.response.create()

# 3. Server emits: response.created -> response.text.delta(s) -> response.done

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment