Files
adk-python/contributing/samples/live_agent_api_server_example
Hangfei Lin 3c433b7168 chore: bidi streaming example on run live fast api
This sample connects to adk agent api server with websocket, to exchange streaming audio/text.

PiperOrigin-RevId: 805531120
2025-09-10 15:08:26 -07:00
..

What's this?

This is a sample that shows how to start the ADK api server, and how to connect your agents in a live(bidi-stremaing) way. It works text and audio input, and the response is always audio.

Prerequisite

Instruction for this sample

  • The audio libraries we used here doesn't have noise cancellation. So the noise may feed back to the model. You can use headset to avoid this or tune down voice volume, or implement your own noise cancellation logic.
  • Please ensure you grant the right mic/sound device permission to the terminal that runs the script. Sometimes, terminal inside VSCode etc dones't really work well. So try native terminals if you have permission issue.
  • start api server first for your agent folder. For example, my anents are locoated in contributing/samples. So I will run adk api_server contributing/samples/. Keep this running.
  • then in a separate window, run python3 live_agent_example.py

Misc

  • Provide a few pre-recorded audio files for testing.