Bird
Raised Fist0
Agentic AIml~10 mins

Tool permission boundaries 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 define a tool permission boundary that restricts access to only approved tools.

Agentic AI
tool_permissions = [1](['search', 'calculator'])
Drag options to blanks, or click blank then click option'
Alist
Btuple
Cdict
Dset
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list instead of a set can cause slower permission checks.
Using a dict or tuple is not suitable for membership testing in this context.
2fill in blank
medium

Complete the code to check if the tool 'email' is allowed by the permission boundary.

Agentic AI
if 'email' [1] tool_permissions:
    print('Access granted')
else:
    print('Access denied')
Drag options to blanks, or click blank then click option'
A==
Bnot in
Cin
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' or '!=' compares values incorrectly here.
Using 'not in' reverses the logic and denies access when it should grant.
3fill in blank
hard

Fix the error in the code that attempts to add a new tool 'calendar' to the permission boundary.

Agentic AI
tool_permissions.[1]('calendar')
Drag options to blanks, or click blank then click option'
Ainsert
Badd
Cappend
Dextend
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'append' causes an AttributeError because sets do not have this method.
Using 'insert' or 'extend' are list methods and not valid for sets.
4fill in blank
hard

Fill both blanks to create a function that returns True if a tool is allowed, False otherwise.

Agentic AI
def is_tool_allowed(tool):
    return tool [1] tool_permissions [2] True
Drag options to blanks, or click blank then click option'
Ain
B==
Cis
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'is' instead of '==' can cause unexpected behavior.
Using '!=' reverses the logic and returns incorrect results.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps each tool to a boolean indicating permission.

Agentic AI
tool_access = {tool: tool [1] tool_permissions [2] True for tool in tools if tool [3] tool_permissions}
Drag options to blanks, or click blank then click option'
Ain
B==
Cnot in
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not in' in the filter excludes allowed tools incorrectly.
Using '!=' reverses the logic and causes wrong mappings.