Skip to content

add ctx.say_filler() for acoustic fillers during long tools#5885

Open
longcw wants to merge 4 commits into
mainfrom
longc/ctx-with-filler
Open

add ctx.say_filler() for acoustic fillers during long tools#5885
longcw wants to merge 4 commits into
mainfrom
longc/ctx-with-filler

Conversation

@longcw
Copy link
Copy Markdown
Contributor

@longcw longcw commented May 29, 2026

Summary

Adds ctx.say_filler() — an async context manager on RunContext that schedules optional filler speech during a long-running tool call. Fills quiet conversation gaps without burning an LLM round-trip.

@function_tool
async def book_flight(ctx: AsyncRunContext, origin, destination, date) -> str:
    await ctx.update(f"Searching flights from {origin} to {destination}…")
    async with ctx.say_filler("Still searching, hang on a sec.", delay=5):
        await slow_search()
    return result

Design

  • Two lanes. ctx.update() is the chat-ctx channel — delivers a real status to the LLM, which voices it. ctx.say_filler() is the acoustic channel — fires session.say() directly, bypasses the LLM.
  • Idle-gated. Each fire waits for delay seconds of continuous session-idle before playing, so fillers don't talk over the user or queue behind other speech. State changes (agent_state_changed, user_state_changed) reset the dwell.
  • One-shot or repeating. interval=None (default) fires at most once; setting interval makes the scheduler loop with wall-clock cooldown between fires. max_steps caps the number of fires.
  • Flexible source. Accepts str or (step: int) -> SpeechHandle | str | None. Callable returning None skips; useful for rotating variants.

@chenghao-mou chenghao-mou requested a review from a team May 29, 2026 03:18
devin-ai-integration[bot]

This comment was marked as resolved.

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.

1 participant