Agentic AI Engineering · Module 05 of 16

Planning & Execution

A plan is a task artifact the application can inspect and update: what should happen, what has completed, what is blocked and what evidence changed the next step. It is not a request to expose a model's hidden chain-of-thought.

Engineering focus: Explicit plans, execution state and evidence-driven replanning

In plain English

What problem are we solving?

A plan is a task artifact the application can inspect and update: what should happen, what has completed, what is blocked and what evidence changed the next step. It is not a request to expose a model's hidden chain-of-thought.

Framework names come later. First understand what the application is doing and where its control boundaries belong.

Running case · Operations Investigator

Across the course, imagine an assistant that investigates operational problems using narrow tools. The design progressively adds plans, specialist agents, approvals, reliability controls and MCP while keeping model output separate from execution authority.

Learning objectives

By the end of this module, you should be able to:

  • Represent a plan as explicit application state rather than hidden reasoning.
  • Separate planning from execution so every action can be validated before it runs.
  • Replan from observed evidence while keeping step and budget limits.

A useful plan is observable task state

Store concise steps, dependencies, status and success criteria that the application can inspect. Avoid designs that depend on collecting or displaying a model's private chain-of-thought. The engineering artifact is the plan, not hidden reasoning.

  • step: check service health
  • status: pending / running / complete / blocked
  • evidence: tool result or validated fact
  • success condition: what proves this step is done

Planning and execution are separate control points

The planner can propose the next safe step, but an executor still validates tool name, arguments, authorization and policy. A good plan does not bypass the execution boundary learned in Module 03.

Plans change when evidence changes

A plan made before any tool runs is provisional. If the service is healthy but upstream latency is high, the next diagnostic step should change. Replanning should be triggered by new evidence, not by an unbounded urge to keep exploring.

Bound the work

Set maximum steps, tool-call budgets, time limits and explicit completion criteria. A plan that can grow forever is only an infinite loop written as a checklist.

Worked examples

A visible incident plan

plan = [
  {"step": "check_service", "status": "pending"},
  {"step": "inspect_recent_logs", "status": "pending"},
  {"step": "summarize_evidence", "status": "pending"}
]
  • The application can persist and audit this plan.
  • Each step is small enough to validate before execution.

Evidence changes the next step

service = healthy
latency = high

old next step: restart service
new next step: inspect upstream dependency
  • Replanning is based on observed facts.
  • A restart is not justified merely because it appeared in an earlier plan.
Try it · core lab · account-free

Execute and revise an explicit plan

Goal: Watch a small investigation plan advance, record evidence, and insert a new step only when an observation justifies it.

Before you start

  • Python 3 only. The lab uses deterministic fixtures; no model or API key is required.
STEP 1

Run the planner/executor simulation

python3 public/labs/agentic-ai/05_planning_and_execution.py
STEP 2

Watch the plan state change

Notice pending → complete transitions and the evidence attached to each completed step.

STEP 3

Observe evidence-driven replanning

A latency observation inserts an upstream dependency check instead of blindly restarting the service.

Verify

  • The plan terminates within the configured step budget.
  • The inserted step is justified by an observation and appears in explicit state.

Expected outcome

  • No hidden reasoning is required to understand what the application intends to do.
  • Execution remains bounded even after replanning.

Break / fix · diagnose

  • If steps repeat, check that completed steps are not selected again.
  • If the new step is never inserted, verify the evidence condition that triggers replanning.
Production view

Production planners should expose concise task state, dependencies and evidence while keeping model-internal reasoning private. Plans are useful because operators and policy engines can inspect them before actions occur.

Avoid these traps

Common mistakes

  • Treating a plan as permission to execute every proposed action.
  • Recording long hidden reasoning traces instead of concise task state.
  • Replanning on every turn even when no evidence changed.
  • Allowing the plan to grow without a maximum-step or budget boundary.
Knowledge check

Explain the control decision, not just the vocabulary.

Open every answer only after committing to your own answer. Opening all four answers records knowledge-check activity in My Learning.

1What should an application persist as the planning artifact?

Explicit steps, status, dependencies and evidence — the application needs observable task state, not a model's hidden chain-of-thought.

2A plan says restart nginx, but a later health check shows nginx is healthy. What should happen?

Replan from the new evidence — the earlier plan is provisional and should not override observed state.

3Does a planned tool call skip validation and authorization?

No — planning proposes work; execution still enforces the tool contract, policy and authorization boundary.

4Why set a maximum number of plan/execution steps?

To bound cost, latency and runaway loops — a plan must have operational limits and completion criteria.

My Learning

Record your progress for this module.

Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.

Not started

Attempt the core lab and knowledge checks before marking the module complete.