little-king-41579
04/13/2026, 3:22 PMtall-airline-16756
04/13/2026, 3:22 PMtall-airline-16756
04/13/2026, 3:23 PMAgentTask dynamic_task is cancelled error you shared. To diagnose whether this is expected behavior or a bug I need a few details from you:
• LiveKit package version (output of pip show livekit or from pyproject/requirements) and Python version.
• The minimal reproducible code (or the relevant excerpt) showing how you create/run the AgentTask named dynamic_task and where you await or cancel it. Include any use of asyncio.shield, task.cancel(), timeouts, or wrappers.
• Your Agent/Voice agent configuration and the on_enter implementation (the function that contains await self.active_task).
• A short window of full logs (a few minutes before and after the traceback), ideally with debug-level logging for livekit.agents.
• Whether any component in your system explicitly cancels the task (via cancel()), or if you expect the task to run to completion.
• Any custom Tool or ToolContext implementations used by the agent (code or descriptions).
• Steps to reproduce the error reliably and the environment it runs in (long-running server, tests, multi-threaded, orchestration that may restart/cleanup tasks).
Send those details and I’ll pinpoint whether this is a usage issue (and show how to avoid cancellation) or something that needs deeper investigation.
, with interactive elementslittle-king-41579
04/13/2026, 4:22 PMtall-airline-16756
04/13/2026, 4:22 PMdynamic_task is created, awaited, or cancelled. Could you provide the following?
• LiveKit package version (pip show livekit) and Python version.
• The code around where you create/run the AgentTask named dynamic_task and the on_enter method (the function with await self.active_task). Paste the minimal reproducible snippet.
• Any explicit cancel() calls, timeouts, or use of `asyncio.shield`/`asyncio.wait_for` around that task.
• Any custom Tool or ToolContext implementations used by the agent.
• Whether this runs in a test, long‑running server, or orchestration that might stop tasks.
With those I can show targeted fixes (e.g., avoid premature cancellation, await the task correctly, use asyncio.shield properly, or adjust timeouts) and provide a code example.
, with interactive elements