Skip to content

test(examples/survey): add TaskGroup testing reference (DOCS-1225)#5557

Merged
kath0la merged 3 commits into
mainfrom
kat/add-taskgroup-test-example
May 12, 2026
Merged

test(examples/survey): add TaskGroup testing reference (DOCS-1225)#5557
kath0la merged 3 commits into
mainfrom
kat/add-taskgroup-test-example

Conversation

@kath0la
Copy link
Copy Markdown
Contributor

@kath0la kath0la commented Apr 26, 2026

Add examples/survey/test_survey_agent.py demonstrating the TaskGroup testing best practices documented at
https://docs.livekit.io/agents/logic/tasks/#testing-task-groups:

  • userdata initialized on the AgentSession
  • transition delay after sess.start() and between sub-tasks
  • multi-turn driving until expected tools fire (sess.history walk)
  • json.loads on item.arguments for arg-level assertions
  • no assertions on startup output
  • isolation tests per AgentTask plus a full-flow TaskGroup test

Related to livekit/agents-js#1148 and livekit/web#3585.

Add examples/survey/test_survey_agent.py demonstrating the TaskGroup
testing best practices documented at
https://docs.livekit.io/agents/logic/tasks/#testing-task-groups:

- userdata initialized on the AgentSession
- transition delay after sess.start() and between sub-tasks
- multi-turn driving until expected tools fire (sess.history walk)
- json.loads on item.arguments for arg-level assertions
- no assertions on startup output
- isolation tests per AgentTask plus a full-flow TaskGroup test

Related to livekit/agents-js#1148 and livekit/web#3585.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kath0la kath0la requested review from a team and tinalenguyen April 26, 2026 23:31
devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Member

@tinalenguyen tinalenguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you kat! i left a small comment

``_SurveyAgentForTesting`` sets ``summarize_chat_ctx=False`` so the final
``TaskGroup`` summarization LLM call doesn't run during tests.

Run with::
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make a note to add aiocsv as well?

uv add --dev aiocsv

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that! Added. Also add aiofiles.

@kath0la kath0la merged commit 8bc32ad into main May 12, 2026
24 checks passed
@kath0la kath0la deleted the kat/add-taskgroup-test-example branch May 12, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants