Challenge - 5 Problems
Retry and Fallback Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Understanding Retry Logic Purpose
Why is retry logic important in agentic AI systems when calling external APIs?
Attempts:
2 left
💡 Hint
Think about what happens if a network glitch causes a temporary failure.
✗ Incorrect
Retry logic helps the system recover from temporary issues by trying again, improving reliability.
❓ Predict Output
intermediate1:30remaining
Output of Retry Loop with Limited Attempts
What will be the printed output of this retry logic code snippet?
Agentic AI
attempts = 0 max_attempts = 3 while attempts < max_attempts: attempts += 1 if attempts < 3: print(f"Attempt {attempts}: Failed") else: print(f"Attempt {attempts}: Success") break
Attempts:
2 left
💡 Hint
Check how many times the loop runs and when it breaks.
✗ Incorrect
The loop tries 3 times. The first two attempts print 'Failed'. The third prints 'Success' and stops.
❓ Model Choice
advanced2:00remaining
Choosing Fallback Strategy for Agentic AI
If an agentic AI fails to get a response from a primary model after retries, which fallback strategy is best to maintain user experience?
Attempts:
2 left
💡 Hint
Consider user experience and response time.
✗ Incorrect
Using a simpler model as fallback keeps the system responsive and provides useful answers even if less precise.
❓ Metrics
advanced1:30remaining
Evaluating Retry Logic Impact on Latency
Which metric best measures the impact of retry logic on system latency?
Attempts:
2 left
💡 Hint
Think about how retries affect how long users wait.
✗ Incorrect
Average response time including retries shows how retries increase total wait time for responses.
🔧 Debug
expert2:30remaining
Identifying Bug in Retry with Fallback Code
What error will this retry and fallback code raise when the primary model always fails?
Agentic AI
def get_response(): for _ in range(2): try: result = primary_model_call() return result except Exception: continue return fallback_model_call() response = get_response()
Attempts:
2 left
💡 Hint
Check if the functions called are defined in the code snippet.
✗ Incorrect
primary_model_call and fallback_model_call are not defined anywhere, causing a NameError on first call.