Overview

11 Agent planning and feedback

This chapter advances the book’s treatment of reasoning by putting planning at the center of agentic systems. It distinguishes simple chat interfaces from true agents that decompose a user goal, decide on ordered steps, act through tools, and return results. The text shows why planning matters—especially for multi-step, dependency-laden tasks—and notes that some commercial platforms increasingly hide this complexity by performing sequential plans under the hood. The chapter’s scope spans fundamentals, hands-on demonstrations, construction of a general planner, and the role of feedback as a critical but often overlooked ingredient.

Concretely, it contrasts raw LLM tool use—good for parallel, independent actions—with agents that can execute sequential plans. Using Nexus and OpenAI Assistants as running examples, it illustrates how disabling planning strands an LLM after the first tool call, whereas enabling a planner achieves the end-to-end goal. The chapter then builds a generic, prompt-driven sequential planner that emits compact JSON task lists (including a for-each iterator), executes them locally, tracks outputs in a shared context, and finally asks the LLM to summarize results. Executing plans outside the model reduces token and tool overhead and works even when the LLM lacks native planning, though it introduces safety, tool-limit, and alignment considerations and requires selecting only the minimal actions needed.

Beyond planning, the chapter elevates feedback and evaluation as pillars alongside reasoning. It reviews OpenAI’s Strawberry (o1-preview) as a step toward models that integrate planning, reasoning, and self-critique, while showing that even such models can err and still benefit from guided feedback prompts. Practical guidance maps where to locate planning, reasoning, evaluation, and feedback across applications—personal assistants, customer service, autonomous agents, collaborative workflows, game AI, and research—balancing latency against depth of thought and deciding what to keep inside the LLM versus externally monitored. The chapter closes with exercises on building planners, adding feedback loops and error handling, and comparing parallel versus sequential execution, and it looks ahead to tighter model-level integration of these components.

The agent planning process
Creating a new agent in Nexus
Selecting the actions for the agent and disabling the planner
The results from trying to get the agent/LLM to complete the goal
The difference between iterative and planned execution
The assistant processing the goal and outputting the results
The planning process for creating and executing a plan
The results from requesting to complete the goal in Nexus using the basic planner
The time travel problem, revisited

Summary

  • Planning is central to agents and assistants, allowing them to take a goal, break it into steps, and execute it. Without planning, agents are reduced to simple chatbot-like interactions.
  • Agents must differentiate between parallel and sequential actions. Many LLMs can handle parallel actions, but only advanced models support sequential planning, critical for complex task completion.
  • Feedback is crucial in guiding agents to correct their course and improve performance over time. This chapter demonstrates how feedback mechanisms can be integrated with agents to refine their decision-making processes.
  • Platforms like OpenAI Assistants and Anthropic Claude support internal planning and can execute complex, multi-step tasks. Agents using these platforms can leverage sequential action planning for sophisticated workflows.
  • The proper selection and limitation of agent actions are vital to avoid confusion and unintended behavior. Too many actions may overwhelm an agent, while unnecessary tools may be misused.
  • Nexus allows for creating and managing agents through a flexible interface, where users can implement custom planners, set goals, and assign tools. The chapter includes practical examples using Nexus to highlight the difference between a raw LLM and a planner-enhanced agent.
  • Writing custom planners is straightforward, utilizing prompt engineering strategies. Tools like LangChain and Semantic Kernel offer a variety of planners that can be adapted or extended to fit specific agentic needs.
  • Models like OpenAI Strawberry integrate reasoning, planning, evaluation, and feedback directly into the LLM, offering more accurate problem-solving capabilities.
  • Evaluation helps determine how well an agentic system is performing and can be implemented internally or externally, depending on the use case.
  • As LLMs evolve, reasoning, planning, and feedback mechanisms may become deeply integrated into models, paving the way for more autonomous and intelligent agent systems.

FAQ

What does “planning” mean in LLM agents, and why is it essential?Planning is the process of breaking a user goal into ordered subtasks mapped to available tools/actions, executing them, and returning a consolidated result. It’s what turns a chatbot into an agent that can take a goal, decide how to solve it, carry out the steps, and report back.
How do sequential planning and parallel tool use differ?- Parallel: independent actions can run without depending on prior outputs; many raw LLM tool APIs support this only.
- Sequential: later steps depend on earlier results; assistants like Anthropic Claude and OpenAI Assistants can plan and execute sequences.
Why did the raw LLM in Nexus fail the Wikipedia goal while an OpenAI Assistant succeeded?With the planner disabled, the Nexus agent could call search_wikipedia but couldn’t chain follow-up steps. The OpenAI Assistant planned the full sequence (search → get pages → save file), executed it, and even summarized content, returning the final output automatically.
How do I implement a basic sequential planner like the BasicNexusPlanner?- Build a planning prompt that lists SPECIAL/AVAILABLE FUNCTIONS and the GOAL.
- Instruct the LLM to output a compact JSON plan (subtasks only using allowed functions, e.g., for-each).
- Parse the JSON and execute tasks locally.
- Send final context back to the LLM for summarization.
How does plan execution pass information between steps?The executor runs subtasks in order, storing outputs in a shared context (e.g., keys like output_FunctionName). A special for-each step iterates a list (e.g., output_GetList) and aggregates results (for-each_list). Each function receives the current context so later steps can consume earlier outputs.
Why execute plans outside the LLM instead of inside the model?- Pros: fewer tokens, arbitrary code/tooling, works even with models that lack tool use.
- Cons: bypasses built-in planner feedback loops, may limit models that already plan internally (e.g., Claude), and shifts responsibility for error handling/safety to your runtime.
How do feedback and evaluation improve agent planning?Evaluation checks success; feedback guides corrections. A practical technique: after a wrong answer, provide the correct answer and ask the model to self-critique and propose guidelines for future attempts. Persist the distilled feedback in system prompts or planner instructions to improve subsequent runs.
What is OpenAI Strawberry (o1-preview), and what changes with it?Strawberry integrates reasoning, planning, evaluation, and feedback within the model, improving stepwise problem solving. It still makes mistakes, so external evaluation and explicit feedback remain valuable, especially for ambiguous or assumption-heavy tasks.
What are best practices and safety tips for configuring agent tools/actions?- Provide only the tools needed for the goal to reduce confusion and risks.
- Mind API limits on number of tools.
- Sandbox and guardrail risky actions (FS/network), add rate limits and confirmations.
- Monitor runs; agents may misuse tools or loop unexpectedly.
When should I apply planning, reasoning, evaluation, and feedback across applications?- Personal assistants: planning/reasoning in-model; keep latency low.
- Customer service bots: minimal planning/reasoning; strong external evaluation/feedback.
- Autonomous agents: robust planning + selective reasoning; internal/external evaluation and periodic feedback.
- Collaborative workflows: planning aids multi-step tasks; use lightweight reasoning; user-in-the-loop feedback.
- Game AI: fast, shallow reasoning; evaluate/feedback for strategy tuning.
- Research: heavy planning/reasoning; largely external evaluation and feedback post-run.