The turn pipeline

The turn pipeline is the processing loop that runs every time a user sends a message. It is the foundation that connects all other systems in the Agent Framework — the Observer, the Tool Caller, and V2V backward prompting are all components of this pipeline. Understanding it makes every other article in this section easier to follow.

Overview

User sends a message
    │
    ▼
CAMainFlow assembles prompt and generates response
    │
    ▼
broadcast_analyze_conversation event fires
    │
    ├──► CAObserverFlow (queue)
    │       Extracts user info, evaluates quality
    │
    ├──► CAThoughtsFlow (interrupt)
    │       Generates KEY DIRECTIVES for the next turn
    │
    └──► CANewoToolCaller (queue)
            Detects action commitments, fires tools

        ▼ (outputs stored as attributes)

Next turn: CAMainFlow reads updated directives and context

Step-by-step walkthrough

1. Event received

When a user sends a message on any channel — phone, chat, Telegram, WhatsApp, or webcall — the platform fires a user_message event. For new conversations, a conversation_started event fires first and initializes the session.

2. CAMainFlow assembles the prompt and generates a response

The ConvoAgent's primary flow (CAMainFlow) picks up the incoming event and assembles a full context prompt from multiple sources:

  • The agent's business context, scenarios, and procedures
  • The compiled intent type map (working-hours or non-working-hours variant)
  • KEY DIRECTIVES generated by the Observer on the previous turn
  • Current booking and calendar action states
  • RAG context, if enabled

With this context assembled, the ConvoAgent generates a response and sends it back to the user.

3. broadcast_analyze_conversation fires

After the ConvoAgent generates its response, CAMainFlow fires the broadcast_analyze_conversation system event. This event has three subscribers that all run at the same time.

4. Three flows run in parallel

FlowInterrupt modeWhat it does
CAObserverFlowqueueExtracts user information (name, phone, email, language, opt-in preferences) from the latest exchange. Evaluates conversation quality on voice channels.
CAThoughtsFlowinterruptAssembles the full supervisor context and generates KEY DIRECTIVES — structured step-by-step instructions for what the ConvoAgent should do next.
CANewoToolCallerqueueAnalyzes the ConvoAgent's latest response for action commitments. Detects matching tools, resolves conflicts, and fires execution flows.

Queue vs interrupt mode: CAThoughtsFlow runs in interrupt mode, meaning if a new broadcast_analyze_conversation event arrives before thought generation finishes, the in-progress run is cancelled and restarted with the latest conversation state. This ensures KEY DIRECTIVES always reflect the most recent exchange. The other two flows run in queue mode — they complete the current run before processing a new event.

5. Outputs feed into the next turn

Each flow's outputs become inputs for the following turn:

CAObserverFlow outputs:

  • Extracted user information (name, phone, email, language, opt-in status) stored as persona attributes
  • Working hours status
  • Conversation quality flag (triggers recovery actions if score ≤ 3)

CAThoughtsFlow outputs:

  • KEY DIRECTIVES stored as a persona attribute. On the next turn, CAMainFlow reads these and injects them into the ConvoAgent's prompt as <CurrentTaskAnalysis> — telling the agent exactly which scenario step to execute next.

CANewoToolCaller outputs:

  • Tool execution flows fire (e.g., CACheckingAvailabilityFlow, CAActionSendSMSInformationFlow, CAActionCallTransferFlow). These flows perform backend operations and may inject results back into the conversation via urgent messages or updated persona attributes.

Waiting mode

When a tool execution flow performs an operation that takes time — such as checking booking availability — the system enters waiting mode to prevent the ConvoAgent from acting on stale directives:

  1. convoagent_activate_waiting_mode event fires, pausing thought generation
  2. If the user sends another message while waiting, the ConvoAgent responds without updated KEY DIRECTIVES
  3. When the tool result arrives, an urgent_message event re-enables thought generation, and the next turn's directives incorporate the result

This prevents the Observer from generating directives that don't yet account for a pending tool result.

How the pipeline shapes agent behavior

Each turn is self-contained. The ConvoAgent generates a response based on whatever directives and context existed at the start of that turn. The parallel flows then update those directives for the next turn. This creates a continuously updated guidance loop:

TurnConvoAgent responseParallel output
1Greets user, identifies intentObserver detects language; Thoughts set Scenario 0 → Scenario 1 routing
2Asks for phone number (Step 1.1)Observer stores phone number; Thoughts advance to Step 1.2
3Asks for name (Step 1.2)Observer stores name; Thoughts advance to Step 1.3
4Says code-phrase: "Let me check availability for Friday at 7 PM"Tool Caller detects check_availability_tool; fires CACheckingAvailabilityFlow; waiting mode activates
5Receives availability resultObserver updates availability context; Thoughts instruct ConvoAgent to confirm or offer alternatives

See also

  • The Observer system — Full reference for CAObserverFlow and CAThoughtsFlow, including KEY DIRECTIVES format, field tracking, and quality scoring
  • The Supervisor and Tool Caller system — Full reference for CANewoToolCaller, tool compilation, condition detection, and execution pipeline
  • V2V backward prompting — How KEY DIRECTIVES are injected into voice-to-voice models mid-conversation

Changelog

The turn pipeline: initial publication

Published developer reference covering the per-turn processing pipeline: event dispatch, CAMainFlow prompt assembly, parallel execution of CAObserverFlow, CAThoughtsFlow, and CANewoToolCaller, waiting mode, and how each flow's outputs feed the next turn.