{"slug": "fixing-function-call-timeouts-in-pipecat", "title": "Fixing function call timeouts in Pipecat", "summary": "A developer merged Pipecat pull request #5760 on 15 Sep 2026, fixing a bug where intermediate function-call results disarmed the per-tool or global timeout. The change moves the timeout cancellation inside the is_final branch in src/pipecat/services/llm_service.py, so only a final result clears the deadline while progress updates leave it armed. New tests in TestFunctionCallTimeout cover a tool that reports progress then hangs and a hanging tool that never reports.", "body_md": "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.\n\nThe 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.\n\nPipecat 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`.\n\nBefore 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.\n\nThe 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.\n\nThe 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.\n\nI 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.\n\nThe 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.\n\nThe 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.\n\n`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:\n\n`CancelledError` for that call.`FunctionCallsStartedFrame`, `FunctionCallInProgressFrame`, a `FunctionCallResultFrame` whose properties are not final, then `FunctionCallCancelFrame`.` run_llm` set.\n`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.\n\nThe diff also adds `changelog/5760.fixed.md`. GitHub records 3 files changed on the pull request.\n\n`EndCallTool`, and it is still open. See the The same page has the merged Genkit and Strands pull requests, which are not about this timeout.\n\n[Pull request 5760](https://github.com/pipecat-ai/pipecat/pull/5760)\n\n[All four pull requests](https://osamamalik.me/open-source.html)\n\n[Agent Receptionist](https://osamamalik.me/portfolio-agent/case-study.html)\n\nOriginally published at [https://osamamalik.me/blog/pipecat-5760-function-call-timeout.html](https://osamamalik.me/blog/pipecat-5760-function-call-timeout.html)", "url": "https://wpnews.pro/news/fixing-function-call-timeouts-in-pipecat", "canonical_source": "https://dev.to/osamamalik/fixing-function-call-timeouts-in-pipecat-n27", "published_at": "2026-11-18 06:09:15+00:00", "updated_at": "2026-11-18 06:13:13.131066+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": ["Pipecat", "pipecat-ai", "GitHub", "Osama Malik"], "also_reported_by": [], "takeaway": "In Pipecat, cancel a function call's timeout only when FunctionCallResultProperties(is_final=True) arrives, since cancelling on intermediate progress updates lets a tool report 'working' and then hang past timeout_secs without being cancelled.", "recommendation": {"advice": "Arm tool-call deadlines from call start and clear them only on final results, so progress updates can't silently disable timeouts on hanging async tools.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/fixing-function-call-timeouts-in-pipecat", "markdown": "https://wpnews.pro/news/fixing-function-call-timeouts-in-pipecat.md", "text": "https://wpnews.pro/news/fixing-function-call-timeouts-in-pipecat.txt", "jsonld": "https://wpnews.pro/news/fixing-function-call-timeouts-in-pipecat.jsonld"}}