0
0
Agentic AIml~20 mins

Plan-and-execute pattern in Agentic AI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Plan-and-Execute Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the Plan-and-Execute Pattern

In the plan-and-execute pattern, an AI agent first creates a plan and then executes it step-by-step. Which of the following best describes the main advantage of this pattern?

AIt allows the agent to adapt its plan dynamically after each step without a fixed sequence.
BIt guarantees the agent will always find the optimal solution without errors.
CIt requires less computation because the agent skips planning and acts randomly.
DIt separates decision-making from action, enabling clearer control and debugging of each phase.
Attempts:
2 left
💡 Hint

Think about how separating planning and execution helps in understanding and controlling the agent's behavior.

Predict Output
intermediate
2:00remaining
Output of a Simple Plan-and-Execute Agent

Consider this simplified Python code of a plan-and-execute agent. What will be printed when running it?

Agentic AI
class Agent:
    def plan(self):
        return ['step1', 'step2', 'step3']

    def execute(self, plan):
        for step in plan:
            print(f'Executing {step}')

agent = Agent()
plan = agent.plan()
agent.execute(plan)
AExecuting step3\nExecuting step2\nExecuting step1
BExecuting step1\nExecuting step2\nExecuting step3
CNo output because execute method is not called
Dstep1\nstep2\nstep3
Attempts:
2 left
💡 Hint

Look at the execute method and how it prints each step.

Model Choice
advanced
2:00remaining
Choosing a Model for Plan Generation

You want to build an agent that uses the plan-and-execute pattern. Which model type is best suited for generating a detailed multi-step plan before execution?

AA sequence-to-sequence model that generates a list of steps as output.
BA simple linear regression model predicting a single output value.
CA clustering model that groups similar data points without outputting sequences.
DA k-nearest neighbors model that classifies inputs based on neighbors.
Attempts:
2 left
💡 Hint

Think about which model can produce ordered sequences as output.

Hyperparameter
advanced
2:00remaining
Hyperparameter Impact on Plan Quality

In a plan-and-execute agent using a neural network for planning, increasing which hyperparameter is most likely to improve the detail and length of generated plans?

AIncreasing the maximum output sequence length during training and inference.
BReducing the learning rate drastically to near zero.
CDecreasing the batch size to 1 for faster updates.
DUsing fewer hidden layers to simplify the model.
Attempts:
2 left
💡 Hint

Consider what controls how long the generated plans can be.

🔧 Debug
expert
2:00remaining
Debugging a Plan-and-Execute Agent Failure

An agent using the plan-and-execute pattern sometimes fails because the execution phase tries to run steps not in the plan. Which code mistake below causes this issue?

class Agent:
    def plan(self):
        return ['step1', 'step2']

    def execute(self, plan):
        for step in ['step1', 'step2', 'step3']:
            print(f'Executing {step}')

agent = Agent()
plan = agent.plan()
agent.execute(plan)
AThe execute method correctly uses the plan argument, so no error occurs.
BThe plan method returns an incomplete list missing 'step3'.
CThe execute method ignores the plan argument and uses a fixed list with an extra step.
DThe agent never calls the execute method, so no steps run.
Attempts:
2 left
💡 Hint

Look at what the execute method loops over compared to the plan.