Is TaskGroup the right primitive for Survey Agents with 20+ Questions

Hey folks, I’ve got an Agent design question. I’m working on a survey agent asks about 30 questions. Is a Task Group the right primitive for this given the length of the survey?

I initially implemented the workflow as a task group with each question as a task (added in a for loop as a generic AskQuestion task with different parameters).

However, midway through the survey, agent started erroring out and I noticed that multiple STT streams were being created (roughly 2 for each task) and it seemed they weren’t being cleaned up. This made me uncertain whether TaskGroup was designed for long surveys.

I’ve temporarily worked around this by avoiding TaskGroup and instead using a tool-driven loop, but Im hoping to get guidance on what the right primitive for building 20+ question survey agents is. Thanks

Will try to dig up / recreate the original error message I was seeing as well and share it

Yes, TaskGroup would be the right approach for this and it’s designed for this kind of use case, did you see the survey example: agents/examples/survey at main · livekit/agents · GitHub ?