yifeng.ai ← Lab
Reference · updated October 2026

AI Agent Anatomy

An agent is a six-layer stack: Model (brain), Router (picks the brain), Harness (body that runs the loop), Tools (eyes and hands), Memory / Permissions (recall and immune system), and Orchestration (heartbeat that wakes it, spine that scripts the steps).

The organ metaphors are for intuition; the layers pin the boundaries, so a workflow tool or a model gateway doesn’t get called “the agent.” The minimum runnable agent is just Model + Harness + Tools.

L1
Model · brainReason, plan, choose tools, judge results. Sets the capability ceiling.
Sonnet · GPT · Gemini · local Llama
L2
Router · choose a brainOptional. Decides which model runs this turn—does not run the loop.
Cursor model picker · OpenRouter · LiteLLM
L3
Harness · bodyThe program that runs sense → think → act. Most “agent products” are this layer.
Claude Code · Cursor Agent · Codex · OpenClaw · Agent SDKs · LangGraph
L4
Tools / Perception · eyes + handsHow it sees and acts: Shell, MCP, APIs, DOM/AX, screen pixels.
MCP · connectors · Playwright · computer use
L5
Memory + Permissions · memory + immune systemWhat it remembers and what it is allowed to do. Without this, agents are forgetful and unsafe.
CLAUDE.md · session memory · sandbox · macOS permissions · approvals
L6
Orchestration / Triggers · heartbeat + wiringWho wakes it and how multi-step jobs are sequenced. Not AI-specific, but needed for 24/7 work.
n8n · cron · webhooks · Slack / Telegram

A minimal runnable agent needs only Model + Harness + Tools. Router, Memory, Permissions, and Orchestration are upgrades—you can chat without them, but you rarely get a reliable employee.

Layer map

Organ metaphors (brain / eyes / hands) stay intuitive. Engineering layers pin the boundaries so Router, n8n, and MCP do not all get called “the agent.”

LayerJobOrgan metaphorTypical examples
1 ModelUnderstand and decideBrainClaude Sonnet, GPT, Gemini, Ollama local models
2 RouterPick which model (optional)Brain swapCursor model menu, OpenRouter, LiteLLM
3 HarnessRun the agent loopBodyClaude Code, Cursor Agent, Codex, OpenClaw, LangGraph
4 ToolsPerceive and actEyes + handsShell, MCP, APIs, DOM/AX, computer use
5 Memory / PermissionsRecall and safety boundsMemory + immuneCLAUDE.md, vector stores, sandboxes, OS permissions
6 OrchestrationTriggers and multi-step wiringHeartbeat + spinen8n, cron, webhooks, Hammerspoon timers

1 · Model · brain

Sets the ceiling: understand the task, break steps, pick tools, judge outcomes. Swap the model under the same harness and results can change a lot.

Anthropic · Claude

StrongLong-horizon work, coding, stable tool use. Proposed MCP; early computer use.

WeakNo open weights—reached through the API or Anthropic’s own apps; top tiers cost more per token.

OpenAI · GPT

StrongGeneralist with the widest ecosystem: ChatGPT, Codex, Atlas, Agent. MCP plus computer use on Mac and Windows.

WeakCloud-bound; capability differs across product lines.

Google · Gemini

StrongVery long context, native multimodal. Computer-use models in the API; strong cheap tiers.

WeakConsumer desktop agents started later.

Open-weight models

Llama, Qwen, DeepSeek, Gemma, Mistral via Ollama / LM Studio.

StrongFree, offline, data stays on-device.

WeakLong tasks and screen understanding lag frontier models; hungry for RAM / GPU.

2 · Router · choose a brain

Optional layer. Answers one question: which model runs this turn (or this step). It does not run the loop or call tools.

In-product switching

Cursor, GitHub Copilot, and similar UIs let you pick Claude / GPT / Gemini / proprietary models. Routing lives inside the product.

Unified gateway

OpenRouter, LiteLLM, and peers: one API key in front of many providers, split by price, latency, or capability.

Boundary with Harness

Router = who thinks; Harness = how it thinks and acts. Without a Router, the Harness usually hard-wires a default model.

Common mix-up: treating OpenRouter as an agent. It is a model marketplace + gateway. You still need a Harness before anything works like an employee.

3 · Harness · body

This is where “calling tools” actually happens: the program asks the model what to do next, runs tools, stuffs results back into context, and asks again—until done. A harness is not a protocol; it is the runtime that keeps looping.

Claude Code

CLI harness. Brain is mostly Claude; hands are Shell, files, MCP.

Cursor Agent

IDE harness. Swappable models (built-in Router); tools bound to the editor and terminal.

Codex / Gemini CLI

Vendor coding harnesses with the same pattern: loop + tools + repo context.

OpenClaw

Self-hosted “bare body”: you attach organs (model, tools, permissions) yourself—and own config and safety.

Agent SDKs / LangGraph

Programmable harnesses: you write the loop, state machine, retries, and human approvals into a product.

One line: Claude Code and Cursor Agent are harnesses. MCP is only one kind of tool interface on their hands—not the harness.

4 · Tools / Perception · eyes + hands

They come in pairs: how an agent “sees” mostly decides how it “moves.” Four levels (T1–T4) from precise to general—higher looks more human, and is slower, costlier, and more error-prone.

