fix: wait for agent before sending text
Rebuild & Deploy / rebuild (push) Successful in 1m2s

This commit is contained in:
snowspeeder committed 2026-08-29 08:00:42 -04:00
1 parent 63e15b6023
commit b1643b635d
2 files changed
+38 -1

No files matched your search

+11
View File
@@ -758,6 +758,17 @@ async def handle_job(ctx: JobContext) -> None:
)
await ctx.connect()
# The participant can appear in the browser slightly before AgentSession is
# ready to accept lk.chat streams. Explicitly signal readiness so the first
# typed message is never raced against session startup.
try:
await ctx.room.local_participant.publish_data(
json.dumps({"type": "agent_ready"}),
reliable=True,
topic="conversation-control",
)
except Exception as exc: # noqa: BLE001
logger.warning("failed to publish agent readiness: %s", exc)
logger.info("Agent connected to room %s", ctx.room.name)