Skip to main content

LiveKit Plugins: Phonic

Realtime voice AI integration for Phonic with LiveKit Agents.

Installation

uv add livekit-plugins-phonic

Usage

import asyncio
import logging

from dotenv import load_dotenv

from livekit.agents import (
    Agent,
    AgentServer,
    AgentSession,
    JobContext,
    cli,
    function_tool,
)
from livekit.plugins.phonic.realtime import RealtimeModel

logger = logging.getLogger("phonic-agent")

load_dotenv()


class MyAgent(Agent):
    def __init__(self) -> None:
        super().__init__(
            instructions="You are a helpful voice AI assistant named Sabrina.",
            llm=RealtimeModel(
                voice="sabrina",
                audio_speed=1.2,
            ),
        )

    @function_tool(
        description="Toggle a light on or off. Available lights are A05, A06, A07, and A08."
    )
    async def toggle_light(self, light_id: str, state: str) -> str:
        """Called when the user asks to toggle a light on or off.

        Args:
            light_id: The ID of the light to toggle
            state: Whether to turn the light on or off, e.g., 'on', 'off'
        """
        logger.info(f"Turning {state} light {light_id}")
        await asyncio.sleep(1.0)
        return f"Light {light_id} turned {state}"


server = AgentServer()


@server.rtc_session()
async def entrypoint(ctx: JobContext):
    session = AgentSession()
    await session.start(agent=MyAgent(), room=ctx.room)
    await session.generate_reply(
        instructions="Greet the user, asking about their day.",
    )


if __name__ == "__main__":
    cli.run_app(server)
cd examples
uv run voice_agents/phonic_realtime_agent.py dev

Reusing tools with Phonic Responses

Convert an existing LiveKit ToolContext into the schema-only definitions accepted by Phonic's Responses API:

from livekit.plugins.phonic.realtime import to_phonic_tool_definitions

tool_definitions = to_phonic_tool_definitions(tool_context)

The executable functions remain in the ToolContext; only their names, descriptions, and parameter schemas are returned.

Configuration

Set the PHONIC_API_KEY environment variable, or pass api_key directly to RealtimeModel. All other options are optional.

Option Type Description
api_key str Phonic API key. Falls back to PHONIC_API_KEY environment variable
phonic_agent str Phonic agent name. Options set explicitly here override agent settings
voice str Voice ID — sabrina, grant, virginia, landon, eleanor, shelby, nolan
welcome_message str Message the agent says when the conversation starts. Ignored when generate_welcome_message is True
generate_welcome_message bool Auto-generate the welcome message (ignores welcome_message)
project str Project name (default: main)
default_language str ISO 639-1 default language for recognition and speech
additional_languages list[str] Further ISO 639-1 codes (must not repeat default_language)
multilingual_mode "auto" | "request" Per-utterance language detection vs. change on user request (recommended: request)
audio_speed float Audio playback speed
phonic_tools list[str] Names of Phonic-side tools available to the assistant: Webhook tools and built-in tools (choose_not_to_respond, keypad_input, natural_conversation_ending)
boosted_keywords list[str] Keywords to boost in speech recognition
min_words_to_interrupt int Minimum number of user words required to interrupt the assistant
generate_no_input_poke_text bool Auto-generate poke text when user is silent
no_input_poke_sec float Seconds of silence before sending poke message
no_input_poke_text str Poke message text (ignored when generate_no_input_poke_text is True)
no_input_end_conversation_sec float Seconds of silence before ending conversation
websocket_timeout_sec int Seconds of inactivity before the Phonic websocket is closed
intelligence_level "standard" | "high" LLM intelligence level
is_welcome_message_interruptible bool When False, the welcome message cannot be interrupted
vad_prebuffer_duration_ms int Voice-activity-detection prebuffer duration (ms)
vad_min_speech_duration_ms int Minimum speech duration for VAD (ms)
vad_min_silence_duration_ms int Minimum silence duration for VAD (ms)
vad_threshold float Voice-activity-detection threshold
enable_assistant_backchannel bool When True, the assistant backchannels (e.g. "mm-hmm") while the user speaks
assistant_backchannel_aggressiveness float How aggressively the assistant backchannels (needs enable_assistant_backchannel)
pronunciation_dictionary list[PronunciationEntry] { word, pronunciation } entries; words must be unique
template_variables dict[str, str] Variables substituted into the system prompt and welcome message
enable_redaction bool Redact PII/PHI from transcripts and bleep it from audio after the conversation
mcp_servers list[str] Names of pre-configured MCP servers to make available (must be unique)
observability_integrations list["braintrust"] Observability integrations to forward traces to
configuration_endpoint ConfigurationEndpoint | None Endpoint the agent calls to fetch per-conversation configuration
additional_params dict[str, Any] Additional runtime parameters forwarded to Phonic
configs_for_tools list[PhonicToolConfig] Per-tool behavior overrides (see Per-tool configuration)

