Repository navigation
feat(voice): add eval-scoped WebSocket helpers - #1179
Draft
Alex Z (CLowbrow) wants to merge 6 commits into
Draft
Alex Z (CLowbrow) wants to merge 6 commits into
Alex Z (CLowbrow) wants to merge 6 commits into
Conversation
This branch has not been 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.
Adds a framework-free WebSocket core for voice calls inside ordinary
Eval/EvalAsynctasks. The application supplies an awaited agent connector and an existingsimulated_user_id; dataset input and the eval tracing parent are carried automatically.voice_task(...)starts a fresh call per row. Custom tasks useawait run_voice_call(agent=..., simulated_user_id=..., input=input). Both require an active eval task. The project is inferred from its experiment or supplied asproject_id. Saved-user instructions use the existing backend template renderer; only row input goes into its existingscenariowire field. Expected output and scorers stay in the eval.The connector can call a local receiver or forward the serializable call context to an authenticated service:
The receiver's application audio bridge attaches
session.set_audio_sink(..., clear=..., ended=...), sends agent PCM withsession.send_audio(...), and drops interrupted agent output withsession.clear_output(). The core owns the ready handshake, audio conversion/pacing, consumed-playback acknowledgements, interruption epochs, stop/finalization, and recording collection. It activates the supplied parent before agent construction, isolates concurrent call contexts, and flushes completed agent spans.Results contain the application's
agent_output, caller-only transcript, recording references/timeline, reason, and session/span IDs. Callback results are validated once at the eval boundary. Agent, simulator, recording, cancellation, and disconnect failures propagate; credentials are excluded from SDK logs and malformed-result errors.The API retains the backend's fixed ten-minute call limit. It has no simulated-user CRUD/name lookup, standalone logger setup, or framework dependencies. Pipecat is a separate dependent draft PR; LiveKit is deferred.
Backend dependency
Requires the existing session endpoint's parent and recording additions and data plane feature version 149. The SDK checks the version before reserving a session. Deploy that backend capability first.
Validation
Usage and the audio callback contract are documented in
py/src/braintrust/voice/README.md.