lively-horse-90722
02/27/2026, 9:03 AMtall-airline-16756
02/27/2026, 9:04 AMtall-airline-16756
02/27/2026, 9:04 AMtasks and TaskGroup introduce function call latency.
Short answer:
• No — tasks and TaskGroup do not inherently add meaningful function-call latency. Any noticeable delay will usually come from the actual work the tasks perform (LLM inference, external API calls, STT/TTS, etc.), not from the task orchestration itself.
Why:
• AgentTask and function tools simply encapsulate units of work and call your function tools inside the agent’s session loop; the framework’s orchestration is lightweight and optimized for real‑time voice AI flows.
• TaskGroup coordinates multiple tasks and can revisit earlier steps while sharing conversation context. Its overhead is minimal and mostly coordination/summarization work (which you can disable with summarize_chat_ctx=False if you want to avoid that extra step).
Common sources of latency to watch for:
• LLM inference time (TTFT)
• External API or network calls your tools make
• STT or TTS processing and any associated audio I/O
• Heavy synchronous computation inside a task
If you’d like, I can help with next steps:
• Review a specific task/tool implementation to spot latency hotspots.
• Suggest async patterns or batching to reduce wall‑clock time.
• Walk through disabling summarize_chat_ctx or other options to minimize orchestration overhead.
Which would you prefer — a code review of a task that’s showing latency, or recommendations for general patterns to reduce latency?
Sources: Tasks and task groups | LiveKit Documentation | examples/frontdesk | livekit/livekit_composite | DeepWiki | examples/voice_agents | livekit/livekit_composite | DeepWikilively-horse-90722
02/27/2026, 9:05 AMtall-airline-16756
02/27/2026, 9:05 AMTaskGroup, set summarize_chat_ctx=False) if that’s part of the completion step.
If you’d like, I can:
• Review the specific completion function you’re using and point out likely bottlenecks.
• Suggest an async or queue-based pattern tailored to your code.
• Help measure where time is being spent (recommended traces or timing points to add).
Which would be most helpful — a quick review of your completion handler, or a general template for turning completion work into background jobs?