Bird
0
0

Given this monitoring code snippet for an AI agent:

medium📝 Predict Output Q13 of 15
Agentic AI - Real-World Agent Applications
Given this monitoring code snippet for an AI agent:
logs = []
for event in agent_events:
    if event['type'] == 'error':
        logs.append(event['message'])
print(len(logs))
What does the output represent?
ATotal number of events processed
BNumber of error events detected
CNumber of successful events
DNumber of unique event types
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the loop filtering events

    The code adds messages only if event type is 'error'.
  2. Step 2: Understand the output

    Printing length of logs shows how many error events were found.
  3. Final Answer:

    Number of error events detected -> Option B
  4. Quick Check:

    Count of error events = B [OK]
Quick Trick: Count items filtered by 'error' type in logs [OK]
Common Mistakes:
  • Counting all events instead of errors
  • Confusing error messages with success
  • Assuming unique event types count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Agentic AI Quizzes