Insights Videos Blog Learning
PROMPT ENGINEERING

Part 3.3: Agent-like Behavior

Learn how to simulate intelligent agent behavior using prompt techniques. This post covers ReAct, Reflexion, and emerging strategies like DERA and ReWOO — helping LLMs reason, act, adapt, and retry like human assistants.

Large Language Models are powerful — but by default, they’re reactive. They wait for a prompt, generate a response, and stop. But what if they could act on information, revise mistakes, or decide the next step — like a support agent or an AI assistant?

This is where agent-like prompting comes in: a set of advanced patterns that make LLMs behave more like interactive problem solvers than passive responders. These patterns are especially powerful for complex workflows, task automation, and customer-facing assistants in platforms like Webex, Genesys, NICE, and Twilio.

In this post, you’ll learn how to design prompts that support:

  • ReAct (Reason + Act) – prompting the model to think, then call a tool or function, then reason again
  • Reflexion – having the model critique its prior response and generate a better plan
  • DERA and ReWOO – advanced prompting patterns from research labs that enable multi-step planning without user re-prompting

These techniques unlock a new class of behavior in LLMs — enabling them to reason, act, observe, and adapt — all through prompt design alone. If you’re building anything beyond static Q&A — from guided chatflows to agent tools — this is where the real power begins.

Why Agent-like Prompting Matters

Most prompts are designed to extract a single answer. But real-world tasks are rarely that simple. In production systems — especially in contact center and enterprise settings — the model often needs to make decisions, call tools, handle ambiguity, or revise an earlier response.

That's where agent-like prompting shines. Instead of treating the model like a passive answer engine, you prompt it to behave like a decision-making agent — capable of thinking through a task, taking action (via tools), and adapting based on what happens.

This shift is critical for complex LLM use cases like:

  • Automated assistants that must interact with customer records, calendars, or APIs
  • Internal support copilots that troubleshoot issues and escalate only when needed
  • Multi-step tasks like classification → explanation → routing
  • Follow-up or fallback behaviors (e.g., rephrasing when misunderstood)

Without these capabilities, LLMs remain brittle. But with the right prompting strategies, you can design agents that reason, observe, retry, and adapt — all using the same models and interfaces you already have.

ReAct (Reason + Act)

The ReAct prompting pattern enables LLMs to both reason and take action — a foundational approach for agent-like behavior. Instead of generating a final answer all at once, the model alternates between internal reasoning and tool-based actions, responding dynamically to new observations.

What It Is:

A prompt format where the model produces a Thought (its internal reasoning), then an Action (like calling a tool), then processes the Observation (the tool’s response). This loop can repeat until the model reaches a conclusion.

Why It Works:

ReAct gives the model space to think before doing. Instead of jumping to a final output, it explores intermediate reasoning and takes external steps — just like a human assistant would. This improves transparency, flexibility, and accuracy.

Prompt Format:

