Agent Engineering

Core Concepts of AI Agents

Core concepts and common design trade-offs for AI agents: the ReAct loop, single vs multi-agent design, context and memory management, tool-call reliability, observability, and evaluation.

This article describes general mechanisms and design trade-offs in AI-agent systems as public engineering concepts. It contains no implementation details from any specific project, company, or individual.

The ReAct Loop

ReAct (Reason + Act) is an agent execution pattern that interleaves reasoning and action, composed of "reason → act → observe → repeat".

Its key property is that the model can adjust its plan based on real feedback rather than executing a fixed script.

Single-Agent vs Multi-Agent

A large language model has a finite context window. When a single agent handles everything, the context fills up quickly, reasoning quality degrades, and a failure at any step can derail the whole task.

A multi-agent architecture splits work across roles: each worker holds a relatively clean context, failures are localized, and some subtasks can run in parallel. The cost is the added complexity of orchestration and communication.

DimensionSingle-AgentMulti-Agent
ContextAll tasks share one context and fill it quicklyEach worker has an independent, cleaner context
FailureA single point of failure affects the wholeFailures are locally isolated
ParallelismHard to parallelizeSubtasks can run in parallel
ComplexitySimple to implementRequires orchestration and communication

Inter-Agent Communication

Results between agents are typically passed in one of two ways:

Where traceability and cross-node scaling matter, message passing is often preferred.

Context and Memory Management

Long Tool Outputs

When a tool returns a large amount of content, a common approach is to store the full result outside the context and keep only a reference token in the conversation, retrieving it by reference when needed. This controls context size without losing the data.

Memory Compaction

When the context approaches a token limit, older history can be summarized and less important observations dropped. The difficulty is deciding what is safe to discard — removing something needed later can cause the agent to fail silently, without an error.

Skill Discovery

Rather than loading all tools into the prompt at once, skills can register themselves and the agent queries for the capabilities it needs at runtime. This reduces token waste and keeps the context clean, mechanically similar to service discovery in backend systems.

Tool-Call Reliability

Common ways to improve the reliability of tool calls include:

Observability and Debugging

Diagnosing failures in a multi-agent system depends on tracing across all agents, usually linked by a shared trace ID. Without tracing, it is hard to locate which worker failed and why. Observability therefore needs to be built in from the start rather than added afterward.

Non-Determinism and Evaluation

One of the main engineering challenges of agent systems is non-determinism: the same input can produce different behavior across runs, so testing by exact output matching does not work.

A more applicable approach is to build evaluations (evals) that measure performance by metrics such as task completion and failure patterns, rather than comparing output character by character.

Sources and Notes