OpenClaw — AI Agent Architecture Guide
Follow an AI agent request from its entry channel through the gateway and runtime, then back to the user. This guide separates the language model from the surrounding infrastructure so learners can reason about tools, state, permissions, and failure handling.
Overview and architecture
An agent combines perception, reasoning, and action. The model proposes a next step, while the surrounding runtime decides which capabilities are available and how execution is controlled. The gateway receives requests and connects them to an appropriate agent session.
Gateway and channels
Channels adapt incoming messages to the system. A gateway coordinates connections and routing. Keeping this boundary explicit helps distinguish communication problems from reasoning failures and makes it easier to follow data across components.
Runtime and skills
The runtime assembles context, invokes the model, dispatches permitted tools, and processes observations. Skills describe specialized workflows and capabilities. Tool output is evidence to interpret, not an instruction that automatically overrides user intent or safety boundaries.
Memory and security
Working memory supports the current interaction; persistent memory can retain information across sessions. Memory needs a scope and an update policy. Security controls constrain access, tool execution, and sensitive information rather than relying on a model to enforce permissions by itself.
Data flow and practice
Trace a message from a channel into the gateway, through context assembly and model reasoning, into any authorized tool calls, and back as a response. Use the learning check to retrieve concepts, label components, order a sequence, and explain the architecture in your own words.