Thought: [Model's internal reasoning]
Action: [Tool_Name(input)]
Observation: [Tool's output]
... (loop) ...
Final Answer: [Conclusion]

Mini Example – CX Scenario:

Thought: The customer is asking about their last three support tickets. I need to check our ticketing system.
Action: getRecentTickets(customer_id="845392")
Observation: 3 tickets found from Feb 18, Feb 20, and Feb 23.
Thought: I should summarize these tickets and their status for the user.
Action: summarizeTickets(tickets)
Observation: Feb 18 – Closed. Feb 20 – In Progress. Feb 23 – Open.
Final Answer: Here are your last three tickets: one closed, one in progress, and one open.

When It Works Best:

  • Tasks that involve external data or tools (e.g., APIs, calculators, CRMs)
  • Workflows where intermediate reasoning is needed before taking action
  • Scenarios that require conditional branching or fallback behavior
Tip: ReAct requires you to define the available tools clearly. These can be functions, APIs, or database lookups — the prompt must include a description of how to use them.

Reflexion – Learn from Mistakes

Reflexion is a prompting technique where the model critiques its own earlier response and generates a better one. It’s inspired by how humans learn: try something, reflect on what didn’t work, and try again with a new plan.

What It Is:

A multi-step prompt that includes the model’s initial attempt, followed by a Reflection phase where it identifies flaws or gaps, and ends with a Revised Response that improves upon the original.

Why It Works:

LLMs are probabilistic — their first response might not be the best. By explicitly prompting for self-evaluation, we unlock a second layer of reasoning. This process taps into different parts of the model’s training and helps surface more accurate, structured, or complete answers.

Prompt Format:

Attempt 1: [Initial model response]
Reflection: [Model's critique of Attempt 1]
Revised Plan: [Optional – model outlines how to improve]
Attempt 2: [Improved response]

Mini Example – CX Scenario:

Attempt 1:
Hi John, thanks for reaching out. We’ll look into your issue and get back to you.

Reflection:
The message is too vague. It doesn't address the delay John experienced, or provide a clear next step.

Revised Plan:
Acknowledge the delay, apologize sincerely, and give a timeline for the next update.

Attempt 2:
Hi John, I’m sorry you’ve been waiting 3 days for a callback — that’s not the experience we aim to deliver. I’ve escalated your issue and you’ll hear back from our support lead within 2 hours.

When It Works Best:

  • When accuracy and tone matter (e.g., support, legal, healthcare)
  • For content generation that benefits from iterative improvement
  • To simulate “thinking twice” before delivering a final response
Tip: You can run this as a single prompt (using separators) or as multiple prompt passes. For high-stakes outputs, consider validating both reflection and the revised answer.

Specialized Agent Patterns – DERA and ReWOO

While ReAct and Reflexion provide foundational agentic patterns, more specialized prompting approaches are emerging from research. Two notable examples are DERA and ReWOO — both designed to improve how LLMs behave in dynamic, multi-turn environments.

What They Are:

DERA (Dialog-Enabled Resolving Agents) is a prompting framework that encourages the model to clarify ambiguity before taking action. It’s ideal for customer-facing systems where initial input may be vague or incomplete.

ReWOO (Reasoning Without Observation) focuses on reducing a model's dependency on immediate external observations. Instead, it reasons ahead, plans multiple steps, and only queries tools when essential. It’s useful when API calls or lookups are expensive or rate-limited.

Why Mention These?

These patterns show how advanced prompting is evolving toward more robust agents. They extend ReAct-style loops with specialized adaptations for uncertainty, tool latency, or noisy environments.

For engineers, they provide new inspiration: You might not replicate the full architecture, but you can adopt micro-patterns — like asking clarifying questions first (DERA), or batching multiple steps before execution (ReWOO).

When Useful:

  • In customer service systems where user input is often ambiguous or incomplete (DERA)
  • In contact center bots that need to plan before calling expensive APIs (ReWOO)
  • In agent workflows that must manage multiple steps and external constraints
Tip: Think of DERA and ReWOO as advanced ReAct variants — built for noisy, high-latency, or ambiguous environments. They're signs of where prompt-driven agents are heading.

When to Use Agent-like Prompting

Agent-like prompting isn’t for every use case — but it becomes essential when tasks require decision-making, tool usage, or multiple steps. These patterns help LLMs behave less like autocomplete engines and more like interactive assistants or planners.

Use Agent-like Prompting When:

  • The task requires multi-step decision-making.
    You need the model to reason before answering — not just generate the next most likely sentence.
  • The environment involves external tools.
    The model must call functions, query APIs, or fetch data (e.g., via Toolformer or internal lookups).
  • The interaction is dynamic or evolving.
    You’re building a CX assistant, chatbot, or copilot that reacts to changing customer input or system state.
  • The task needs reasoning, decisions, and follow-up actions.
    It’s not just about one answer — it’s about a plan with revisions, validations, or retries.

These conditions are common in production LLM systems: CX agents that escalate or rephrase, lead qualification bots, virtual assistants that search internal knowledge, and more. Whenever your LLM needs to do more than reply — it’s time to start thinking like an agent.

Tip: If your prompt needs both thinking and acting — think ReAct. If it also needs adaptation or revision — think Reflexion.

Callouts & Tips

  • Start with simple scaffolds. You don’t need full agent frameworks to get agent-like behavior — try a Thought → Action → Observation loop with 1-2 reasoning cycles.
  • Prompt Injection is a real risk. If your prompts allow dynamic tool calls or unvalidated inputs, make sure you sanitize inputs and validate outputs. Don’t blindly trust tool execution logic from the model.
  • Use system messages to stabilize behavior. Combine ReAct-style prompting with clear system-level instructions to define agent goals, tone, and tool capabilities.
  • ReAct ≠ tool use only. Use it for dynamic decisions even without tools — like choosing response strategies or routing logic in CX workflows.
  • Reflexion loops can get expensive. Every retry means more tokens. In production, use heuristics or confidence scores to determine when reflection is worth it.
  • Format output for parsing. If your agent produces multiple fields (e.g., “action,” “reason,” “observation”), consider JSON formatting to simplify downstream use.

What’s Next

Agent-like prompting is a powerful bridge between simple LLM tasks and full AI systems — but it’s just one part of the picture. In the final post of this module, we’ll explore how to build structured, tool-augmented workflows using:

  • Automatic Prompt Engineering (APE) – prompts that write prompts
  • PromptChainer – chaining steps together to complete complex goals
  • Toolformer-style planning – letting the model decide what tools to use, when
  • ART – combining multi-step reasoning with tool calls

These approaches unlock new levels of scale, structure, and automation for builders using LLMs in customer experience, developer tools, and more.

References

  1. Yao, S., et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. Retrieved from arXiv:2210.03629
  2. Shinn, N., et al. (2023). Reflexion: Language Agents with Verbal Reinforcement Learning. Retrieved from arXiv:2303.11366
  3. Paranjape, A., et al. (2023). DERA: Improving Instruction-Following in LLMs by Resolving Ambiguity. Retrieved from arXiv:2310.03751
  4. Yuan, K., et al. (2023). ReWOO: Reasoning Without Observation for Efficient Augmented Language Models. Retrieved from arXiv:2310.18619
  5. Amatriain, X. (2024). Prompt Design and Engineering: Introduction and Advanced Methods. Retrieved from arXiv:2401.14423
  6. Google. Prompt Engineering Guide (Whitepaper). Retrieved from Kaggle