0
0
Agentic AIml~10 mins

Handling tool execution results 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 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'
Aexecute
Bresult
Ctool
Dinput_data
Attempts:
3 left
💡 Hint
Common Mistakes
Using the method name instead of the tool object.
Trying to assign input data instead of the output.
2fill in blank
medium

Complete 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'
Amessage
Bresult
Coutput
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Checking the wrong attribute like message or output.
Comparing to wrong string values.
3fill in blank
hard

Fix 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'
Aresponse
Bresult
Coutput
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using attributes that are strings instead of dictionaries.
Trying to access keys on non-dictionary attributes.
4fill in blank
hard

Fill 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'
Ametadata
Bconfidence
Cinfo
Dscore
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong attribute names like info or confidence as attribute.
Using incorrect key names.
5fill in blank
hard

Fill 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'
Astatus
Bmessage
Cresponse
Doutput
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up attributes for status and message.
Trying to access text on wrong attribute.