Skip to content

Add agent stt sdk - #127

Open
giorgosHadji wants to merge 19 commits into
mainfrom
agent-stt-sdk
Open

Add agent stt sdk#127
giorgosHadji wants to merge 19 commits into
mainfrom
agent-stt-sdk

Conversation

@giorgosHadji

@giorgosHadji giorgosHadji commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Add agent stt sdk which will communicate with our AgentSTT offering - add docs here.

This MR doesn't remove/deprecate the voice sdk - that will happen in follow up MRs.

How to test this:
Get an api key, and point to rt preview (SPEECHMATICS_RT_URL=wss://preview.rt.speechmatics.com/v2)

Install locally the agent stt sdk - > python -m pip install -e sdk/agent_stt[dev]

Then run for a file based test : python examples/agent_stt/realtime_file/main.py
or you can use an interactive script (using microphone):
python .\examples\agent_stt\microphone\main.py

Georgios Hadjiharalambous and others added 7 commits August 12, 2026 22:52
speechmatics-agent-stt is an extension of the RT SDK for the Voice Agent
Service. The service works in segments rather than word groups and reports
speech and turn events, so the client consumes AddSegment/AddPartialSegment
and accumulates the session transcript from them.

The SDK runs no VAD or turn detection of its own. Either the service's VAD
closes turns (VADMode.SERVER), or the host framework's does (VADMode.CLIENT)
by calling finalize(), which sends ForceEndOfUtterance stamped with the audio
position at the moment of the call. This is what Pipecat and LiveKit need, and
replaces the voice SDK's in-process VAD and smart-turn models.

- endpoint is the RT URL plus /agent, optionally plus a service profile
- TranscriptionConfig adds vad_mode, vad_config and emit_sentences, and leaves
  model unset so it cannot conflict with the profile's locked operating_point
- every server message is kept in client.events, including unmodelled ones
- 16 kHz raw PCM defaults, as the service requires

Verified against the real service with a stub transcriber behind it. Nothing
in the voice SDK or Pipecat is touched; see sdk/agent_stt/PLAN.md for the
Pipecat migration plan.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Engine silence-based end of utterance is off for the Agent STT service, so
TurnDetectionMode.FIXED has nothing to map onto and is removed rather than
aliased. Records the settings that go with it, and notes in the SDK README
that a turn ends only via the service VAD or finalize().

SMART_TURN stays open: it ran an in-process model, which this SDK does not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The service has no smart-turn endpoint yet and this SDK loads no models, so
the mode cannot be honoured. It costs nothing: any host-side endpointing,
including Pipecat's own turn analyzer, reaches the service through finalize().

Makes VADMode.CLIENT explicit that it is agnostic about what produced the
end-of-speech signal - VAD, turn model, or push-to-talk.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A typed entry for transcription_config.additional_vocab, so callers can pass
words with pronunciation hints instead of raw dicts. Both forms are accepted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The SDK previously left `model` unset, on the reasoning that the service's
default profile pins and locks `operating_point: enhanced`, so sending a model
name alongside it would put both keys in the merged StartRecognition. That
reasoning held for a direct connection to the service websocket, but it is not
how requests actually reach it: they go through a proxy first, which resolves
the Agent STT model name onto the engine's operating point. The transcriber
therefore never sees a name it has no notion of, and sending `linden-1` is
safe.

Replace the re-exported RT `Model` with an Agent STT one. The RT models
(`enhanced`, `standard`) are not Agent STT models, so leaving them reachable
from this package only invited configs the service would reject.

Default resolution uses the same `_UNSET` sentinel pattern as
`rt.TranscriptionConfig` rather than a plain default, because the deprecated
`operating_point` has to suppress the model rather than collide with it:
passing `operating_point` leaves `model` unsent, and passing both still raises.

`DEFAULT_MODEL` is a separate constant and the docstrings name it rather than
the value, so linden-2 is one enum member plus, if it becomes the default, one
line.

The end-to-end verification recorded in PLAN.md predates this and ran against
the service with a stub transcriber and no proxy, so it exercised neither the
model default nor its resolution. Noted there as still needing a run against
the real proxy.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread examples/agent_stt/microphone/main.py
Comment thread sdk/agent_stt/speechmatics/agent_stt/py.typed
Comment thread sdk/agent_stt/PLAN.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

remove

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will let it so people can view it and will remove once reviewing is done

Comment thread sdk/agent_stt/README.md
@@ -0,0 +1,148 @@
# Speechmatics Agent STT SDK

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Needs public docs ref here too

Comment thread sdk/agent_stt/README.md Outdated
Comment thread sdk/agent_stt/README.md

## Audio

The service requires **16 kHz raw PCM**, `pcm_s16le` or `pcm_f32le`, which is what the client

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

and mulaw I believe

@giorgosHadji
giorgosHadji marked this pull request as draft August 18, 2026 11:20
Comment thread sdk/agent_stt/speechmatics/agent_stt/__init__.py
Comment thread sdk/agent_stt/speechmatics/agent_stt/__init__.py
Comment thread sdk/agent_stt/speechmatics/agent_stt/_models.py
@giorgosHadji
giorgosHadji marked this pull request as ready for review August 18, 2026 13:01
@giorgosHadji giorgosHadji changed the title Agent stt sdk Add agent stt sdk Aug 18, 2026
Comment thread examples/agent_stt/file/main.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant