“Everyone has a plan 'till they get punched in the mouth.” - Mike Tyson
Agents operate with a soft plan for execution, but that plan isn’t set in stone—it’s subject to change based on predetermined constraints. Flexibility is key, as agents must adapt to new information, unexpected obstacles, or shifting goals. How and when these plans are created, the data they rely on, and how they handle exceptions all shape their effectiveness.
An agent’s plan can originate at different stages, depending on its purpose and complexity:
Design Time (By the Programmer)
At design time, the programmer crafts a predefined plan baked into the agent’s structure. This is common for single-purpose or role-oriented agents where tasks are predictable. For example, a programmer might hardcode a customer support agent to follow a script: greet the user, categorize their issue, then escalate or resolve it. The plan is rigid, with constraints like “escalate if issue exceeds 5 minutes” set upfront. Adjustments are limited to what the programmer foresaw.
Runtime (By the Agent/LLM)
At runtime, the agent—often powered by an LLM—generates or modifies its plan dynamically based on the situation. This suits general-purpose or adaptive agents facing unpredictable tasks. For instance, a personal assistant agent might decide on the fly to book a flight, then adjust to include a hotel when the user mentions a multi-day trip. Constraints (e.g., “stay within budget”) guide these adjustments, but the agent has leeway to improvise.
Many agents blend both approaches, juggling multiple smaller plans—or “mini-plans”—where each leans toward design time or runtime creation. A travel agent, for example, might have a design-time mini-plan for collecting basic trip details (departure, destination, dates) but a runtime mini-plan for optimizing flight options based on real-time prices. This modular approach keeps agents focused while allowing adaptability where it matters.
Plans don’t exist in a vacuum—agents need data to execute tasks effectively. The quality, timing, and source of that data shape both the plan and its adjustments. Take a travel agent: it requires specifics like where you’re flying from, your destination, travel dates, and preferences (e.g., budget, nonstop flights). Part of the agent’s planning involves figuring out how and when to gather this info.
Proactive Data Collection
The agent might prompt the user upfront: “Where are you flying from, and when?” A design-time plan could dictate asking all key questions in sequence, ensuring nothing’s missed. A runtime plan might start with minimal input (“Tell me about your trip”) and infer the rest, asking follow-ups as needed.
Reactive Data Use
As data arrives—whether from the user, APIs, or sensors—the agent refines its plan. If a user says, “I need to be in New York by Friday,” the agent might adjust its mini-plan to prioritize flights over trains, pulling live schedules to confirm availability.
Planning for data isn’t just about execution; it’s about anticipating gaps. A smart agent builds contingencies—like asking for a backup date if flights are full—into its soft plan, whether set at design time or runtime.
Exceptions are inevitable: flights get canceled, APIs fail, users change their minds. When the plan hits a snag, agents lean on their flexibility to try new options within constraints.
Detecting Exceptions
Agents monitor execution against expected outcomes. A design-time plan might flag an exception explicitly (e.g., “if no flights found, notify user”). A runtime plan might deduce it implicitly (e.g., “no results after 3 API calls means something’s wrong”). Evaluators—predefined or learned—help spot when the plan’s failing.
Adjusting with New Options
Once an exception occurs, the agent explores alternatives. For a travel agent, if no flights match the user’s budget, it might:
These adjustments often follow “try again” logic, where the agent iterates through options—guided by constraints like time, cost, or user preferences—until it succeeds or exhausts possibilities. A runtime-driven agent might even generate creative solutions, like splitting a trip across multiple carriers, if the original plan flops.
Learning from Exceptions
Over time, exceptions refine the agent’s approach. A travel agent that repeatedly hits “no flights available” might adjust its design-time plan to ask for flexible dates upfront or tweak its runtime logic to prioritize broader searches.