Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a guardrail that stops the agent if it tries to delete important files.
Agentic_ai
if action == [1]: print("Guardrail activated: Action blocked.")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to check if the agent's output contains forbidden words.
Agentic_ai
for word in forbidden_words: if word in agent_output: raise [1]("Forbidden content detected")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the guardrail function that prevents the agent from sending sensitive data.
Agentic_ai
def guardrail_check(data): if 'password' [1] data: return False return True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a guardrail that logs and blocks unsafe commands.
Agentic_ai
def check_command(cmd): if cmd [1] unsafe_commands: log_event([2]) return False return True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to build a guardrail that filters outputs and raises an error if needed.
Agentic_ai
def filter_output(output): filtered = [word for word in output.split() if word != [1]] if [2] in filtered: raise [3]("Disallowed word found") return ' '.join(filtered)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
