Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to store the tool's output in a variable.
Agentic AI
tool_output = [1].execute(input_data) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the method name instead of the tool object.
Trying to assign input data instead of the output.
✗ Incorrect
The tool object calls the execute method to run the tool and returns the output, which we store in tool_output.
2fill in blank
mediumComplete the code to check if the tool execution was successful.
Agentic AI
if tool_output.[1] == 'success': print('Tool ran successfully')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Checking the wrong attribute like
message or output.Comparing to wrong string values.
✗ Incorrect
The status attribute usually tells if the tool ran successfully.
3fill in blank
hardFix the error in accessing the tool's output text.
Agentic AI
print(tool_output.[1]['text'])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using attributes that are strings instead of dictionaries.
Trying to access keys on non-dictionary attributes.
✗ Incorrect
The tool's output text is stored inside the response attribute as a dictionary.
4fill in blank
hardFill both blanks to extract and print the tool's confidence score.
Agentic AI
confidence = tool_output.[1].get('[2]', 0) print(f'Confidence: {confidence}')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names like
info or confidence as attribute.Using incorrect key names.
✗ Incorrect
The confidence score is stored inside the metadata dictionary under the key score.
5fill in blank
hardFill all three blanks to handle tool output safely with error checking.
Agentic AI
if tool_output.[1] == 'error': print('Error:', tool_output.[2]) else: print('Result:', tool_output.[3]['text'])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up attributes for status and message.
Trying to access text on wrong attribute.
✗ Incorrect
Check status for errors, print the message if error, else print the text inside response.