Skip to content

fix(crew): send AgentReady before starting nodes (unbreaks greeting in start()) - #70

Open
abhishekmishragithub wants to merge 1 commit into
mainfrom
chore/crew-ready-before-nodes
Open

fix(crew): send AgentReady before starting nodes (unbreaks greeting in start())#70
abhishekmishragithub wants to merge 1 commit into
mainfrom
chore/crew-ready-before-nodes

Conversation

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator

Problem

CrewSession.start() (session.py) called _start_nodes() and only afterwards sent SDKAgentReadyEvent. A node whose start() emits a speak — the natural way to greet — had that SDKAgentSpeakEvent flushed to the platform before Ready. Pipecat's AgentSDKProcessor._connect expects Ready as the first frame; getting a speak first leaves _connected=False, its receive loop never starts, and every subsequent event is a no-op — the whole call goes silent. This is why node-level self.speak() in start() silenced our test agents.

Fix

Send SDKAgentReadyEvent before _start_nodes(). Incoming events still buffer on the websocket until our own receive loop starts (after nodes are up), so nothing is lost by ordering Ready first. Any early speak from a node's start() is now legal.

Test

Adds tests/custom/test_crew_session_ready_ordering.py asserting Ready is sent before any node starts (fails if the ordering regresses).

Notes

  • Surfaced during the crew-greeting investigation; pairs with pipecat #1028 (which makes firstMessage the primary greeting path). This fix makes an in-start() greeting also viable instead of silently breaking.
  • No version bump — bundle into the next SDK release (5.4.0), verified end to end there. A second lifecycle footgun (OutputCrewNode.process_event requiring super()) is deferred to the DevX pass since its fix is an API change.

🤖 Generated with Claude Code

…rt() works

CrewSession.start() started nodes and only then sent SDKAgentReadyEvent. A node
whose start() emits a speak (e.g. a greeting) had that event flushed to the
platform before Ready; the platform's connect handshake then sees a non-Ready
first frame, never spawns its receive loop, and the whole call goes silent.

Send Ready first, then start nodes. Incoming events still buffer on the websocket
until our receive loop starts (after nodes), so nothing is lost. Adds a
regression test asserting Ready is sent before any node starts.
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