Agent Development Is Not Just "Calling APIs": The Four Core Context Challenges
This article explains why building AI agents is far more than wiring up model APIs. Using thought experiments about the nature of intelligence, it argues that an agent's "intelligence" lives in its engineered context rather than frozen model weights, and maps this insight to four core engineering challenges: prompt engineering (governing "being"), memory engineering (governing the "past"), context engineering (governing the "present"), and attention engineering (governing the "future").
1. Why “Just Calling APIs” Is the Wrong Mental Model
A question that frequently appears in developer communities goes like this: agents vary wildly in quality, but isn’t agent development just calling APIs? Where is the real difficulty?
This question hides a fundamental conceptual error: it reduces an agent to “a model API plus a layer of glue code.” To clear this up, we first need to answer a more fundamental question—what is an “intelligent being,” anyway?
A key claim: the essence of an intelligent being (you could also call it consciousness) is continuous context, not model weights.
A thought experiment makes this intuitive. You have lived through it yourself: from age 3, to 5, to 10, to 20, your biological brain’s physical compute kept changing, and your neural connections—analogous to “weights”—kept updating. So which one is the real you: the past you, the present you, or the future you? Are you the compute itself, the context itself, or some fusion of all these elements?
Intuition tells us: “I” am “me” not because of the hardware or parameters at any single moment, but because of continuous experience, memory, and accumulated growth.
2. The Clone Thought Experiment: Same Weights, Different Intelligences
Projecting this idea onto agents, we can construct another thought experiment.
Suppose cloning technology has matured to the point where it can replicate a person with identical memories (technically, this corresponds to “identical prefix caches”). Take a 10-year-old child and clone four copies: one stays in China, one is sent to the United States, one to a war-torn region, and one to be raised by an isolated tribe on a remote island. Then, at age 20, all four are placed together in the same space station.
At this point, the four individuals receive exactly the same “interface”—the same station environment, the same physical conditions, the same interaction surfaces. Yet we can confidently assert that their behavior will be dramatically different.
Where does the difference come from? From completely different acquired growth and accumulation. Four individuals with identical starting states develop four distinct sets of thinking patterns, value judgments, and behavioral habits in different environments.
In technical terms, this can be described precisely: the same working surface (interface) is actually controlled by a “cognitive state machine.” Given the same input, this state machine produces different outputs; given the same feedback, it undergoes different transformations. Facing the same interface, the four clones have evolved four entirely different cognitive state machines—rooted entirely in their different developmental paths.
3. From Thought Experiment to Agent Engineering: Four Core Governance Challenges
Modern model APIs provide frozen weights—every call is stateless, and the model itself never “grows.” This means all of an agent’s work processes and outcomes must be engineered into the “acquired” layer. And this acquired growth maps precisely onto the four core context challenges of agent engineering:
3.1 Governing “Being” — Prompt Engineering
Prompts define who the agent “is”: its role, behavioral boundaries, values, and output style. This is not about writing a few sentences—it is a continuous governance process:
- Consistency: The system prompt must remain logically coherent with tool descriptions and few-shot examples, or the model will oscillate between conflicting instructions.
- Evolvability: As business requirements change, prompts need version management, staged rollouts, and regression testing.
- Injection defense: Prompts sit on the attack surface, so defenses against prompt injection must be designed in.
The difficulty of prompt engineering lies in the stability of “being”: a tiny wording change can be amplified into completely different behavior across a long task chain.
3.2 Governing the “Past” — Memory Engineering
Stateless model calls mean the agent must explicitly manage its “past.” This includes:
- Short-term memory: The conversation history within the current session—how to summarize and compress it, and how to retain key decisions.
- Long-term memory: Cross-session user preferences, historical tasks, and domain knowledge—how to extract, store, retrieve, and forget them.
- Memory consistency: How to arbitrate when new and old memories conflict, and how stale information should decay.
The hard part of memory engineering is not “storing,” but “what to retrieve, what to forget, and what to trust.” Wrong memories are more dangerous than no memories.
3.3 Governing the “Present” — Context Engineering
Context engineering determines what the model “sees” at each inference step. It includes:
- Information orchestration: How system prompts, conversation history, retrieval results, and tool outputs are arranged directly affects attention allocation.
- Window management: Within a limited context window, how to trim, compress, and chunk long tasks.
- Capability governance: The registration and description of tools, external capability protocols, plugins, and skills also belong to governing the “present”—because they essentially tell the model “what you can do right now” at every call. This is also why this article removes “calling APIs” from the core concept of agents: the interface is only one part of capability; the real difficulty is making the model correctly understand and use those capabilities.
3.4 Governing the “Future” — Attention Engineering
Agents are built for multi-step tasks, and the quality of every future step depends on current planning and guidance:
- Task decomposition: How to break complex goals into executable, verifiable sub-goals.
- State machine design: How to model the agent’s execution flow, and how to roll back and retry after failures.
- Attention guidance: In long-horizon tasks, how to keep the model focused on the current goal without being derailed by irrelevant information—for example, through checkpoints, periodic summaries, and goal restatement.
4. Why These Problems Are “Hard”
Some may ask: aren’t technical details like prefix cache hit rates and context compression algorithms hard too?
In fact, once the right question is posed, the answers to these technical problems are usually clear and verifiable. What is truly hard is posing the right question—recognizing that the core of agent development is not model invocation, but the systematic design of the four governance challenges above. These four are deeply coupled: memory shapes context orchestration, context shapes attention, attention determines future actions, and actions generate new memories. A governance failure in any one link can collapse the entire agent’s performance.
This also explains why teams that are all “just calling APIs” end up with agents of vastly different quality: the gap is not in the interface, but in the engineering of the entire “acquired growth system” around it.
5. Conclusion
Back to the original question: what is the real difficulty of agent development?
The answer: engineering stateless model calls into an “intelligent being” with continuity, accumulation, and the capacity to evolve. Prompt engineering, memory engineering, context engineering, and attention engineering—these four challenges form the true deep waters of agent development. Understanding this is what moves you from intuitive “prompt stitching” to systematic agent engineering practice.
