January 7, 2026
By Conor Brennan-Burke · Founder
Your AI agent has access to a frontier model. A user asks it to "reschedule my 3pm with Sarah to next week." The agent can parse natural language, understand intent, and generate polished responses.
It also has no idea who Sarah is, which meeting you mean, what your calendar looks like, or when you're free next week. So it asks you. For all of it.
This is the default state of every AI agent in production today. LLMs are stateless. Every interaction starts from zero. The model can reason, but it has nothing to reason about. The bottleneck is not intelligence. It is context.
Context engineering is the emerging discipline of designing what information an AI agent receives, when, and in what format. It goes beyond prompt engineering, which focuses on instructions. It goes beyond RAG, which is one retrieval technique among many. Context engineering is the full practice of ensuring an agent has the right knowledge at the right moment to act usefully. At Hyperspell, this is the problem we work on every day.
Context engineering is the discipline of designing what information an AI agent receives, when it receives it, and in what format, so the agent can act usefully in a specific situation.
This definition matters because the term gets confused with two narrower concepts.
Prompt engineering designs instructions. You tell the model how to behave, what format to use, what persona to adopt. This is one layer of context engineering, but it is not context engineering itself. A perfect prompt cannot compensate for missing knowledge.
RAG (retrieval-augmented generation) retrieves documents and injects them into the context window before inference. This is one technique within context engineering, addressing knowledge retrieval. Context engineering also covers relational data, temporal awareness, memory management, and context assembly. RAG handles none of those.
The field matured in stages. Prompt engineering dominated 2022-2023, when the challenge was getting models to follow instructions reliably. RAG emerged in 2023-2024 as teams realized models needed external knowledge. By 2025, builders working on production agents recognized that retrieval alone was insufficient. Agents needed a full context strategy, and context engineering became the name for that discipline.
Anthropic's "Building Effective Agents", one of the most-cited resources on agent design, frames the related point well: the challenge is not what the model can do, but what it knows when it acts.
The Four Layers of Agent Context is a framework for understanding the types of information an agent needs, and why most agents only address half of them.
System prompts, tool definitions, behavioral rules, and guardrails. This is what prompt engineering covers. It tells the agent how to operate. At Hyperspell, we treat this as the foundation, but it is the least differentiating layer for the end user.
Relevant documents, data, and reference material retrieved from a knowledge base and injected into the agent's context window. Most teams start here and stop here. This is what RAG addresses, and it works well for factual lookups. But it has no concept of who is asking or why.
Who the user is, their relationships, their organizational structure, their preferences and history. An agent with relational context knows that "Sarah" is Sarah Chen from the product team, that you meet with her weekly, and that she prefers mornings. This is the layer where agents stop feeling generic and start feeling useful.
What happened recently, what is changing, what is coming next. An agent with temporal context knows that your 3pm with Sarah was added yesterday, that she moved to a new team last week, and that you have a conflict next Tuesday. Without this layer, agents give stale answers to time-sensitive questions.
Layer | What It Covers | Typical Implementation | What It Enables |
|---|---|---|---|
Instruction | System prompts, tool definitions, rules | Prompt engineering | Agent knows how to behave |
Knowledge | Documents, data, reference material | RAG, semantic search | Agent knows relevant facts |
Relational | User identity, relationships, preferences | Memory systems, knowledge graphs | Agent knows who you are |
Temporal | Recent events, changes, upcoming items | Live data connections, event streams | Agent knows what is happening now |
Layers 1 and 2 make an agent functional. Layers 3 and 4 make it indispensable. The difference between a generic chatbot and a useful assistant is almost always relational and temporal context.
A larger context window is a bigger container, not a smarter selection process. Room for a million tokens does not mean knowing which tokens matter. Three problems persist regardless of window size.
Cost and latency scale with input. Filling a huge window on every query is expensive and slow. Production agents need fast responses at scale. No application with real traffic can afford to dump everything into the window on every request.
Signal-to-noise ratio degrades. Research on the "lost in the middle" problem (Liu et al., 2023) shows that LLMs struggle to use information placed in the middle of long contexts. More tokens means more noise, which means worse performance on the facts that actually matter.
Selection is the real problem. A human with photographic memory still needs to know which memories are relevant to the current conversation. The same applies to agents. The engineering challenge is not storage capacity. It is knowing what to surface and when.
We think of context engineering as the selection layer: the system that determines what information is relevant to a specific query, formats it appropriately, and delivers it to the model at inference time.
A production context engineering stack has five components, each bridging a gap between raw workspace data and useful agent context.
Data ingestion. Connect to the user's actual workspace: email, Slack, Google Docs, CRM, calendar, project management tools. This is the foundation, and it is also where most teams lose months to OAuth flows, API pagination, and data normalization. As one Hyperspell customer put it: "We were spending all our time on OAuth instead of building our product." We handle this with 50+ pre-built integrations and managed OAuth, so teams ship in days rather than months.
Indexing and retrieval. Once data is connected, it needs to be searchable. Semantic search handles meaning-based queries. Keyword search handles exact matches. Knowledge graphs capture relationships between entities. The strongest systems combine all three, which is the approach we take at Hyperspell with indexed and live search modes.
Memory management. Not everything should be remembered forever. A context stack needs policies for what to retain, what to update, what to forget, and how to handle conflicting information. This is where RAG-only approaches break down: they retrieve documents but have no concept of memory lifecycle.
Context assembly. Given a specific query, which pieces of instruction, knowledge, relational, and temporal context should the model receive? The Four Layers framework becomes practical here: a checklist for what the assembler should consider.
Continuous learning. Feedback loops that improve context quality over time. When a user corrects the agent, that correction should update the context layer. When retrieval returns irrelevant results, that signal should improve future retrieval. The stack should get better with use.
The difference between an agent with and without proper context engineering shows up in response time, accuracy, and user satisfaction. We see it across every deployment. Three examples.
Without relational context: A user writes "I'm having the same issue again." The agent asks what issue, when it happened, and what product they're using. The user re-explains everything. Resolution takes 8-12 minutes.
With relational context: The agent knows this user reported a billing discrepancy last week, that it was resolved with a credit, and that they are on the Enterprise plan. It responds: "I see your billing discrepancy from January 28th. Is this the same issue or a new one?" Resolution drops to 2-3 minutes.
A prospect asks "What's new since our last call?" Without temporal context, the agent has no knowledge of the prior conversation, recent product updates, or the prospect's evaluation timeline. It falls back on a generic product overview.
With temporal context, the picture changes. The agent knows the last call was two weeks ago, that three features the prospect asked about have since shipped, and that their trial expires Friday. It leads with the relevant updates and proactively addresses the timeline.
A developer asks "Why is the auth flow failing?" Most agents suggest generic debugging steps, none of which apply to this codebase. The developer wastes 20 minutes before realizing the suggestions are irrelevant. But an agent with project history knows the team migrated from JWT to session-based auth last sprint, that three auth-related PRs merged this week, and that a similar bug was fixed in the payments service last month. It points to the specific migration change that likely introduced the regression.
In each case, the model's reasoning ability is identical. The context is the variable.
Prompt engineering focuses on instructions: how the model behaves, what format it uses, what persona it adopts. Context engineering encompasses prompt engineering and adds the knowledge, relational data, and temporal information the agent receives. Prompt engineering is Layer 1; context engineering is all four layers.
RAG handles one part of it: retrieving documents into the context window. It does not address relational context (who the user is), temporal context (what changed recently), memory management (what to remember or forget), or context assembly (selecting the right combination per query). Most teams that plateau on agent quality find the gap is in Layers 3 and 4.
Research by Liu et al. (2023) showed that LLMs perform significantly worse when relevant information sits in the middle of long contexts rather than at the beginning or end. Increasing context window size does not guarantee the model will use the information. Context engineering addresses this through selective retrieval: surfacing only the most relevant information rather than filling the window.
You can, but it typically takes 3-6 months of engineering for data ingestion, OAuth handling, indexing, and retrieval tuning alone. As Arjun Athreya, CTO at Hobbes, described it: the heavy lift of building this in-house "could have taken months." Teams that want to focus on their agent's core value often use managed infrastructure like Hyperspell for the context layer.
Context engineering is the discipline of designing what information an AI agent receives, when, and in what format. It goes beyond both prompt engineering and RAG.
The Four Layers of Agent Context (instruction, knowledge, relational, temporal) are a framework for auditing what your agent knows and what it is missing.
Most builders only address Layers 1 and 2. Layers 3 (relational) and 4 (temporal) are where agents go from functional to indispensable.
Larger context windows do not solve the selection problem. Cost, latency, and the "lost in the middle" effect make selective retrieval essential.
A production context stack includes data ingestion, indexing and retrieval, memory management, context assembly, and continuous learning.
Companies that invest in their context layer now will build compounding advantages as their agents improve over time.