Skip to content
ZHIVEXDocs

zhivex_ai.experimental.realtime

Python 0.28.3 · published wheel reference and guides.

PythonMixed

Public import paths and stability come from the installed artifact.

Use the root for Stable APIs and focused namespaces for extensions. Legacy root extension imports remain classified below.

AgentLiveEvent

Stable · agent

from zhivex_ai.experimental.realtime import AgentLiveEvent
AgentLiveEvent (public type alias or constant; no callable signature)

LiveAgentStreamResult

Stable · agent

from zhivex_ai.experimental.realtime import LiveAgentStreamResult
LiveAgentStreamResult(runner: 'asyncio.Task[AgentRunResult[AgentOutputT]]', broadcast: 'Broadcast[AgentLiveEvent]', live_session: 'asyncio.Future[Any]') -> 'None'
Abstract base class for generic types.

On Python 3.12 and newer, generic classes implicitly inherit from
Generic when they declare a parameter list after the class's name::

    class Mapping[KT, VT]:
        def __getitem__(self, key: KT) -> VT:
            ...
        # Etc.

On older versions of Python, however, generic classes have to
explicitly inherit from Generic.

After a class has been declared to be generic, it can then be used as
follows::

    def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
        try:
            return mapping[key]
        except KeyError:
            return default

RealtimeAudioOutputEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeAudioOutputEvent
RealtimeAudioOutputEvent(type: "Literal['realtime-audio-output']" = 'realtime-audio-output', audio: 'bytes' = b'', media_type: 'str' = 'audio/pcm', sample_rate_hz: 'int | None' = None, channels: 'int | None' = None, item_id: 'str | None' = None, response_id: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeAudioOutputEvent(type: "Literal['realtime-audio-output']" = 'realtime-audio-output', audio: 'bytes' = b'', media_type: 'str' = 'audio/pcm', sample_rate_hz: 'int | None' = None, channels: 'int | None' = None, item_id: 'str | None' = None, response_id: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeConnectOptions

Stable · types

from zhivex_ai.experimental.realtime import RealtimeConnectOptions
RealtimeConnectOptions(timeout_ms: 'int | None' = None, max_retries: 'int | None' = None, retry_backoff_ms: 'int | None' = None, metadata: 'dict[str, Any]' = <factory>, browser_client: 'bool' = False, subprotocols: 'list[str]' = <factory>) -> None
RealtimeConnectOptions(timeout_ms: 'int | None' = None, max_retries: 'int | None' = None, retry_backoff_ms: 'int | None' = None, metadata: 'dict[str, Any]' = <factory>, browser_client: 'bool' = False, subprotocols: 'list[str]' = <factory>)

RealtimeErrorEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeErrorEvent
RealtimeErrorEvent(type: "Literal['realtime-error']" = 'realtime-error', error: 'Exception | None' = None, message: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeErrorEvent(type: "Literal['realtime-error']" = 'realtime-error', error: 'Exception | None' = None, message: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeEvent
RealtimeEvent (public type alias or constant; no callable signature)

RealtimeGoAwayEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeGoAwayEvent
RealtimeGoAwayEvent(type: "Literal['realtime-go-away']" = 'realtime-go-away', time_left_ms: 'int | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeGoAwayEvent(type: "Literal['realtime-go-away']" = 'realtime-go-away', time_left_ms: 'int | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeModel

Stable · types

from zhivex_ai.experimental.realtime import RealtimeModel
RealtimeModel(*args, **kwargs)
Base class for protocol classes.

Protocol classes are defined as::

    class Proto(Protocol):
        def meth(self) -> int:
            ...

Such classes are primarily used with static type checkers that recognize
structural subtyping (static duck-typing).

For example::

    class C:
        def meth(self) -> int:
            return 0

    def func(x: Proto) -> int:
        return x.meth()

    func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with
@typing.runtime_checkable act as simple-minded runtime protocols that check
only the presence of given attributes, ignoring their type signatures.
Protocol classes can be generic, they are defined as::

    class GenProto[T](Protocol):
        def meth(self) -> T:
            ...

RealtimeResponseCompletedEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeResponseCompletedEvent
RealtimeResponseCompletedEvent(type: "Literal['realtime-response-complete']" = 'realtime-response-complete', reason: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeResponseCompletedEvent(type: "Literal['realtime-response-complete']" = 'realtime-response-complete', reason: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeSession

Stable · types

from zhivex_ai.experimental.realtime import RealtimeSession
RealtimeSession(*args, **kwargs)
Base class for protocol classes.

Protocol classes are defined as::

    class Proto(Protocol):
        def meth(self) -> int:
            ...

Such classes are primarily used with static type checkers that recognize
structural subtyping (static duck-typing).

For example::

    class C:
        def meth(self) -> int:
            return 0

    def func(x: Proto) -> int:
        return x.meth()

    func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with
@typing.runtime_checkable act as simple-minded runtime protocols that check
only the presence of given attributes, ignoring their type signatures.
Protocol classes can be generic, they are defined as::

    class GenProto[T](Protocol):
        def meth(self) -> T:
            ...

RealtimeSessionConfig

Stable · types

from zhivex_ai.experimental.realtime import RealtimeSessionConfig
RealtimeSessionConfig(instructions: 'str | None' = None, voice: 'str | None' = None, tools: "dict[str, 'AnyToolDefinition'] | None" = None, tool_choice: 'ToolChoice | None' = None, input_audio_media_type: 'str | None' = None, output_audio_media_type: 'str | None' = None, input_sample_rate_hz: 'int | None' = None, output_sample_rate_hz: 'int | None' = None, channels: 'int | None' = None, translation_target_language_code: 'str | None' = None, translation_echo_target_language: 'bool | None' = None, turn_detection: 'dict[str, Any] | None' = None, provider_options: 'ProviderOptions | None' = None, metadata: 'dict[str, Any]' = <factory>, auto_response: 'bool' = True) -> None
RealtimeSessionConfig(instructions: 'str | None' = None, voice: 'str | None' = None, tools: "dict[str, 'AnyToolDefinition'] | None" = None, tool_choice: 'ToolChoice | None' = None, input_audio_media_type: 'str | None' = None, output_audio_media_type: 'str | None' = None, input_sample_rate_hz: 'int | None' = None, output_sample_rate_hz: 'int | None' = None, channels: 'int | None' = None, translation_target_language_code: 'str | None' = None, translation_echo_target_language: 'bool | None' = None, turn_detection: 'dict[str, Any] | None' = None, provider_options: 'ProviderOptions | None' = None, metadata: 'dict[str, Any]' = <factory>, auto_response: 'bool' = True)

RealtimeSessionEndedEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeSessionEndedEvent
RealtimeSessionEndedEvent(type: "Literal['realtime-end']" = 'realtime-end', reason: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeSessionEndedEvent(type: "Literal['realtime-end']" = 'realtime-end', reason: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeSessionResumptionEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeSessionResumptionEvent
RealtimeSessionResumptionEvent(type: "Literal['realtime-session-resumption']" = 'realtime-session-resumption', new_handle: 'str | None' = None, resumable: 'bool | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeSessionResumptionEvent(type: "Literal['realtime-session-resumption']" = 'realtime-session-resumption', new_handle: 'str | None' = None, resumable: 'bool | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeSessionStartedEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeSessionStartedEvent
RealtimeSessionStartedEvent(type: "Literal['realtime-start']" = 'realtime-start', session_id: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeSessionStartedEvent(type: "Literal['realtime-start']" = 'realtime-start', session_id: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeTextDeltaEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeTextDeltaEvent
RealtimeTextDeltaEvent(type: "Literal['realtime-text-delta']" = 'realtime-text-delta', text_delta: 'str' = '', item_id: 'str | None' = None, response_id: 'str | None' = None, role: "Literal['assistant']" = 'assistant', provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeTextDeltaEvent(type: "Literal['realtime-text-delta']" = 'realtime-text-delta', text_delta: 'str' = '', item_id: 'str | None' = None, response_id: 'str | None' = None, role: "Literal['assistant']" = 'assistant', provider_metadata: 'dict[str, Any]' = <factory>)

RealtimeTokenResult

Stable · types

from zhivex_ai.experimental.realtime import RealtimeTokenResult
RealtimeTokenResult(value: 'str', expires_at_ms: 'int | None' = None, raw_response: 'Any' = None) -> None
RealtimeTokenResult(value: 'str', expires_at_ms: 'int | None' = None, raw_response: 'Any' = None)

RealtimeToolCallEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeToolCallEvent
RealtimeToolCallEvent(type: "Literal['realtime-tool-call']" = 'realtime-tool-call', tool_call: 'ToolCall' = <factory>) -> None
RealtimeToolCallEvent(type: "Literal['realtime-tool-call']" = 'realtime-tool-call', tool_call: 'ToolCall' = <factory>)

RealtimeToolResultEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeToolResultEvent
RealtimeToolResultEvent(type: "Literal['realtime-tool-result']" = 'realtime-tool-result', tool_result: 'ToolExecutionResult' = <factory>) -> None
RealtimeToolResultEvent(type: "Literal['realtime-tool-result']" = 'realtime-tool-result', tool_result: 'ToolExecutionResult' = <factory>)

RealtimeTranscriptEvent

Stable · types

from zhivex_ai.experimental.realtime import RealtimeTranscriptEvent
RealtimeTranscriptEvent(type: "Literal['realtime-transcript']" = 'realtime-transcript', text: 'str' = '', role: "Literal['user', 'assistant']" = 'assistant', is_final: 'bool' = False, item_id: 'str | None' = None, response_id: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>) -> None
RealtimeTranscriptEvent(type: "Literal['realtime-transcript']" = 'realtime-transcript', text: 'str' = '', role: "Literal['user', 'assistant']" = 'assistant', is_final: 'bool' = False, item_id: 'str | None' = None, response_id: 'str | None' = None, provider_metadata: 'dict[str, Any]' = <factory>)

open_websocket_connection

Stable · realtime

from zhivex_ai.experimental.realtime import open_websocket_connection
open_websocket_connection(url: 'str', *, headers: 'dict[str, str] | None' = None, options: 'RealtimeConnectOptions | None' = None) -> 'RealtimeConnection'

stream_live_agent

Stable · agent

from zhivex_ai.experimental.realtime import stream_live_agent
stream_live_agent(*, agent: 'Agent[AgentDepsT, AgentOutputT]', session: 'AgentSession | None' = None, deps: 'AgentDepsT | None' = None, tools: 'ToolSet | ToolRegistry | None' = None, skills: 'SkillSet | SkillRegistry | None' = None, tool_choice: 'str | ToolChoiceName | None' = None, tool_execution: 'ToolExecutionOptions | None' = None, connect_options: 'RealtimeConnectOptions | None' = None, realtime_config: 'RealtimeSessionConfig | None' = None, provider_options: 'dict[str, Any] | None' = None, runtime: 'AgentRuntime | None' = None, registry: 'AgentRegistry | None' = None, observer: 'AgentObserver | None' = None, prompt: 'str | None' = None, messages: 'list[ModelMessage] | None' = None, parent_run_id: 'str | None' = None, idempotency_key: 'str | None' = None, cancellation_token: 'AgentCancellationToken | None' = None, hooks: 'Iterable[AgentHooks] | None' = None, middleware: 'Iterable[AgentMiddleware] | None' = None, total_timeout_ms: 'int | None' = None, retry_jitter: 'float | None' = None, stream_buffer_size: 'int | None' = None) -> 'LiveAgentStreamResult[AgentOutputT]'

Stable bounded live-agent runtime; provider-native live transports retain their own maturity

Zhivex AI SDKsPortable by default. Native when needed.
Copied