How OpenClaw Works

The architecture at a glance — how a message flows from your phone to the AI and back.

🏗️ Architecture Overview

📨 How a Message Flows

1

You send a message

Via WhatsApp, Telegram, Discord, or any connected channel.

2

Gateway receives it

The Gateway is the central hub. It maintains all channel connections (WhatsApp via Baileys, Telegram via grammY, etc.) and routes messages.

3

Session is resolved

The Session Manager finds or creates a session for this sender. DMs merge into a "main" session; group chats get isolated sessions.

4

Agent processes the message

The Agent Runtime builds context (system prompt + memory + tools) and sends it to your configured LLM (Anthropic, OpenAI, Google, etc.).

5

Tools are called

The LLM can invoke tools — read files, run code, search the web, control browsers, access Nodes (camera, screen).

6

Reply is sent back

The response streams back through the Gateway to the original channel. Media (images, audio) is converted to the channel's format automatically.

🧩 Core Components

← Back to Guide