Per-tool configuration

configs_for_tools takes one entry per tool you want to customize. Each entry is keyed by the tool name; every other field is optional and falls back to the plugin default when omitted. Tools with no entry keep the defaults.

RealtimeModel(
    configs_for_tools=[
        {"name": "transfer_call", "forbid_speech_after_tool_call": True},
        {"name": "submit_form", "forbid_tool_call_after_speech": True},
    ],
)
Field Type Default Description
name str — Tool this config applies to (required)
require_speech_before_tool_call bool False Require the agent to speak before the tool can be called
forbid_speech_after_tool_call bool False Suppress the auto-generated spoken reply after the tool. Use for tools that always hand off to another agent (a non-handoff tool set here would leave the agent silent)
forbid_tool_call_after_speech bool False Drop the tool call if the agent already spoke this turn
respond_after_sec float — choose_not_to_respond only. Seconds to wait after the tool fires; if the user stays silent, the agent speaks a follow-up. Omit to keep the default (stay silent).
speech_before_tool_call str — keypad_input / natural_conversation_ending only. required | optional | suppressed.

The plugin always sends tool calls with wait_for_speech_before_tool_call on and allow_tool_chaining off; these are not configurable per tool.

Deprecated: the top-level forbid_speech_after_tool_call: list[str] option still works but is deprecated — it now folds each listed tool into configs_for_tools as forbid_speech_after_tool_call=True (an explicit configs_for_tools entry wins) and logs a warning. Prefer configs_for_tools.

Built-in tools

Phonic's built-in tools — choose_not_to_respond, keypad_input, natural_conversation_ending — are enabled by listing their names in phonic_tools, alongside any Webhook tools. To configure one, add a configs_for_tools entry keyed by the same name (respond_after_sec for choose_not_to_respond; speech_before_tool_call for the other two). A built-in listed without a config uses its Phonic-side defaults.

RealtimeModel(
    phonic_tools=["choose_not_to_respond", "keypad_input"],
    configs_for_tools=[
        {"name": "choose_not_to_respond", "respond_after_sec": 5},
    ],
)

If you already have an agent set up on the Phonic platform, you can use the phonic_agent option to specify the agent name. As a note, configuration options you set in the LiveKit Agents SDK will override the agent settings set on the Phonic platform. This means the system prompt you have set on the Phonic platform will be ignored in favor of the instructions field set on the LiveKit Agent. Likewise, options explicitly set in the RealtimeModel constructor will override the Phonic agent's settings.

If you have Webhook tools set up on the Phonic platform, you can use phonic_tools to make them available to your agent, together with Phonic's built-in tools. Custom function tools you define on the LiveKit Agent are also supported and run over the websocket.

Release files for livekit-plugins-phonic 1.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for livekit-plugins-phonic 1.8.0
File Size Uploaded
livekit_plugins_phonic-1.8.0.tar.gz 20.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for livekit-plugins-phonic 1.8.0
File Interpreter ABI Platform
livekit_plugins_phonic-1.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.4 kB

Release files / livekit_plugins_phonic-1.8.0.tar.gz

Download URL livekit_plugins_phonic-1.8.0.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ea619fa49a2519023dffef0fba8b8ef3dc1e3a4007fe8bcbe19a603cb01a9281
BLAKE2b-256 checksum
How to use checksums
29cd39ec5163604bf4ba1babc888735f184ee58b363b8e20b2731213044f7b66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release files / livekit_plugins_phonic-1.8.0-py3-none-any.whl

Download URL livekit_plugins_phonic-1.8.0-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72ca6ac5ab329bb2d9cadead96ef4529eae874cae0de5820e0b1b8c1822235cc
BLAKE2b-256 checksum
How to use checksums
9d158d32bc96b3487f2ed8184e660e70562a1fff63942cfe91c0f151b0a64401
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release history Release notifications | RSS feed

1.8.3

2 release files

1.8.2

2 release files

1.8.1

2 release files

This release

1.8.0 This release

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.10

2 release files

1.6.9

2 release files

1.6.8

2 release files

1.6.7

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.15

2 release files

1.5.14

2 release files

1.5.13

2 release files

1.5.12

2 release files

1.5.11

2 release files

1.5.10

2 release files

1.5.9

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.6

2 release files

1.4.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page