INS-0013 · AI chatbot architecture

From question to answer: the five layers of an AI chatbot

Generated text follows one path. Business actions follow a separate branch with explicit permissions and controls.

Illustrative question: “Can I return a product bought twenty days ago?”

Response path Generates text; does not execute operations
01

Interface and session

Receives the message, language, channel, state and identity when applicable.

Application-managed memory · optional
May retain state or history; it is not “model memory”.
Failure cue · wrong identity or session
02

Rules, instructions and orchestration

Applies policy, prompts, routing, format, fallback and component order.

Failure cue · conflicting or obsolete instructions
03Optional

Retrieval and data access

Retrieves authorised documents or records and adds them to runtime context.

Failure cue · stale, missing or irrelevant source
04

Model inference and response generation

Produces text from the instructions, question and available context.

Failure cue · omission or unsupported conclusion
Output

Generated response

May explain the policy and state what is missing. It remains distinct from an executed action.

Text
Layer 05 · separate operational branch

Business actions and controls

The model may propose a call. The application decides whether and how to execute it.

Entire branch optional
  1. Authentication
  2. Authorisation
  3. Validation
  4. Confirmation
  5. Outcome logging
  6. Human handoff
  7. Tool / APIExecutes the business action with bounded permissionse.g. start the return
  8. Failure cue · excessive permission, wrong record or missing recovery

M4TIC synthesis of common architecture patterns, not a universal standard.Optional means the layer may be absent.Runtime retrieval ≠ model training.Retrieval, citations and guardrails do not guarantee correctness.

Complete text equivalent

The main path begins with the interface and session, continues through rules, instructions and orchestration, may include authorised retrieval and data access, and then reaches the model that generates a text response. Application-managed memory is optional and separate from the model. Runtime retrieval is not training.

Business actions use a separate optional branch. Before or after calling a tool or API, the application must apply authentication, authorisation, validation, confirmation, logging and, where necessary, human handoff. Every layer has a possible failure point; retrieval, citations and guardrails do not guarantee that an answer is correct.