0
0
Agentic AIml~20 mins

Retry and fallback logic in Agentic AI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Retry and Fallback Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Retry Logic Purpose
Why is retry logic important in agentic AI systems when calling external APIs?
ATo increase the number of API calls regardless of errors
BTo permanently stop the process after the first failure
CTo ignore errors and continue without any checks
DTo handle temporary failures by trying the request again automatically
Attempts:
2 left
💡 Hint
Think about what happens if a network glitch causes a temporary failure.
Predict Output
intermediate
1: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
A
Attempt 1: Failed
Attempt 2: Failed
Attempt 3: Success
B
Attempt 1: Failed
Attempt 2: Success
CAttempt 1: Success
D
Attempt 1: Failed
Attempt 2: Failed
Attempt 3: Failed
Attempts:
2 left
💡 Hint
Check how many times the loop runs and when it breaks.
Model Choice
advanced
2: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?
AStop all processing and show an error message immediately
BSwitch to a simpler, faster model that provides approximate answers
CKeep retrying indefinitely without fallback
DReturn empty or null responses without explanation
Attempts:
2 left
💡 Hint
Consider user experience and response time.
Metrics
advanced
1:30remaining
Evaluating Retry Logic Impact on Latency
Which metric best measures the impact of retry logic on system latency?
AAverage response time including retries
BModel accuracy on successful calls
CNumber of retries attempted
DMemory usage during retries
Attempts:
2 left
💡 Hint
Think about how retries affect how long users wait.
🔧 Debug
expert
2: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()
ANo error, returns fallback model response
BTypeError because fallback_model_call returns wrong type
CNameError because primary_model_call is not defined
DRuntimeError due to infinite loop
Attempts:
2 left
💡 Hint
Check if the functions called are defined in the code snippet.