Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tool_name' instead of the task description.
Passing input data instead of the task.
✗ Incorrect
The agent selects a tool based on the 'task_description' parameter describing what needs to be done.
2fill in blank
mediumComplete 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'
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.
✗ Incorrect
The method 'execute' is commonly used to run the selected tool on input data.
3fill in blank
hardFix 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'
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.
✗ Incorrect
The variable 'required_capability' holds the capability to check for in the tool's capabilities list.
4fill in blank
hardFill 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'
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.
✗ Incorrect
We want the tool's description and check if the required_capability is in the tool's capabilities.
5fill in blank
hardFill 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'
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.
✗ Incorrect
The function uses 'required_capability' to check capabilities and calls 'execute' to run the tool.