0
0
Agentic AIml~10 mins

Tool selection by the agent 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 select the correct tool based on the task description.

Agentic AI
tool = agent.select_tool([1])
Drag options to blanks, or click blank then click option'
A'task_description'
B'task'
C'tool_name'
D'input_data'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tool_name' instead of the task description.
Passing input data instead of the task.
2fill in blank
medium

Complete the code to execute the selected tool with the given input.

Agentic AI
result = selected_tool.[1](input_data)
Drag options to blanks, or click blank then click option'
Arun
Bprocess
Capply
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' which might not be defined for the tool object.
Using 'apply' which is less common for tool execution.
3fill in blank
hard

Fix the error in the code to correctly check if the tool supports the required capability.

Agentic AI
if [1] in selected_tool.capabilities:
Drag options to blanks, or click blank then click option'
Acapabilities
Brequired_capability
Ccapability_name
Dcapability
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'capabilities' which is the list, not the item to check.
Using 'capability' which is too generic and undefined.
4fill in blank
hard

Fill both blanks to create a dictionary mapping tool names to their descriptions for tools that support the required capability.

Agentic AI
tool_info = {tool.name: tool.[1] for tool in tools if [2] in tool.capabilities}
Drag options to blanks, or click blank then click option'
Adescription
Brequired_capability
Ccapability
Ddetails
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'capability' instead of 'required_capability' for filtering.
Using 'details' which might not be the correct attribute for description.
5fill in blank
hard

Fill all three blanks to create a function that selects a tool by name, checks if it supports the required capability, and executes it with input data.

Agentic AI
def use_tool(tools, name, [1], input_data):
    tool = next((t for t in tools if t.name == name), None)
    if tool and [2] in tool.capabilities:
        return tool.[3](input_data)
    return None
Drag options to blanks, or click blank then click option'
Arequired_capability
Cexecute
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for capability in the function signature and check.
Using 'run' instead of 'execute' which might not be defined.