Chapter 09

Context vs Prompt Engineering

Key contrasts between crafting prompts and engineering context—with Finance AI and Support AI real-world examples.

Prompt engineering focuses on crafting effective instructions—the "how" of model interaction. Context engineering addresses the "what"—systematically constructing the information environment in which the model operates.

Key Contrasts

Aspect Prompt Engineering Context Engineering
Nature Static, one-off prompt string Dynamic assembly of multiple sources
Method Manual trial-and-error crafting Programmatic pipelines
State Stateless; each query stands alone Stateful; carries memory across turns
Scalability Fragile for complex tasks Robust for enterprise workflows
Reliability Depends on prompt wording Grounded in verified information

Finance AI Agent Example

💰 Finance AI Agent

Prompt Engineering Focus

Approach: Designing structured prompts, templates, and few-shot examples.

Example: "You are a financial advisor. Explain asset diversification for beginner investors..."

Guarantees: Well-structured, categorized, clear advice. Consistent formatting.

Context Engineering Focus

Approach: Integrating external data, embeddings, RAG, personalized context.

Example: Retrieve user's portfolio from API. Fetch live stock prices. Access historical trends.

Guarantees: Accurate, personalized, grounded in real data. Reduced hallucinations.

Support AI Agent Example

📞 Support AI Agent

Prompt Engineering Focus

Approach: Instruction design, few-shot examples, response templates.

Example: "You are a support agent. Respond politely to refund requests. Include step-by-step guidance..."

Guarantees: Tone, politeness, completeness, consistent formatting.

Context Engineering Focus

Approach: Retrieval of user data, grounding, multi-turn memory.

Example: Pull order history, warranty status, past tickets. Match similar cases via embeddings. Integrate CRM.

Guarantees: Accuracy, personalization, context-aware responses. Faster resolution.

Summary

📝 Prompt Engineering

HOW

Guarantees how the agent responds

  • ✓ Format
  • ✓ Clarity
  • ✓ Tone

🧠 Context Engineering

WHAT

Guarantees what the agent responds with

  • ✓ Accuracy
  • ✓ Relevance
  • ✓ Personalization

Prompt engineering is the foundation.
Context engineering is the production system.
Master both to build great AI agents.