Member-only story
Writing LiveKit AgentTask | Patterns from Shipping Voice Workflows
Here are the patterns I keep coming back to, pulled from real production voice workflows.
Mahimai Raja J7 min read·Just now--
If you’ve been building LiveKit voice agents and wondering how to structure multi-step flows“capture an email, then a phone number, then confirm” the answer is AgentTask.
When you’re building a voice agent that does anything more interesting than “answer questions,” you quickly hit the same problem: you need sub-goals. Capture an email. Verify an address. Walk through a 5-step onboarding. The naive approach is to stuff everything into one giant system prompt and hope the LLM behaves. It won’t.
The right primitive is AgentTask a structured sub-agent with its own instructions, tools, and typed result. Tasks are composable. You can chain them, run them as branches, or wrap them in a TaskGroup for parallel execution. I want to walk through the patterns that have made the biggest difference in the tasks I’ve shipped, using email capture as a running example because it’s small enough to hold in your head but rich enough to exercise most of the primitives.
Let’s take it apart.