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

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] Phonic Webhook tool names available to the assistant
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
forbid_speech_after_tool_call list[str] Tool names after which Phonic should NOT auto-generate a spoken reply. Use for tools that always hand off/trigger an agent switch

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. Only Phonic Webhook tools are supported with LiveKit Agents.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_plugins_phonic-1.6.6.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livekit_plugins_phonic-1.6.6-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file livekit_plugins_phonic-1.6.6.tar.gz.

File metadata

  • Download URL: livekit_plugins_phonic-1.6.6.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for livekit_plugins_phonic-1.6.6.tar.gz
Algorithm Hash digest
SHA256 645059a610b5f009d8c9af42b1d7210f415b8003a313263f49940f0938125b77
MD5 cf2006a4a5e131acb3314c06a463b46e
BLAKE2b-256 b9fa4679d8b69e324024c92ce83910dfbe3b0b4aa443a30ea15ca1a265332481

See more details on using hashes here.

Provenance

The following attestation bundles were made for livekit_plugins_phonic-1.6.6.tar.gz:

Publisher: publish.yml on livekit/agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file livekit_plugins_phonic-1.6.6-py3-none-any.whl.

File metadata

File hashes

Hashes for livekit_plugins_phonic-1.6.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3eddd9d661ee670cb8829d01c7e8e21659a0b474c2a1a6042b7e79b154a08d38
MD5 07415a1554de5deb51bde070e1a43968
BLAKE2b-256 8a6cd42d3458fa181a44b84513959b1ad0ff11478c83724ce078973ec47c1728

See more details on using hashes here.

Provenance

The following attestation bundles were made for livekit_plugins_phonic-1.6.6-py3-none-any.whl:

Publisher: publish.yml on livekit/agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page