Skip to main content

Agent System Layers and Logical Components

An **agent** is an autonomous software system that uses an LLM to reason about a goal, call tools, and run multi-step actions until the task is done: _plan → act → observe → adapt → deliver_.

An agent is an autonomous software system that uses an LLM to reason about a goal, call tools, and run multi-step actions until the task is done: plan → act → observe → adapt → deliver.

Think of it as a new kind of computer:

Classic computerAgent
CPULLM
RAMContext window
PeripheralsTools
OSAgent harness
ApplicationAgent

The LLM is superhuman at knowledge, language, and code, but weak at persistent memory, hallucination, and adversarial input. The rest of the system exists to cover those weaknesses.

The stack (layers)​

Modern AI systems stack

LayerHoldsRemember it as
Application / UserThe task and its ownerthe goal
Agent / Harnessplanning · context · memory · tools · subagentsthe OS
ModelThe LLMthe CPU
Serving systembatching · scheduling · routing · KV/prefix cachingthe scheduler
Runtime / KernelsCUDA · Triton · collectivesthe drivers
HardwareGPU · CPU · memory · network · storagethe machine
External environmentTools: web · files · APIs · humansthe world

Two halves:

  • Agent (top): decides what to do.
  • Serving + hardware (bottom): decides how fast and how cheap.

The best gains come from co-design across the halves, for example a harness that keeps its prompt prefix stable so the serving layer can cache it.

What to optimize. Not tokens per second. The objective is:

maximize task success, subject to latency, cost, resources, reliability, security

Measure $ per successful task and end-to-end latency, not GPU utilization.

Logical components (inside one agent)​

Agent logical components

ComponentJobDetail
LLMThe brainOne or several models, each with a role
WorkflowThe control flowA planner splits the task; actors execute the steps
MemoryWhat it remembersSession trace · long-term store · internal RAG
ToolsThe handsThree kinds of action: read, write, execute
EnvironmentWhere it actsWeb · computer · domain-specific · third-party services · external RAG · other agents
User interfaceHow people talk to itText, previews, interactive elements

The loop: the LLM picks a tool call → the environment returns an observation → repeat.

Agents differ from traditional software in two ways:

  1. They mix AI models with ordinary code.
  2. Their workflow is generated at runtime, not written in advance.

Why agents are a systems problem​

Plain LLM serving is one hop: request → inference → response. An agent is a chain: infer → tool → infer → tool → retrieval → infer…. The critical path crosses GPU, CPU, storage, network, and outside services.

Workload propertySystems problem
Long trajectoriesState and context management
Repeated prefixesPrefix caching
Tool dependenciesDependency-aware scheduling
Variable tool latencyAsynchronous execution
Multiple agentsOrchestration and communication
Huge contextMemory hierarchy and retrieval
Branching reasoningSpeculative execution
Different modelsRouting
External side effectsSecurity and isolation
Long-running tasksCheckpointing and fault tolerance

Observability is first-class: a trace becomes a nested trajectory (session → turn → agent step → model request → tool call → result → subagent). You cannot optimize what you cannot observe.

Flexibility is risk​

The SoK paper rates an agent on seven independent dimensions. Each goes from least to most flexible, and every step up adds capability and attack surface.

DimensionLeast flexibleMost flexible
Input trustNo external dataArbitrary external data
Access sensitivityNo sensitive dataArbitrary sensitive data
WorkflowSimple chatbotLLM-defined, dynamic
ActionResponse onlyResponse + retrieval + execution
MemoryNonePersistent across sessions
ToolNoneArbitrary tools
User interfaceText onlyInteractive web elements

Three attacker types:

  • External: controls only content the agent reads, such as web pages or documents (indirect prompt injection, tool poisoning).
  • User-level: talks to the agent directly (direct prompt injection).
  • Internal: a malicious developer or tool provider.

Three defense principles:

  • Defense in depth: guardrails, information-flow control, monitoring, human approval, and hardening, layered together.
  • Least privilege: each task gets only the tools it needs.
  • Complete mediation: check every access to a sensitive resource.

Cheat sheet​

  • An agent is LLM + context + tools + harness, a new kind of computer.
  • Top half decides, bottom half serves; optimize them together.
  • Components: LLM, workflow, memory, tools, environment, UI.
  • Tools do three things: read, write, execute.
  • Optimize $ per successful task, not tokens per second.
  • More flexibility means more risk. Apply least privilege.

For a full worked design, see Designing an Always-on Agent.

References

Let's stay in touch and follow me for more