How can an agent adapt its plan based on new observations?
An AI agent adapts its plan based on new observations by comparing fresh evidence with its current assumptions, then changing only the steps that are no longer appropriate. This is a practical form of closed-loop planning: act, observe, update the state, and decide what to do next.
Example: Generating API tests
An agent plans to generate and execute tests for an endpoint:
- Read the endpoint specification.
- Generate requests and expected assertions.
- Run the tests.
- Prepare a validated report.
During execution, the test runner returns 401 Unauthorized, revealing that the test environment requires an authentication token that the initial plan did not account for.
The agent should update its state and plan:
- Preserve the valid endpoint requirements and generated tests.
- Add a prerequisite to obtain an authorized test credential through the approved process.
- Check whether the credential has the necessary permissions.
- Rerun the affected tests when authentication is available.
- Block report publication until results are verified.
It should not classify every failing test as a product defect or invent credentials.
How does adaptation work?
- Observe: Collect new tool responses, user input, validation results, or environmental changes.
- Interpret: Distinguish verified facts from uncertain assumptions.
- Compare: Identify which original plan assumptions or prerequisites are no longer valid.
- Update state: Record new information and the status of completed or blocked steps.
- Revise the affected portion: Insert, remove, reorder, or replace future steps while retaining still-valid work.
- Revalidate and execute: Check the revised dependencies, permissions, and success criteria before continuing.
What observations should trigger adaptation?
- A tool returns unexpected but trustworthy data.
- A required resource becomes unavailable.
- A dependency fails or finishes with partial results.
- A user changes the goal or constraints.
- A deadline, budget, or permission changes.
- A validation check reveals an incorrect assumption.
Not every new observation needs a new plan. If it does not materially change the goal, constraints, or next safe action, the agent can continue with the existing plan.
How is this different from blindly retrying?
Retrying repeats an action, typically for a transient failure. Adapting changes the plan when evidence shows that the original approach or assumptions no longer fit.
For example, retrying a request with the same missing authentication may accomplish nothing; adding an authorized authentication step addresses the real prerequisite.
What makes adaptation safe?
- Trust validated tool outputs over unsupported model guesses.
- Keep an auditable record of why the plan changed.
- Limit replanning loops and unnecessary tool calls.
- Recheck authorization before consequential actions.
- Do not assume an external side effect can be undone; verify its status before retrying.
- Ask for clarification or stop when no valid route remains.
In short
Adaptive planning helps an agent respond to the world as it is, rather than following an outdated script. The agent incorporates new observations, revises affected steps, preserves successful work, and checks that the updated plan remains safe and achievable.
Learning Sequence
AI Agents Curriculum
Explore Related Questions
Deepen your understanding across related AI Agents topics.