Core architecture rework for agent framework#169
Draft
DeepBhupatkar wants to merge 25 commits intomainfrom
Draft
Core architecture rework for agent framework#169DeepBhupatkar wants to merge 25 commits intomainfrom
DeepBhupatkar wants to merge 25 commits intomainfrom
Conversation
Room logic previously handled multiple responsibilities including connection lifecycle, SIP participant management, recording orchestration,and input stream handling. This change modularizes the room implementation by introducing dedicated managers: - InputStreamManager: handles incoming participant audio/video streams - SIPManager: manages SIP operations, call info fetching, and transfers - RecordingManager: orchestrates participant-level recording and merging Additionally, output-side custom audio track implementations have been moved from `audio_stream.py` to `output_stream.py` to clearly separate input and output stream responsibilities.
- Refactored `pipeline.py` - Single Pipeline class for all configurations Add Core Modules: - `speech_understanding.py` - VAD, STT, Turn Detection - `content_generation.py` - LLM processing, tool calling, KB integration - `speech_generation.py` - TTS synthesis and audio playback - `pipeline_orchestrator.py` - Component orchestration and event routing - `realtime_llm_adapter.py` - Realtime model adapter
- Removed `ConversationFlow` - functionality absorbed into PipelineOrchestrator - Removed `CascadingPipeline` and `RealTimePipeline` - replaced by unified Pipeline
Implement decorator-based hooks (@pipeline.on("event_name")) for intercepting
and modifying pipeline data at key stages:
- Audio streaming hooks (speech_in, speech_out) for real-time audio processing
- Vision hook (vision_frame) for video frame processing
- STT hook allows cleaning, normalization, redaction, or enrichment of the transcript.
- LLM control (llm hook with yield-based bypass, agent_response for output)
- Lifecycle hooks (user_turn_start/end, agent_turn_start/end)
- rename RealtimeLLMWrapper -> RealtimeLLMAdapter
- Allows using an external STT provider and Knowledge Base before passing text to a Realtime model for LLM+TTS. - Allows using a Realtime model for STT+LLM while intercepting text to use an external TTS provider.
Introduce common stream hooks: @pipeline.on("stt") for audio → transcript events and @pipeline.on("tts") for text → audio events.
enable unified pre- and post-processing in a single location.
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.
Overview
This PR focuses on reworking the agent framework core architecture and improving modularization.
1. refactor(room): modularize room responsibilities and stream handling
Room logic previously handled multiple responsibilities including connection lifecycle, SIP participant management, recording orchestration,and input stream handling.
This change modularizes the room implementation by introducing dedicated managers:
Additionally, output-side custom audio track implementations have been moved from
audio_stream.pytooutput_stream.pyto clearly separate input and output stream responsibilities.