@pipeline.on() decorator.
Audio Processing Hooks
Thestt and tts hooks replace the built-in component processing. Each receives an async iterator and yields processed results. Only one of each can be registered.
The
stt and tts hooks fully replace the built-in component processing: you receive the raw stream and yield the processed result yourself.STT hook: clean up transcripts
A common use case is preprocessing the audio and normalizing the transcript before it reaches the LLM. This hook drops tiny audio chunks, then strips filler words from the transcribed text.TTS hook: fix pronunciation
A common use case is reshaping text so the voice reads it correctly. This hook spells out abbreviations so the TTS pronounces them as expected.Lifecycle Hooks
Lifecycle hooks are side-effect-only. Use them for logging, analytics, and triggering external actions. You can register multiple per event.user_turn_start(transcript: str): user’s final transcript is available.user_turn_end(): agent finished responding for the turn.agent_turn_start(): agent starts speaking.agent_turn_end(): agent finishes speaking.
- user_turn_start
- user_turn_end
- agent_turn_start
- agent_turn_end
Fetch context for the turn. The final transcript is available here, so it is a good place to run a knowledge-base lookup before the LLM responds.
What’s Next
Pipeline Overview
Review how the pipeline is configured before hooking into it.
Run Your Agent
Run the pipeline with an agent.