DevInterviewMasterStart free →
AI & AutomationFree to read

Agentic Prompting (Planning, Reflection, Tool Use)

Teaching LLMs to Think Like Autonomous Problem Solvers

Learn the prompting patterns that transform a passive LLM into an active agent - planning multi-step tasks, reflecting on its own output, and deciding when and how to use external tools.

What is Agentic Prompting?

Turning a Passive LLM Into an Active Agent Through Prompting

Simple Definition:

Agentic prompting is a set of techniques that instruct an LLM to behave like an autonomous agent - breaking down tasks into steps, reflecting on its own reasoning, using tools when needed, and iterating until the task is complete. Instead of one-shot answers, the LLM operates in a loop.

Think of the difference between asking someone "What is 2+2?" (simple prompting) versus saying "Here is a complex math problem. Break it down, solve each part, check your work, and correct any mistakes" (agentic prompting). Same person, but the instructions unlock a completely different mode of thinking.

Real-World Analogy - IAS Officer vs Clerk:

A government clerk follows exact orders - "stamp this file, forward it." An IAS officer gets a goal - "solve the water crisis in this district" - and then plans, delegates, reviews progress, course-corrects, and sees it through. Agentic prompting turns the LLM from a clerk into an IAS officer.

The Three Pillars of Agentic Prompting:

  • Planning: Breaking a complex goal into actionable sub-tasks with dependencies
  • Reflection: Self-evaluating output quality and reasoning correctness
  • Tool Use: Deciding when internal knowledge is insufficient and external tools are needed

Agentic vs Traditional Prompting:

AspectTraditionalAgentic
ThinkingSingle passMulti-step loop
Self-CorrectionNoneBuilt-in reflection
Tool AccessNoneDynamic tool selection
ComplexitySimple tasksMulti-step workflows
ReliabilityOne chanceIterates until correct

Note: Agentic prompting does not require any special framework or infrastructure. It is purely about how you structure your prompts and system instructions. You can make any LLM behave agentically with the right prompting.

Planning - Teaching LLMs to Think Before Acting

Great Results Start With a Great Plan

Why Planning Matters:

Without explicit planning instructions, LLMs tend to jump straight into execution. This works for simple tasks but fails for complex ones. Planning forces the LLM to think about the entire task before starting, identify dependencies, and allocate effort appropriately.

Like how a good architect does not start laying bricks on day one. They first survey the land, draw blueprints, calculate materials, and plan the construction sequence.

Planning Prompt Patterns:

  • Task Decomposition: "Before solving, break this into numbered sub-tasks. For each sub-task, specify what input it needs and what output it produces."
  • Dependency Mapping: "Identify which sub-tasks depend on others. Which can run in parallel?"
  • Resource Estimation: "For each sub-task, estimate the complexity and what tools or information you will need."
  • Milestone Setting: "Define checkpoints where you will verify progress before continuing."

Example - Wedding Planning Agent:

User: "Plan a budget wedding in Delhi for 200 guests under 10 lakhs"

Agent Plan:
1. Budget Allocation (no dependencies)
   - Venue: 3L, Food: 3L, Decor: 1.5L, Photography: 1L, Misc: 1.5L
2. Venue Research (needs: budget from step 1)
   - Search venues in Delhi within 3L budget
3. Vendor Shortlisting (needs: venue from step 2)
   - Caterers, decorators, photographers near venue
4. Menu Planning (needs: budget, guest count)
   - 200 guests x Rs 1,500 per plate
5. Timeline Creation (needs: all above)
   - Week-by-week checklist
6. Review and Optimize (needs: complete plan)
   - Check total against budget, adjust if needed

Note: Research shows that asking an LLM to plan before executing improves task completion rates by 25-40% on complex multi-step tasks.

Reflection - Self-Evaluation and Course Correction

The Power of Asking AI to Check Its Own Work

What is Reflection?

Reflection is instructing the LLM to evaluate its own output, identify issues, and improve before presenting the final answer. It is like telling a student "Write your essay, then re-read it and fix any mistakes before submitting."

Without reflection, LLMs are like students who submit their first draft. With reflection, they revise and produce significantly better work.

Reflection Patterns:

  • Self-Critique: "Review your answer. What are 3 potential issues or inaccuracies? Fix them."
  • Rubric-Based: "Grade your answer on: accuracy (1-5), completeness (1-5), clarity (1-5). If any score is below 4, improve it."
  • Devil's Advocate: "Argue against your own answer. What would someone who disagrees say? Now address those counterarguments."
  • Perspective Shift: "Re-read your answer as if you are the target audience. Is it clear? Is anything confusing?"

Reflexion Framework (Research Paper):

Reflexion adds a memory component to reflection. After each attempt, the agent writes a reflection note (what went wrong, what to do differently). On the next attempt, it reads its own past reflections to avoid repeating mistakes.

Like a cricketer watching video replays of their dismissals. Each time they bat, they remember past mistakes and adjust their technique.

When Reflection Helps vs Hurts:

HelpsHurts
Complex reasoning tasksSimple factual lookups
Creative writing and editingWhen speed matters more than quality
Code generation and debuggingHighly constrained outputs (e.g., yes/no)
Multi-step problem solvingWhen the model is already confident

Note: Reflection can improve output quality by 15-30% with just one extra pass. But diminishing returns kick in fast - more than 2 reflection rounds rarely helps.

Tool Use - Knowing When Internal Knowledge Is Not Enough

The Art of Deciding When to Use External Tools

Tool Use in Agentic Prompting:

The most powerful agentic capability is knowing when to stop relying on internal knowledge and reach for an external tool instead. This prevents hallucination and grounds the agent in real data.