LevelEyes: what it seesHands: how it actsExamplesStrengthWeakness
T1Text streamTerminal output, files, logs. Not visual, but precise.Shell, edit files, run scripts, git. Claude CodeCodexGemini CLI Fast, cheap, reproducible.Cannot reach GUI apps with no CLI/API.
T2Structured dataMail, calendar, drive, Slack, DBs via connectors / APIs.Tool calls, MCP, connectors: send, create, update. Claude DesktopChatGPT appsMeta Musen8n Semantically clean; clear permission edges.No connector, no access.
T3UI treeWeb DOM or macOS Accessibility (AX) tree.Click elements, fill forms, scroll. Claude in ChromeAtlasPlaywrightHammerspoon AX More precise than pixels; broader than APIs.Fails on canvas, remote desktop, messy UIs.
T4PixelsScreenshots to a vision model—what you see.Coordinate clicks + keyboard, like a person. computer useOpenClaw computer Works on any app; last resort.Slow, token-heavy, misclicks; often steals the foreground keyboard/mouse.

On macOS, system permissions (Accessibility, Screen Recording) are immune preconditions for this layer: without them, T3/T4 eyes and hands cannot attach. Good agents use the lowest level that finishes the job; pixels are the fallback.

5 · Memory + Permissions · memory and immune system

Whether an agent can keep working for you—and not make a mess.

Memory

Short-term via the context window; long-term via files (CLAUDE.md, AGENTS.md), built-in memory, or vector stores. Context fills and gets compressed, so what you persist matters.

Permissions · immune system

Approval prompts, sandboxes, app allowlists, OS permissions. Blocks accidental deletes, spam sends, and web prompt injection. Pixel control plus full disk access is the highest-risk combo.

6 · Orchestration / Triggers · heartbeat and wiring

Not AI-specific: who wakes the agent, and how multi-step jobs are sequenced. With this layer, tools feel more like staff; without it, you are just starting chats by hand.

Triggers · heartbeat

You, a schedule, a message (WhatsApp / Telegram / Slack), a webhook, a file change. For 24/7, you need a machine that does not sleep—or a cloud VM.

n8n

Workflow orchestration. Can add AI nodes, but it is still a fixed flowchart—closer to spine than Harness. Good fit: cron → call a model once → write a Sheet → notify.

Spine · deterministic scripts

Hammerspoon, Keyboard Maestro, Shortcuts (below): fast, exact, zero tokens; cannot handle surprises. Best combo: model decides, spine executes.

Hammerspoon

Lua bridge to macOS APIs; free and open source.

Stronghs.eventtap, hs.axuielement, timers and hotkeys; agents can call it via the hs CLI.

WeakmacOS only; you write Lua; can screenshot but cannot understand screenshots.

Keyboard Maestro

Paid macOS macro engine.

StrongRich triggers, image-match clicks, shell / AppleScript without code.

WeakUI changes break image matching.

Apple Shortcuts

Built into macOS / iOS.

StrongApp Intents, personal automations, shell, optional Apple Intelligence.

WeakLimited to what apps expose; awkward for complex logic.

n8n ≠ Harness. n8n sequences steps; a Harness lets the model decide the next step inside a loop. They stack: n8n wakes on a schedule, then starts a Claude Code / Agent SDK run.

Product matrix

Which eyes / hands / heartbeat each product ships with. Solid = native; half = partial / needs config / preview; empty = mostly absent. “Acts on your computer” means your real machine, not a cloud VM.

NativePartial / config / previewNone
ProductBrainT1
Shell
T2
MCP / connectors
T3
DOM / AX tree
T4
Screen pixels
Schedule / always-onActs on your computer
Coding agents · usually full harnesses
Claude CodeCLI · AnthropicClaude
CodexCLI + app · OpenAIGPT
Gemini CLIGoogleGemini
CursorIDE · includes RouterClaude / GPT / Gemini / in-house
GitHub Copilotagent mode · MicrosoftClaude / GPT / Gemini
Desktop assistants
Claude Desktop / CoworkAnthropicClaude
ChatGPT Desktopincl. computer use · OpenAIGPT
Gemini DesktopGoogleGemini
Microsoft CopilotWindowsGPT + Microsoft models
Meta MuseMac · connectorsMuse Spark
Browser agents
Claude in Chromeextension · AnthropicClaude
ChatGPT Atlasbrowser · OpenAIGPT
Perplexity CometbrowserMultiple models
Cloud agents
ChatGPT Agentagent mode · OpenAIGPT
Manusgeneral agentMultiple models
Self-hosted / single layer
OpenClawopen-source harnessAny (swappable)
Ollama / LM StudioModel layer onlyOpen-weight
OpenRouterRouter layer onlyMany (gateway)
Orchestration / spine · deterministic automation
HammerspoonLua · macOSNone
Keyboard MaestromacOSNone
Apple ShortcutsmacOS / iOSApple Intelligence (optional)
n8nworkflow · not a HarnessAny (via AI nodes)

How to read it: OpenClaw fills the most cells because it is a bare Harness. Claude / ChatGPT desktop apps are assembled machines. OpenRouter and Ollama cover one layer. n8n is strong at orchestration—do not mistake it for the agent loop itself.