Skip to main content

Conversation Lifecycle

This page traces the full life of a Q-AI Bot session, then a final Scenarios section covers the Texter wiring that connects the platform to the assistant. For the step-by-step of a single turn, see How It Works.


Session start

A session begins when AI mode is switched on for a chat. At that point:

  • A fresh session is created: no memory carries over from any earlier AI session on the same chat.
  • The assistant receives the project's system prompt (its standing instructions and persona) and the recent chat history.
  • The chat is now "owned" by the assistant: incoming messages will be answered by it until the session ends.

Ongoing turns

While the session is open, each incoming message is one AI turn (see How It Works for the turn itself). After each turn the session either stays open for the next message, or ends.


The five ways a session ends

A session ends for one of five reasons, recorded on the chat so your Texter bot and reports know why the assistant stepped away. The first four can happen during an active turn; the fifth comes from the re-engagement system when a chat goes quiet.

End conditionTermination reason (concept)Meaning
The model resolves the conversationresolved_convoThe assistant answered the contact's need and closed the chat itself.
The model requests a humanhuman_handoffThe assistant decided the conversation needs a person and escalated.
The per-project message limit is reachedReached message limitThe session hit the maximum number of AI turns allowed for this project, so it ends to prevent endless loops.
An error occurs during a turnErrorSomething failed mid-turn. The session ends safely rather than leaving the contact with a stalled bot.
The chat goes quiet for too longInactivityThe re-engagement system ran out of follow-ups and closed the idle session (see Idle re-engagement below).
Reasons are concepts, not error codes

Treat the reasons above as named outcomes. Your Texter bot can branch on the recorded reason: for example, route a human_handoff to an agent, or send a different closing message after a Reached message limit. The Response Schema page shows how the assistant emits the reason, and the AI Bot recipe shows a bot that branches on it.


Idle re-engagement

What if the contact just stops replying mid-conversation? The session doesn't stay open forever. A separate re-engagement system watches for quiet chats and walks a per-project ladder of timed follow-ups: gentle nudges, and eventually a close that ends the session with the Inactivity reason, exactly like any other handoff. The full behavior is on the Abandoned Bot System page.


Scenarios

So far this page has described the assistant's side of the lifecycle. The Texter side is wired by scenarios: small, event-driven rules in your Texter environment that react to chat events, chiefly the chat's externalBot flag flipping (set by the externalBot function or by an agent action), and emit the signals the assistant responds to.

You don't have to build these from scratch. The Q-AI scenarios are published in the Texter Scenario Marketplace, ready to browse and import.

The scenarios that drive the lifecycle

These three scenarios cover the core loop. Each one listens for a Texter event and turns it into a signal the assistant reacts to:

ScenarioWhen it firesWhat it does
Q-AI: Turn On AI BotAI mode is switched on for a chatStarts the AI session by forwarding the chat and its recent session messages to the assistant.
Q-AI: Forward Incoming Message to AIA contact sends a message while AI mode is onForwards that message to the assistant as the next AI turn.
Q-AI: End AI Session & Run BotAI mode is switched off (with the chat still under the bot)Ends the AI session and resumes the Texter bot from a designated node so your flow can act on the termination reason.

In addition to these three, the suite includes scenarios that switch AI mode off the moment a human takes over (when an agent is assigned the chat, when it is resolved manually, when it moves to pending, or when a template message is sent), so the assistant steps aside instantly whenever a person steps in.

Browsing and importing them

All Q-AI scenarios live in the marketplace under the ai-bot tag.

Find them fast

Open the Scenario Marketplace and type q-ai in the search box (or filter by the ai-bot tag). That surfaces the whole Q-AI suite (the three lifecycle scenarios above plus the human-takeover scenarios), each with a copy-pasteable example you can import into your Texter environment.

note

To provision a brand-new project's assistant end to end, use the Onboard AI Bot tool.