Skip to content

Add support for Cartesia STT #602

Merged
Nash0x7E2 merged 8 commits into
mainfrom
chore/cartesia-update
Jun 18, 2026
Merged

Add support for Cartesia STT #602
Nash0x7E2 merged 8 commits into
mainfrom
chore/cartesia-update

Conversation

@Nash0x7E2

Copy link
Copy Markdown
Member
  • Adds support for Cartesia's Ink STT models
  • Update TTS to latest sonic release

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 64c26d3a-4d04-4fca-89c2-9f0750563204

📥 Commits

Reviewing files that changed from the base of the PR and between 55376a9 and 92cf5cb.

📒 Files selected for processing (2)
  • plugins/cartesia/tests/test_stt.py
  • plugins/cartesia/tests/test_tts.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/cartesia/tests/test_stt.py

📝 Walkthrough

Walkthrough

The PR adds a Cartesia websocket-based STT plugin (plugins/cartesia/vision_agents/plugins/cartesia/stt.py) that handles audio streaming, turn lifecycle events, and transcript emission. The base STT class in agents-core now imports and registers STT event types from the events module during init. The Cartesia package exports STT alongside TTS, the TTS default model is updated to sonic-3.5, and the package metadata and dependencies are expanded. Tests cover STT start guards, listener failure propagation, turn/transcript sequencing, and TTS defaults. Examples and documentation are revised to reflect Cartesia as the STT provider, removing Deepgram dependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (1)
plugins/cartesia/example/main.py (1)

59-59: ⚡ Quick win

Justify 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

📥 Commits

Reviewing files that changed from the base of the PR and between aeeacb1 and 0405cb4.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • agents-core/vision_agents/core/stt/stt.py
  • plugins/cartesia/README.md
  • plugins/cartesia/example/README.md
  • plugins/cartesia/example/main.py
  • plugins/cartesia/example/narrator-example.py
  • plugins/cartesia/example/pyproject.toml
  • plugins/cartesia/pyproject.toml
  • plugins/cartesia/tests/test_stt.py
  • plugins/cartesia/tests/test_tts.py
  • plugins/cartesia/vision_agents/plugins/cartesia/__init__.py
  • plugins/cartesia/vision_agents/plugins/cartesia/stt.py
  • plugins/cartesia/vision_agents/plugins/cartesia/tts.py
  • tests/test_stt_events.py

Comment thread plugins/cartesia/README.md Outdated
Comment thread plugins/cartesia/tests/test_stt.py Outdated
Comment thread plugins/cartesia/tests/test_tts.py Outdated
Comment thread plugins/cartesia/vision_agents/plugins/cartesia/stt.py Outdated
Comment on lines +72 to +90
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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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()

Comment thread plugins/cartesia/vision_agents/plugins/cartesia/stt.py Outdated
@Nash0x7E2 Nash0x7E2 marked this pull request as ready for review June 18, 2026 20:19
Nash0x7E2 and others added 5 commits June 18, 2026 14:26
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>
@Nash0x7E2 Nash0x7E2 changed the title Draft - Add support for Cartesia STT Add support for Cartesia STT Jun 18, 2026
@Nash0x7E2 Nash0x7E2 merged commit d6de413 into main Jun 18, 2026
15 of 16 checks passed
@Nash0x7E2 Nash0x7E2 deleted the chore/cartesia-update branch June 18, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant