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?
Think about how separating planning and execution helps in understanding and controlling the agent's behavior.
The plan-and-execute pattern divides the agent's work into two clear parts: first, making a plan, and second, carrying out that plan. This separation helps developers debug and improve each part independently.
Consider this simplified Python code of a plan-and-execute agent. What will be printed when running it?
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)
Look at the execute method and how it prints each step.
The execute method prints 'Executing ' followed by each step in the plan list in order.
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?
Think about which model can produce ordered sequences as output.
Sequence-to-sequence models are designed to generate ordered sequences, making them ideal for creating multi-step plans.
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?
Consider what controls how long the generated plans can be.
The maximum output sequence length controls how many steps the model can generate in a plan. Increasing it allows longer, more detailed plans.
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)Look at what the execute method loops over compared to the plan.
The execute method loops over a fixed list that includes 'step3', which is not in the plan. This causes execution of steps not planned.