Bird
0
0

Which of the following is the correct way to add a guardrail that stops an AI agent from deleting files?

easy📝 Syntax Q12 of 15
Agentic AI - Agent Safety and Guardrails
Which of the following is the correct way to add a guardrail that stops an AI agent from deleting files?
A<code>delete_file = true</code>
B<code>allow action == 'delete_file'</code>
C<code>if action == 'delete_file': block()</code>
D<code>action = 'delete_file'</code>
Step-by-Step Solution
Solution:
  1. Step 1: Identify guardrail syntax to block actions

    The guardrail should check if the action is 'delete_file' and then block it.
  2. Step 2: Compare options for correct blocking

    if action == 'delete_file': block() uses a condition and blocks the action, which is correct for a guardrail.
  3. Final Answer:

    if action == 'delete_file': block() -> Option C
  4. Quick Check:

    Guardrail blocks delete_file = if action == 'delete_file': block() [OK]
Quick Trick: Guardrails use conditions to block bad actions [OK]
Common Mistakes:
  • Allowing the action instead of blocking
  • Assigning variables instead of checking conditions
  • Confusing action names with commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes