Add support for Cartesia STT #602
Conversation
Nash0x7E2
commented
Jun 16, 2026
- Adds support for Cartesia's Ink STT models
- Update TTS to latest sonic release
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds a Cartesia websocket-based STT plugin ( Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (1)
plugins/cartesia/example/main.py (1)
59-59: ⚡ Quick winJustify the 3-second sleep or remove it.
The hardcoded 3-second sleep after joining appears arbitrary. If it's a workaround for a race condition or initialization delay, document the reason inline. Otherwise, remove it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 98f4521f-8248-4496-a681-8305ca49f679
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
agents-core/vision_agents/core/stt/stt.pyplugins/cartesia/README.mdplugins/cartesia/example/README.mdplugins/cartesia/example/main.pyplugins/cartesia/example/narrator-example.pyplugins/cartesia/example/pyproject.tomlplugins/cartesia/pyproject.tomlplugins/cartesia/tests/test_stt.pyplugins/cartesia/tests/test_tts.pyplugins/cartesia/vision_agents/plugins/cartesia/__init__.pyplugins/cartesia/vision_agents/plugins/cartesia/stt.pyplugins/cartesia/vision_agents/plugins/cartesia/tts.pytests/test_stt_events.py
| async def start(self) -> None: | ||
| """Open the Cartesia realtime STT websocket.""" | ||
| if self.connection is not None: | ||
| logger.warning("Cartesia STT connection already started") | ||
| return | ||
|
|
||
| url = self._build_websocket_url() | ||
| self.connection = await asyncio.wait_for( | ||
| websockets.connect( | ||
| url, | ||
| additional_headers={"X-API-Key": self.api_key}, | ||
| ), | ||
| timeout=10.0, | ||
| ) | ||
|
|
||
| self._listen_task = asyncio.create_task(self._listen()) | ||
| self._connection_ready.set() | ||
| self._on_connected() | ||
| await super().start() |
There was a problem hiding this comment.
Guard start() state before opening the websocket.
Line 79 opens the socket and Line 89 emits connected before the duplicate-start guard in super().start() runs on Line 90. A repeat start() can fail after side effects, leaving inconsistent runtime state.
Suggested fix
async def start(self) -> None:
"""Open the Cartesia realtime STT websocket."""
+ if self.started:
+ raise ValueError("STT is already started, dont call this method twice")
+ if self.closed:
+ raise ValueError("STT is closed and cannot be started")
if self.connection is not None:
logger.warning("Cartesia STT connection already started")
return
url = self._build_websocket_url()
self.connection = await asyncio.wait_for(
websockets.connect(
url,
additional_headers={"X-API-Key": self.api_key},
),
timeout=10.0,
)
self._listen_task = asyncio.create_task(self._listen())
self._connection_ready.set()
self._on_connected()
await super().start()Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Remove plugins/cartesia/tests/conftest.py which conflicted with other plugin conftest modules during full-suite collection, and inline the integration API key guard in the cartesia test modules instead. Co-authored-by: Cursor <cursoragent@cursor.com>