Repository navigation
feat(python): InworldRealtime speech-to-speech engine - #224
Open
fra-shipper wants to merge 1 commit into
Open
fra-shipper wants to merge 1 commit into
fra-shipper wants to merge 1 commit into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InworldRealtime, a speech-to-speech engine for Inworld's Realtime API(
getpatter.engines.inworld.InworldRealtime, flat alias from the packageroot), so a Python caller can do
InworldRealtime(voice="Ashley")the sameway they'd use
XaiRealtimeorOpenAIRealtime2.InworldRealtimeAdapter(getpatter/providers/inworld_realtime.py),which subclasses the v1
OpenAIRealtimeAdapterand overrides only theWebSocket endpoint (
wss://api.inworld.ai/v1/realtime) andprovider_key(
"inworld") — Inworld advertises an OpenAI-Realtime migration path with amatching event schema, so no new session-handling code is needed.
inworld_keyparameter throughserver.py,stream_handler.py, and the three telephony bridges (twilio.py,telnyx.py,plivo.py), and treatsinworld_realtimeasg711_ulawpass-through in each bridge's mulaw-detection branch, matching the OpenAI
realtime modes.
"inworld_realtime"to theProviderModeliteral (additive — noexisting members removed) and a new
Agent.inworld_realtime: dict | None = Nonefield carrying engine-supplied session knobs to the stream-handler.CallMetricsAccumulatornow excludesinworld_realtime(alongside theexisting
xai_realtimeexclusion) from the OpenAI-rate-table tokenaccounting, and the
_compute_costbranch explicitly zeroes stt/tts/llmcost with a comment citing Inworld's published pricing page (no Realtime
rate as of 2026-08-24) rather than silently defaulting to $0 by omission.
LocalConfig.inworld_keyand docs(
docs/python-sdk/engines.mdxoverview section,docs/python-sdk/providers/inworld-realtime.mdxfull reference,docs/docs.jsonnav entry).Defaults changed: none — every new field/parameter is additive with a
safe default (
inworld_key: str = "",Agent.inworld_realtime: dict | None = None,LocalConfig.inworld_key: str = "").Removed ids: none —
ProviderModeonly gains"inworld_realtime".Scope note: Python only.
libraries/typescript/has no equivalentchanges in this diff, which is a
sdk-parityrule violation as written; flagfor a follow-up PR or confirm this is an intentional staged Python-first
landing before merge.
Verification
libraries/python/tests/unit/test_inworld_realtime.py:21 test functions covering the adapter (endpoint/provider_key, subclassing,
defaults, base_url override + trailing-slash trim, session-config shape,
transcription-language pinning, connect/auth, setup-error surfacing, audio
send/receive, tool-call round trip, warmup no-op + unsupported parking), the
engine marker (unpacking, env-key fallback, missing-key error), agent
dispatch selecting the Inworld provider, and the cost-telemetry exclusions
(meters against the existing Inworld pricing entry, does not price against
the OpenAI rate table, reports zero AI cost deliberately).
Notes / follow-ups
above); needed to satisfy the repo's
sdk-parityrule before merge, per.claude/rules/sdk-parity.md.details (whether an Inworld account requires a session-scoped
?key=<session-id>obtained from a prior REST call, and which audioformats are accepted) are not fully public" — defaults are the
OpenAI-compatible ones, override
base_url/audio_formatper account.Docs mark the feature Beta — spec-validated, not yet live-call-validated.
Patter._park_provider_connectionsonly parks OpenAI realtime modes), so the first word on an Inworld call
always pays the cold-connect path — called out explicitly in
docs/python-sdk/engines.mdx.Realtime rate;
services/metrics.pycomments point at re-metering thisonce Inworld ships a rate and a matching
pricing.pyentry exists.new file is the 445-line test file;
client.py/server.py/metrics.pyedits are incremental diffs, not full-file rewrites).
🤖 Generated with Claude Code