0
0
Agentic AIml~10 mins

Plan-and-execute pattern in Agentic AI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the planning step in the plan-and-execute pattern.

Agentic AI
def plan(task):
    steps = [1](task)
    return steps
Drag options to blanks, or click blank then click option'
Afinalize_task
Bexecute_plan
Cgenerate_plan
Drun_steps
Attempts:
3 left
💡 Hint
Common Mistakes
Using the execute function instead of the generate function.
Calling a function that finalizes or runs steps instead of planning.
2fill in blank
medium

Complete the code to execute each step in the plan-and-execute pattern.

Agentic AI
def execute(steps):
    results = []
    for step in steps:
        result = [1](step)
        results.append(result)
    return results
Drag options to blanks, or click blank then click option'
Aplan
Bexecute_step
Cfinalize
Dgenerate_plan
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the planning function instead of executing.
Using a finalize function that is not defined here.
3fill in blank
hard

Fix the error in the combined plan-and-execute function by completing the blank.

Agentic AI
def plan_and_execute(task):
    steps = generate_plan(task)
    results = []
    for step in steps:
        results.append([1](step))
    return results
Drag options to blanks, or click blank then click option'
Aexecute_step
Bplan
Cgenerate_plan
Dfinalize
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the planning function inside the loop.
Using a finalize function that is not defined.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each step to its execution result.

Agentic AI
results = {step: [1](step) for step in [2]
Drag options to blanks, or click blank then click option'
Aexecute_step
Bplan
Csteps
Dgenerate_plan
Attempts:
3 left
💡 Hint
Common Mistakes
Using the planning function instead of execution.
Iterating over the wrong variable.
5fill in blank
hard

Fill all three blanks to complete the plan-and-execute function using a dictionary comprehension.

Agentic AI
def plan_and_execute(task):
    [1] = generate_plan(task)
    results = {step: [2](step) for step in [3]
    return results
Drag options to blanks, or click blank then click option'
Asteps
Bexecute_step
Dfinalize
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Calling the wrong function to execute steps.