PromptCause
Donate

8 / 11

Agentic and Context Engineering

ReAct (Reason + Act)

Advanced

In short: Alternate reasoning and action (tool use).

What is: The pattern that powers every AI agent. The model alternates between reasoning (what do I need to do now?) and acting (use a tool: search, read a file, call an API), observing the result before the next step.

When to use: Whenever the model needs external information or to take actions, searches, code, automation.

When to avoid: Tasks the model solves on its own with what it knows, tools there only add latency.

Right
You have a search tool. To answer: 1. Think: what info do I need and where to find it. 2. Act: use search to get the real data. 3. Observe; if enough, answer; otherwise repeat.

The think→act→observe loop connects the model to reality instead of inventing.

Why: Yao et al. (2023) showed that interleaving reasoning and actions beats both plain CoT (which doesn't act) and acting without reasoning, and reduces hallucination by grounding in real observations.

💡 Tip: Describe when to use each tool. On modern models, avoid aggressive language ("you MUST"), it causes excessive tool use.

Context Engineering

Advanced

In short: Manage the agent's WHOLE context flow, not just the prompt.

What is: The discipline larger than prompt engineering. While PE optimizes one instruction, context engineering manages the whole information flow to the model over time, system instructions, tools, history, data.

When to use: When the "prompt" is really a multi-turn agentic system, not a one-shot.

When to avoid: Simple one-question interactions, a good prompt is enough.

Right
Principles: context is a finite resource ("context rot" exists). Use the SMALLEST set of high-signal tokens. For long tasks: compaction (summarize history), note-taking (notes outside context) and sub-agents (clean context).

Most agent failures aren't model failures, they're context failures.

Why: Recall degrades as context grows ("context rot"). Curating context at each step, too little → hallucination, too much → overflow, conflicting → confusion, is what keeps the agent coherent.

💡 Tip: Load just-in-time: instead of preloading everything, give the agent tools to fetch what it needs when it needs it.