# Fixing function call timeouts in Pipecat

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

The pull request is [pipecat-ai/pipecat #5760](https://github.com/pipecat-ai/pipecat/pull/5760). Its title is `fix(llm): keep function-call timeout armed across intermediate results`. It closes issue [#5481](https://github.com/pipecat-ai/pipecat/issues/5481). I did not start Pipecat. This is one fix in the framework.

## What was broken

Pipecat can limit how long a function call is allowed to run. That limit is 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.

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.

## What I changed

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](https://github.com/pipecat-ai/pipecat/pull/5491), was closed without review, and that 5760 reopens that approach against current main. I am taking that from the pull request text.

## What the tests check

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 post.

### 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.

The diff also adds `changelog/5760.fixed.md`. GitHub records 3 files changed on the pull request.

## What I am not claiming

- I am not a Pipecat maintainer. The pull request was merged on 15 Sep 2026. The merge is on the pull request page.
- I am not describing review comments I did not quote here. The behavior above is the merged diff and the pull request body.
- This does not change LiveKit. My LiveKit Agents pull request, [#7186](https://github.com/livekit/agents/pull/7186), is a different timeout, on `EndCallTool`, and it is still open. See the [open source page](https://osamamalik.me/open-source.html).

The same page has the merged Genkit and Strands pull requests, which are not about this timeout.

[Pull request 5760](https://github.com/pipecat-ai/pipecat/pull/5760)
[All four pull requests](https://osamamalik.me/open-source.html)
[Agent Receptionist](https://osamamalik.me/portfolio-agent/case-study.html)

Originally published at https://osamamalik.me/blog/pipecat-5760-function-call-timeout.html

