Skip to content

feat(phonic): export LiveKit tools for the Responses API - #7112

Merged
tinalenguyen merged 3 commits into
livekit:mainfrom
Phonic-Co:phonic-elizabeth/responses-tool-definitions
Sep 4, 2026
Merged

feat(phonic): export LiveKit tools for the Responses API#7112
tinalenguyen merged 3 commits into
livekit:mainfrom
Phonic-Co:phonic-elizabeth/responses-tool-definitions

Conversation

@elizabeth-phonic

Copy link
Copy Markdown
Contributor

Motivation

LiveKit's generation APIs operate within an active agent or realtime session.
Phonic's Responses API supports a complementary use case: generating the next
assistant turn from supplied conversation history without starting a live
session.

From our understanding, LiveKit does not currently expose an equivalent
stateless generation endpoint. Applications using this capability should still
be able to reuse the tools already defined in their LiveKit ToolContext,
rather than maintaining a second set of tool schemas.

Change

Add to_phonic_tool_definitions(), a small adapter that converts a LiveKit
ToolContext into the schema-only definitions accepted by Phonic's Responses
API.

The helper:

  • uses the same strict serialization path as the existing Phonic realtime plugin
  • returns each tool's name, description, and parameter schema
  • keeps executable functions in LiveKit so the application remains responsible
    for executing returned tool calls

This adds support for stateless generation without introducing another
generation or tool-execution path inside LiveKit.

Usage

from livekit.plugins.phonic.realtime import to_phonic_tool_definitions

tool_definitions = to_phonic_tool_definitions(tool_context)

Validation

  • Added focused unit coverage for tool-schema conversion
  • Ruff formatting and lint pass
  • Phonic plugin type checking passes

@elizabeth-phonic
elizabeth-phonic requested a review from a team as a code owner September 4, 2026 01:53
@CLAassistant

CLAassistant commented Sep 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment on lines +126 to +129
return [
_to_phonic_tool_definition(tool_schema)
for tool_schema in tool_context.parse_function_tools("openai", strict=True)
]

@devin-ai-integration devin-ai-integration Bot Sep 4, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Unsupported tool schemas are exported

For reserved parameter names or schemas nested beyond five levels, to_phonic_tool_definitions exports definitions Phonic rejects. Those existing LiveKit tools cannot be reused through Responses.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's fine, we should let Phonic do the validation instead of doing validation in this helper

@tinalenguyen
tinalenguyen merged commit 9f20bdb into livekit:main Sep 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants