I'm writing E2E tests for a multi-task voice agent using AgentSession. My top-level agent sequentially awaits child tasks, each of which calls session.say() in its on_enter().
The test flow looks like:
initial_result = await session.start(agent, capture_run=True) # captures on_enter speech
turn1 = await session.run(user_input="...") # captures User Input
# After a task transition happens:
# parent agent starts a new child task → on_enter() calls session.say("...")
turn2 = await session.run(user_input="...") # only captures user input, NOT the new task's agent on_enter speech
The problem: When a task transition happens after session.run() completes, the new task's on_enter() speech (via session.say()) is not captured in any RunResult. The RunResult from session.run() is already done before the transition, and the next session.run() only captures user input.
With session.start(agent, capture_run=True), the initial on_enter speech is captured. Is there an equivalent mechanism for task-to-task transitions that happen after session.run() completes?