In Part 1, we asked a fundamental question:
How does an AI agent decide what to do next?
We looked at states, actions, probability, cost and expected utility.
But choosing the next action is only the beginning.
Because sometimes an action that looks excellent right now may lead to a poor outcome later.
And sometimes a slightly less attractive action opens the door to a much better result.
So the question changes.
It is no longer simply:
“What should I do next?”
It becomes:
“Where will this decision take me?”
That is the beginning of planning.
And once again, mathematics gives us a powerful way to understand what is happening.
One Good Decision Is Not Enough
Imagine an AI travel agent.
Its goal is to get a traveller from Chennai to Toronto for an important Monday morning meeting.
It finds two options.
Flight A
- Cheaper
- Shorter total travel time
- Very tight connection
Flight B
- More expensive
- Slightly longer
- Safer connection and a much better chance of arriving on time
If the agent looks only at the next immediate choice, Flight A may seem better.
But if it thinks about the entire journey, Flight B may be the smarter decision.
This is the difference between:
Choosing an action
and
Planning a sequence of actions.
An agent that plans has to think beyond the next step.
From a Single Action to a Path
Suppose an agent starts at state A and wants to reach goal G.
There may be several possible routes.
For example:
Path 1
A -> B -> D -> G
Path 2
A -> C -> E -> G
Each step may have a different:
- Cost
- Time
- Probability of success
- Risk
- Reward
Now the agent is no longer choosing between two isolated actions.
It is comparing paths.
We can represent the total cost of a path as:
Cost(Path) = Sum of the cost of each step
Suppose:
Path 1
- A -> B = 2
- B -> D = 3
- D -> G = 2
Then:
Total Cost = 2 + 3 + 2 = 7
Now suppose:
Path 2
- A -> C = 4
- C -> E = 2
- E -> G = 2
Then:
Total Cost = 4 + 2 + 2 = 8
If cost were the only consideration:
Path 1 wins.
But what if Path 1 has a high probability of failure at B -> D?
Suddenly the cheapest route may no longer be the best route.
This is why planning becomes more interesting than simply finding the shortest path.
Graphs: A Mathematical Picture of Planning
One way to represent these possibilities is using a graph.
In graph theory:
- A node represents a state
- An edge represents a possible action
- A path represents a sequence of actions
Think of Google Maps.
Your current location is one node.
Every intersection creates new possibilities.
One road may be shorter.
Another may have less traffic.
Another may have a toll.
Another may be temporarily blocked.
The goal is not necessarily:
Find the shortest road.
It may actually be:
Find the best path given the current conditions.
An AI agent faces a similar challenge.
A research agent may have paths such as:
Search -> Read -> Verify -> Answer
or
Search -> Compare -> Search Again -> Verify -> Answer
or
Search -> Ask User -> Search Again -> Answer
Each route reaches the same general goal.
But the cost, quality and reliability of each route may differ.
Modern agent systems are specifically designed for multi-step work involving planning, tool calls and maintaining state across a workflow.
Optimization: Which Path Is Best?
Now suppose an agent has ten possible paths.
How should it compare them?
This becomes an optimization problem.
A simplified objective might be:
Best Path = Highest Benefit - Cost - Risk
Or mathematically:
P = arg max [B(p) - lambda C(p) - mu R(p)]*
where:
- B(p) = benefit of path p
- C(p) = cost
- R(p) = risk
- lambda = importance attached to cost
- mu = importance attached to risk
This equation tells us something important.
The best path depends on what we care about.
Imagine a delivery agent.
If speed matters most, the weighting on time may be high.
Imagine a medical-support agent.
If the cost of a wrong decision is serious, the weighting on risk may be much higher.
So optimization is not only about finding a solution.
It is about finding the best solution according to the objective we define.
And defining that objective correctly is often the harder problem.
Immediate Reward vs Long-Term Value
Now we reach one of the most interesting ideas.
Suppose an agent has two actions.
Action A
Immediate reward = 8
Action B
Immediate reward = 4
Which should it choose?
At first:
Action A looks obvious.
But imagine what happens next.
Action A gives a reward of 8 but leads to a state with almost no useful future possibilities.
Action B gives only 4 immediately but leads to a state where the agent can later gain another 10.
Now the picture changes.
Action A
- Immediate value: 8
- Possible future value: 1
Action B
- Immediate value: 4
- Possible future value: 10
Suddenly:
The smaller reward now may create the larger reward later.
This is why intelligent planning cannot always be greedy.
A greedy decision simply chooses what looks best at the current moment.
Planning asks:
“What happens after that?”
A Little More Mathematics: Future Rewards
Reinforcement Learning gives us a mathematical way to think about this problem.
A simplified relationship is:
Q(s,a) = r + gamma max Q(s’,a’)
where:
- s = current state
- a = action
- r = immediate reward
- s’ = next state
- gamma = discount factor
The important new idea is gamma.
It controls how much the agent cares about future rewards.
Suppose:
- Immediate reward: r = 4
- Best future value: 10
- gamma = 0.9
Then:
Q = 4 + (0.9 x 10)
Q = 4 + 9
Q = 13
So although the immediate reward was only 4, the action may have a total estimated value of 13 because of what it makes possible later.
This idea sits at the heart of reinforcement learning: actions can be evaluated not just by their immediate consequence, but by their contribution to longer-term reward.
How Far Into the Future Should the Agent Think?
There is another interesting question.
Should future rewards matter equally to immediate rewards?
Imagine:
Option A
Receive 1,000 today.
Option B
Receive 1,000 ten years from now.
Most people would not treat these as identical.
Time matters.
Uncertainty increases.
That is one reason reinforcement learning uses a discount factor:
0 <= gamma <= 1
If gamma is close to 0, the agent cares mainly about immediate rewards.
If gamma is close to 1, future rewards matter much more.
For example:
If gamma = 0.5 and the future reward is 10, then its discounted value is:
0.5 x 10 = 5
But if gamma = 0.9, then:
0.9 x 10 = 9
The same future reward now has much greater influence on today’s decision.
So gamma represents something surprisingly intuitive:
How much should the future matter?
Planning Is About More Than Rewards
But there is a danger here.
Suppose we tell an AI agent:
“Complete this task in as few steps as possible.”
The agent may become extremely efficient.
But perhaps it skips verification.
Now suppose we say:
“Make the answer as accurate as possible.”
The agent may search indefinitely.
Now suppose we say:
“Use as few resources as possible.”
It may avoid tools that would improve the result.
The agent is optimizing exactly what we asked for.
But perhaps we asked for the wrong thing.
This leads to an important principle:
A system can optimize a mathematical objective perfectly and still produce an undesirable result.
The mathematics may be correct.
The objective may be wrong.
This is one reason goal design matters so much.
Research on AI systems has repeatedly examined situations where learned capabilities succeed while the resulting goal-directed behaviour does not align with what was intended.
Think About a Student
There is a simple human analogy.
Suppose we tell a student:
“Your goal is to maximize your examination score.”
The student may optimize for:
- Memorization
- Past-paper patterns
- Short-term recall
- Examination tricks
They may get a high score.
But did they achieve:
Deep understanding?
Not necessarily.
Now suppose the objective becomes:
“Understand the concepts well enough to solve unfamiliar problems.”
The learning strategy may change completely.
The objective influences the behaviour.
It is the same with an AI agent.
What we reward influences what the system learns to value.
Planning Under Constraints
The agent also cannot choose any path it wants.
There may be constraints.
Imagine an AI travel agent.
Its objective is:
Minimize travel time.
But it must satisfy:
- Cost <= 1,00,000
- Connections <= 1
- Arrival before 8 AM Monday
- No booking without human approval
So mathematically, we have:
Minimize Travel Time
subject to:
- Price <= Budget
- Connections <= 1
- Arrival <= Deadline
This is called constrained optimization.
And it is extremely important for agentic AI.
The question is not simply:
“What is the best possible action?”
It is:
“What is the best acceptable action?”
Those are not the same thing.
Can an Agent Plan Perfectly?
Usually, no.
Why?
Because the agent rarely knows everything.
Imagine planning the perfect route when:
- Traffic may change
- A flight may be delayed
- A website may become unavailable
- A tool may fail
- New information may appear
So planning often happens under uncertainty.
An agent may build a plan.
Take one action.
Observe what happened.
Then revise the plan.
The cycle becomes:
Plan -> Act -> Observe -> Re-plan
This is important.
A good plan is not necessarily a rigid sequence that must be followed regardless of what happens.
Sometimes the smartest plan is one that can change.
A Simple Example: The Research Agent
Suppose an AI research agent wants to answer:
“Is Product X suitable for a particular application?”
It could follow:
Path A
Search -> Find one source -> Answer
Very fast.
Very cheap.
But potentially unreliable.
Or:
Path B
Search -> Read official source -> Find independent evidence -> Compare -> Answer
Slower.
More expensive.
But potentially stronger.
Or:
Path C
Search -> Read ten sources -> Compare everything -> Search again -> Verify repeatedly -> Answer
Extremely thorough.
But perhaps unnecessarily expensive.
There is no obvious winner.
The agent has to balance:
- Quality
- Cost
- Time
- Risk
- Expected improvement
Planning means finding a sequence of actions that produces an acceptable balance.
So What Does Planning Add to Intelligence?
Part 1 showed us that an agent needs to choose an action.
Part 2 adds another layer.
A good agent should also consider:
- Where might that action lead?
- What opportunities will it create?
- What possibilities will it remove?
- What future rewards might follow?
- What risks appear later in the path?
This is the difference between:
Reacting
and
Planning.
And it reveals something important about Agentic AI.
The best next action is not necessarily the action with:
- The highest immediate reward
- The lowest immediate cost
- The shortest immediate path
Sometimes the smarter decision is an action that looks slightly worse now because it leads to a much better position later.
The Mathematics Behind Planning
We can summarize Part 2 through four mathematical ideas.
Graph Theory
What paths are available?
Optimization
Which path best satisfies the objective?
Discounted Reward
How much should future outcomes influence today’s decision?
Constraints
Which solutions are actually allowed?
Together they help us move from:
“What should I do next?”
to:
“What sequence of decisions is most likely to take me where I want to go?”
That is the mathematics of planning.
AI Agents Can Act. But Can They Plan?
Yes, but planning is much harder than simply choosing the next action.
A useful plan requires the agent to reason about:
- Paths
- Costs
- Rewards
- Future consequences
- Constraints
- Uncertainty
And sometimes it must change its plan when the world does not behave as expected.
That brings us to one final problem.
Suppose the agent has already planned.
It has already searched.
It has already tried several strategies.
How does it know when it has done enough?
Should it search once more?
Try another path?
Gather more evidence?
Or stop?
That is where Part 3 begins.
Coming in Part 3
AI Agents Can Act. But Do They Know When to Stop?
In Part 3, we will explore:
- Uncertainty and confidence
- Exploration vs exploitation
- Diminishing returns
- Optimal stopping
- When an agent should ask a human
- Why knowing when not to act may be a sign of better intelligence
Because intelligence is not only about choosing an action.
It is not even only about planning several actions ahead.
Sometimes the most important decision is:
“Do I have enough information to stop?”