0
0
Agentic AIml~10 mins

Human-in-the-loop interrupts 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 pause the AI agent for human input.

Agentic AI
agent.pause_for_human([1])
Drag options to blanks, or click blank then click option'
Atimeout=30
Bauto_resume=True
Cwait=False
Dinterrupt=True
Attempts:
3 left
💡 Hint
Common Mistakes
Using timeout=30 causes the agent to pause for a fixed time, not wait for human input.
Setting wait=False means the agent won't pause at all.
2fill in blank
medium

Complete the code to resume the AI agent after human approval.

Agentic AI
if human_approval == True:
    agent.[1]()
Drag options to blanks, or click blank then click option'
Aresume
Bpause
Crestart
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop() ends the agent instead of resuming it.
Calling pause() again will not resume the agent.
3fill in blank
hard

Fix the error in the code to correctly handle human interrupts.

Agentic AI
try:
    agent.run()
except [1]:
    agent.pause_for_human(interrupt=True)
Drag options to blanks, or click blank then click option'
AValueError
BKeyboardInterrupt
CTimeoutError
DRuntimeError
Attempts:
3 left
💡 Hint
Common Mistakes
Using ValueError or RuntimeError does not catch human interrupts.
TimeoutError is for timeouts, not manual interrupts.
4fill in blank
hard

Fill both blanks to create a loop that waits for human input before continuing.

Agentic AI
while not agent.[1]():
    agent.[2](interrupt=True)
Drag options to blanks, or click blank then click option'
Ais_approved
Bpause_for_human
Cstop
Dresume
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop or resume in the wrong place breaks the loop logic.
Not checking human approval causes the loop to run endlessly.
5fill in blank
hard

Fill all three blanks to implement a human-in-the-loop interrupt handler.

Agentic AI
def handle_interrupt(agent):
    try:
        agent.[1]()
    except [2]:
        agent.[3](interrupt=True)
Drag options to blanks, or click blank then click option'
Arun
BKeyboardInterrupt
Cpause_for_human
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop instead of pause_for_human causes the agent to end instead of waiting.
Catching the wrong exception misses the human interrupt.