Like a doctor who knows when to order a blood test instead of guessing the diagnosis. The skill is not in using the tool - it is in knowing WHEN to use it.

Teaching Tool Awareness Through Prompting:

  • Capability Boundary: "If you are not sure about current data, prices, or recent events, use the search tool. Do not guess."
  • Tool Selection Logic: "For math calculations, use the calculator. For code execution, use the code runner. For factual queries, use web search."
  • Confidence Threshold: "If your confidence in the answer is below 80%, use a tool to verify before responding."
  • Parallel Tool Use: "If multiple independent pieces of information are needed, request all tool calls at once."

Tool Use Decision Tree:

Question arrives ->
  Is this about current/real-time data?
    YES -> Use search/API tool
    NO -> Is this a calculation?
      YES -> Use calculator/code tool
      NO -> Am I confident in my knowledge?
        YES (90%+) -> Answer directly
        NO -> Use search to verify
        PARTIALLY -> Answer + flag uncertainty

Common Tool Categories:

CategoryToolsWhen to Use
InformationWeb search, RAG, DB queryCurrent data, specific facts
ComputationCalculator, code interpreterMath, data processing
ActionEmail, API calls, file opsSide effects needed
VerificationFact-checker, validatorHigh-stakes outputs

Note: The best agents are not the ones that use the most tools. They are the ones that use tools precisely when needed and avoid unnecessary tool calls that waste time and tokens.

Putting It All Together - Complete Agentic Prompt

A Full Agentic System Prompt Blueprint

The Complete Agentic System Prompt Structure:

  • Role: Define who the agent is and its expertise area
  • Planning Instructions: How to break down tasks, when to plan vs act immediately
  • Tool Descriptions: Available tools with clear usage criteria
  • Reflection Rules: When to self-check, quality criteria, max reflection rounds
  • Output Format: How to structure the final response
  • Guardrails: What the agent must NOT do, safety boundaries

Example - E-Commerce Research Agent Prompt:

You are a product research agent for Indian e-commerce.

PLANNING:
- For any product comparison, first list all products to compare
- Identify what attributes to compare (price, specs, reviews)
- Plan which tools to call for each product

TOOLS:
- search(query): Search the web for product info
- price_check(product, platform): Get current price
- reviews(product): Get aggregated review scores

REFLECTION:
- After gathering all data, verify completeness
- Check if any critical attribute is missing
- Ensure prices are current (not cached/old)

OUTPUT:
- Comparison table with all attributes
- Clear recommendation with reasoning
- Mention any caveats or uncertainties

Inner Monologue Pattern:

One powerful technique is the inner monologue - instructing the agent to think out loud in a structured format before acting. This makes the agent's reasoning transparent and debuggable.

For each step, think in this format:
THINKING: What do I need to do next and why?
DECISION: Should I use a tool or respond directly?
ACTION: [tool call or direct response]
OBSERVATION: What did I learn from this?
REFLECTION: Is the quality good enough? Any issues?

Note: Agentic prompts should be tested extensively. Small changes in wording can significantly affect how the agent plans, reflects, and uses tools. Always benchmark against a test set.

Interview Questions - Agentic Prompting

Q: What are the three pillars of agentic prompting?

Planning (breaking goals into sub-tasks), Reflection (self-evaluating and correcting output), and Tool Use (knowing when to use external tools vs internal knowledge). Together, these three capabilities transform a passive text generator into an autonomous problem solver.

Q: How does Reflexion differ from simple self-critique?

Simple self-critique evaluates the current output in isolation. Reflexion adds a memory component - it writes reflection notes after each attempt (what went wrong, what to do differently) and reads past reflections on future attempts. This allows the agent to learn from mistakes across attempts, similar to episodic memory in humans.

Q: When should an agent use a tool vs answer from its own knowledge?

Use tools when: (1) The question involves real-time or current data. (2) Precise calculations are needed. (3) The model's confidence is low. (4) The task requires side effects (sending email, updating DB). Answer directly when: the question is about well-established concepts, the model is highly confident, and speed is more important than perfect accuracy.

Q: What is the Inner Monologue pattern in agentic prompting?

The Inner Monologue pattern instructs the agent to think out loud in a structured format (Thinking -> Decision -> Action -> Observation -> Reflection) before responding. This makes the agent's reasoning transparent, debuggable, and more reliable. It is essentially Chain-of-Thought combined with structured decision-making.

Q: How many reflection rounds should an agent do?

Typically 1-2 reflection rounds are optimal. Research shows that one reflection pass can improve quality by 15-30%, but diminishing returns set in quickly. After 2 rounds, improvements are marginal while latency and cost double. For production systems, 1 round with a quality threshold (only reflect if confidence is below X) is the most practical approach.

Frequently Asked Questions

What is Agentic Prompting?

Learn the prompting patterns that transform a passive LLM into an active agent - planning multi-step tasks, reflecting on its own output, and deciding when and how to use external tools.

How does Agentic Prompting work?

Turning a Passive LLM Into an Active Agent Through Prompting Simple Definition: Agentic prompting is a set of techniques that instruct an LLM to behave like an autonomous agent - breaking down tasks into steps, reflecting on its own reasoning, using tools when needed, and iterating until the task is complete. Instead…

Browse all AI & Automation topics →

Practice this on DevInterviewMaster

Read the full Agentic Prompting (Planning, Reflection, Tool Use) breakdown with interactive demos, quizzes, and Hinglish notes.

Open the interactive topic →

800+ system-design, LLD, coding, and design-pattern topics. Unlock everything with Pro (₹499, one-time) or Ultimate (₹999, one-time) — lifetime access, no subscription.