Osama Malik
Home / Open source / Pipecat #5760
Merged

Pipecat pull request 5760 keeps a function call timeout armed when a tool reports an intermediate result. I wrote it, and it was merged on 15 Sep 2026. Only a final result clears the deadline.

Fixing function call timeouts in Pipecat

The pull request is pipecat-ai/pipecat #5760, titled fix(llm): keep function-call timeout armed across intermediate results. It closes issue #5481. A shorter blog note is also on the blog.

The problem

Pipecat is a framework for realtime voice agents. A tool the agent calls can be given a time limit: the per tool timeout_secs, or the global function_call_timeout_secs when the tool does not set its own. When the handler reports a result, the service runs function_call_result_callback.

Before this change, that callback cancelled the timeout task for every result, including a result marked FunctionCallResultProperties(is_final=False). An intermediate update is how a tool reports progress while it is still working. Cancelling the timeout there meant a progress report disarmed the deadline. A tool could say "working", then hang, and the timeout would not fire.

That is a bad failure mode in a voice agent. A hanging tool with no deadline leaves the caller waiting, and the framework no longer has the cutoff it thought it had. The changelog line that landed with the pull request says the same thing: an async tool that reported progress no longer cancels its own deadline, and only a final result clears it.

The fix

The cancel moved inside the is_final branch in src/pipecat/services/llm_service.py. A final result still marks the call settled and still cancels the timeout task if it is running. An intermediate result leaves the task armed. The deadline is not restarted either. It still covers the handler's whole execution, measured from when the call started.

I updated the docs on register_function and register_direct_function so they say this. A call that runs past the deadline is still cancelled: the handler is thrown asyncio.CancelledError, the call is settled as cancelled, and inference runs so the model can report that it did not complete.

The pull request says an earlier attempt, #5491, was closed without review, and that 5760 reopens that approach against current main. I am taking that from the pull request text. The diff also adds changelog/5760.fixed.md. GitHub records 3 files changed on the pull request.

How it was tested

The new coverage is in tests/test_llm_service.py, class TestFunctionCallTimeout. The pull request's test plan is uv run pytest tests/test_llm_service.py::TestFunctionCallTimeout. I am describing the tests that are in the merged diff. I have not rerun them for this page.

An intermediate update must not disarm the deadline

test_intermediate_result_does_not_disarm_the_deadline registers a tool that first calls the result callback with "working" and is_final=False, then sleeps long enough to pass timeout_secs. The assertions in the diff are:

  • The tool's later side effect does not run.
  • The handler observes CancelledError for that call.
  • The frames are FunctionCallsStartedFrame, FunctionCallInProgressFrame, a FunctionCallResultFrame whose properties are not final, then FunctionCallCancelFrame.
  • The cancel frame has run_llm set.

A hanging tool with no update still times out

test_a_hanging_async_tool_times_out_without_any_update is the control. The tool only sleeps, then would return a final result. It never gets there. The frames are the started frame, the in progress frame, and the cancel frame. There is no result frame, because nothing was reported.

What this shows if you are hiring an AI agent engineer

  • I work on the timeout path of a voice-agent framework, not only on prompts. A tool that reports progress and then hangs is a production failure, not an edge case you can ignore.
  • The fix is small and explicit: only a final result clears the deadline. The deadline is not reset by a progress update.
  • The tests cover both sides of the contract: a progress update must not disarm the timeout, and a tool that never reports still times out.
  • If you need a voice agent built, see hire a voice AI developer or all services.

I did not start Pipecat and I am not a maintainer. This is one merged fix. The other merged fixes are on the open source page, including Genkit #6346 and Strands #4313. My LiveKit Agents pull request, #7186, is a different timeout, on EndCallTool, and it is still open.

Working with a team abroad? See United States, United Kingdom, Australia, Europe or UAE and Saudi Arabia.

Questions about this fix

What did Pipecat pull request 5760 fix?

An intermediate function call result, marked is_final=False, used to cancel the tool timeout. After the fix, only a final result clears the deadline. A progress update does not clear it and does not restart it.

When was the pull request merged?

It was merged on 15 September 2026. It closes issue #5481. I wrote it. I am not a Pipecat maintainer.

How is this different from your LiveKit pull request?

LiveKit Agents #7186 is a different timeout, on EndCallTool. It is still open and has not been merged. This page is only about the merged Pipecat change.

Do you build voice agents professionally?

Yes. I build voice agents on Pipecat and LiveKit. See hire a voice AI developer, or email me for a quote. I do not publish rates.