Skip to content

fix: return error to LLM for unknown function calls in voice path#4938

Open
kollaikal-rupesh wants to merge 1 commit intolivekit:mainfrom
kollaikal-rupesh:fix/return-error-for-unknown-function-calls
Open

fix: return error to LLM for unknown function calls in voice path#4938
kollaikal-rupesh wants to merge 1 commit intolivekit:mainfrom
kollaikal-rupesh:fix/return-error-for-unknown-function-calls

Conversation

@kollaikal-rupesh
Copy link

Fixes #4933

The voice path in generation.py silently drops unknown function calls with continue, leaving tool_output.output empty. This causes the agent to stop responding since agent_activity.py only retriggers the LLM when tool outputs are present.

Now returns a FunctionCallResult with is_error=True via make_tool_output, matching the existing pattern in llm/utils.py and the validation error handler in the same function.

When the LLM calls a function not registered in the tool context, the
voice path silently skips it with `continue`, leaving tool_output.output
empty. This causes the agent to stop responding entirely since the
downstream code in agent_activity.py only retriggers the LLM when
tool outputs are present.

Return a FunctionCallResult with is_error=True (via make_tool_output)
so the LLM receives the error and can recover gracefully. This matches
the existing behavior in llm/utils.py and the validation error handler
already present in the same function.

Fixes livekit#4933
@CLAassistant
Copy link

CLAassistant commented Feb 25, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

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

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

Voice path silently drops unknown function calls instead of returning error to LLM

2 participants