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 |
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 |
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 intoconfigs_for_toolsasforbid_speech_after_tool_call=True(an explicitconfigs_for_toolsentry wins) and logs a warning. Preferconfigs_for_tools.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file livekit_plugins_phonic-1.6.8.tar.gz.
File metadata
- Download URL: livekit_plugins_phonic-1.6.8.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43fb186c276572b3f18d5fb33a4ca2172589174b6172936513f5f03fe03a854f
|
|
| MD5 |
a81a24f5994a833a8057d49a45f09f05
|
|
| BLAKE2b-256 |
cdc5d66a3189f38b875786a31b4ac92c69044c0f2d15ae011adf54732c010927
|
Provenance
The following attestation bundles were made for livekit_plugins_phonic-1.6.8.tar.gz:
Publisher:
publish.yml on livekit/agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
livekit_plugins_phonic-1.6.8.tar.gz -
Subject digest:
43fb186c276572b3f18d5fb33a4ca2172589174b6172936513f5f03fe03a854f - Sigstore transparency entry: 2335839145
- Sigstore integration time:
-
Permalink:
livekit/agents@c4c303a34d06c64d06851cc2762265f98eb29ced -
Branch / Tag:
refs/heads/main - Owner: https://github.com/livekit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c4c303a34d06c64d06851cc2762265f98eb29ced -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file livekit_plugins_phonic-1.6.8-py3-none-any.whl.
File metadata
- Download URL: livekit_plugins_phonic-1.6.8-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1021d945cab875b0866823d4a7dc6a9708d7b48a042b5e10e1d5fa03317513d0
|
|
| MD5 |
7feea49bd76d0d5aebc8251da9888c1f
|
|
| BLAKE2b-256 |
62649a0684aba2016e1138ecc30d288c8ad647e3301b701a0732cc650a8ac5a2
|
Provenance
The following attestation bundles were made for livekit_plugins_phonic-1.6.8-py3-none-any.whl:
Publisher:
publish.yml on livekit/agents
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
livekit_plugins_phonic-1.6.8-py3-none-any.whl -
Subject digest:
1021d945cab875b0866823d4a7dc6a9708d7b48a042b5e10e1d5fa03317513d0 - Sigstore transparency entry: 2335839450
- Sigstore integration time:
-
Permalink:
livekit/agents@c4c303a34d06c64d06851cc2762265f98eb29ced -
Branch / Tag:
refs/heads/main - Owner: https://github.com/livekit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c4c303a34d06c64d06851cc2762265f98eb29ced -
Trigger Event:
pull_request
-
Statement type: