This repository was archived by the owner on Mar 20, 2026. It is now read-only.
Add Speech-to-Speech mode via AssemblyAI S2S API#131
Open
alexkroman wants to merge 1 commit into
Open
Conversation
Agents can opt into S2S mode via `mode: "s2s"` in defineAgent(), which
replaces the STT+LLM+TTS pipeline with a single AssemblyAI S2S WebSocket.
The default remains `"pipeline"` (existing behavior).
New files:
- server/s2s.ts — S2S WebSocket client with EventTarget pattern, session
resume, and full message logging
- server/session_s2s.ts — S2S session implementation with same Session
interface as the pipeline session
Changes:
- sdk/types.ts — Add PipelineMode type ("s2s" | "pipeline") and mode
field to AgentOptions/AgentDef
- core/types.ts — Add mode to AgentConfig
- server/_schemas.ts — Add mode to AgentConfigSchema
- sdk/define_agent.ts — Default mode to "pipeline"
- cli/_static_config.ts — Extract mode from agent.ts at build time
- server/types.ts — Add S2SConfig type and defaults
- server/config.ts — Add s2sConfig to PlatformConfig
- server/transport_websocket.ts — Route to S2S or pipeline session based
on agentConfig.mode
- server/transport_twilio.ts — Same routing for Twilio transport
- server/builtin_tools.ts — Add executeBuiltinTool() for direct tool
execution in S2S mode; read BRAVE_API_KEY from platform env
- server/deno.json — Add ws dependency for S2S WebSocket auth headers
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
mode: "s2s"option todefineAgent()that replaces the STT+LLM+TTS pipeline with a single AssemblyAI Speech-to-Speech WebSocket"pipeline"(existing STT+LLM+TTS behavior)server/s2s.tsWebSocket client with EventTarget pattern, session resume, and message loggingserver/session_s2s.tsimplementing the sameSessioninterface as the pipeline sessionagentConfig.modeexecuteBuiltinTool()added for direct tool execution in S2S mode (bypasses Vercel AI SDK wrappers)BRAVE_API_KEYnow reads from platform env (Fly secrets) instead of agent envUsage
Test plan
deno task check)modeis omitted🤖 Generated with Claude Code