Skip to content

AI Voice & Vision Agents

octoroom_agents turns AI pipelines into first-class Octoroom.Worker participants. An agent hears the tracks your room policy routes to it, optionally sees camera/screen frames, calls tools directly inside your Phoenix app, and speaks back on its own track.

defmodule MyApp.Assistant do
use Octoroom.Agent
alias Octoroom.Agent.Pipeline.Spec
@impl true
def instructions(ctx),
do: "You are a voice assistant on a call for #{ctx.args.workspace}. Be brief."
@impl true
def tools(_ctx), do: [MyApp.Tools.set_theme()]
@impl true
def pipeline(_ctx) do
Spec.default(
stt: "soniox:stt-rt-v6",
llm: "google:gemini-3.5-flash",
tts: "tiny_voca:tiny-voca"
)
end
end

Add the agent to your room in workers/1 using Octoroom.Agent.agent/3:

import Octoroom.Agent, only: [agent: 3]
def workers(room) do
[
agent("assistant", MyApp.Assistant,
name: "Assistant",
hears: Enum.map(room.participants, &mic/1),
sees: Enum.flat_map(room.participants, &[camera(&1), screen(&1)]),
respond: :addressed,
args: %{workspace: room.assigns.workspace}
)
]
end

Because tools execute in the agent’s Elixir process, tool handlers receive speaker (the participant who asked) and can directly broadcast to LiveViews over PubSub, query Ecto, or enforce your app’s authorization rules.

Every speaker the agent hears gets their own front end (Silero VAD → STT → turn detection), feeding into a shared back end (context → LLM → tools → chunker → TTS → collector).

Spec.default(
stt: "soniox:stt-rt-v6",
llm: [provider: :google, model: "gemini-3.5-flash", reasoning_effort: :minimal],
tts: "inworld:inworld-tts-2"
)

Customize individual stages with Spec.replace/3 or build a fully custom deterministic pipeline (see examples/agent’s Hello.Booking).

Cascaded agents support multi-party turn routing:

  • respond: :addressed — answers when addressed by name.
  • gate: :decision with decisions: [model: "google:gemini-decision-1"] — runs a lightweight decision model on each turn; implement questions/1 and decide/2 on your agent module for custom routing rules.
  • agents/2 — mounts several agents in the same room, distinguishing them by name and description:.

From outside the room, control any agent programmatically with Octoroom.Agent.say/3, prompt/3, and interrupt/2.

Spec.default/1 never picks hidden defaults—you always name the provider and model explicitly.

Stage Built-in Providers Env Var / Notes
STT soniox, assembly_ai, reson8 SONIOX_API_KEY, ASSEMBLY_AI_API_KEY, RESON8_API_KEY
TTS inworld, assembly_ai, openai, tiny_voca INWORLD_API_KEY, ASSEMBLY_AI_API_KEY, OPENAI_API_KEY; tiny_voca runs locally on ONNX Runtime ("tiny-voca", voices "F2" / "M2", no API key)
VAD & Turn Silero VAD, SmartTurn (ONNX) Precompiled onnxruntime NIFs; pre-fetch optional weights with mix octoroom.models.download

Register custom STT or TTS modules implementing Octoroom.Agent.STT or Octoroom.Agent.TTS:

config :octoroom_agents,
stt_providers: [acme: MyApp.AcmeSTT],
tts_providers: [acme: MyApp.AcmeTTS]