Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to send a request for human approval.
Agentic AI
approval_request = HumanApprovalRequest([1]='Please review this action')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'content' or 'text' instead of 'message' causes errors.
Leaving the parameter name blank results in a syntax error.
✗ Incorrect
The 'message' parameter is used to specify the text shown to the human approver.
2fill in blank
mediumComplete the code to check if the human approved the request.
Agentic AI
if approval_response.[1](): print('Approved') else: print('Denied')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'approved' as a property instead of a method causes errors.
Calling a non-existent method like 'check_approval()' leads to runtime errors.
✗ Incorrect
The method 'is_approved()' returns True if the human approved the request.
3fill in blank
hardFix the error in the code to wait for human approval asynchronously.
Agentic AI
approval_response = await approval_request.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'send()' does not wait for the human response.
Calling 'request()' or 'get_response()' are invalid method names.
✗ Incorrect
The method 'wait_for_response()' asynchronously waits for the human to respond.
4fill in blank
hardFill both blanks to create a dictionary of approval status for each task.
Agentic AI
approval_status = {task: response.[1]() for task, response in responses.items() if not response.[2]()} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'is_denied()' in the filter excludes approved tasks.
Using the same method for both blanks causes logic errors.
✗ Incorrect
Use 'is_approved()' to get approval status and 'is_pending()' to filter only completed responses.
5fill in blank
hardFill all three blanks to build a summary report of human approvals.
Agentic AI
summary = [1]([2] for [3] in approval_responses if [3].is_approved())
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'len' with a generator expression causes errors.
Using a variable name other than 'response' breaks the loop.
✗ Incorrect
Use 'sum' to count approvals by adding 1 for each approved response named 'response'.
