Bird
Raised Fist0
Agentic AIml~20 mins

Agent API design patterns in Agentic AI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Agent API Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the role of the 'Planner' in Agent API design

In an agent API design pattern, what is the primary role of the 'Planner' component?

AIt executes the actions decided by the agent without modification.
BIt decides the sequence of actions the agent should take to achieve its goal.
CIt stores the agent's memory and past interactions for future reference.
DIt handles the user interface and visual representation of the agent.
Attempts:
2 left
💡 Hint

Think about which part of the agent figures out what to do next.

Predict Output
intermediate
2:00remaining
Output of agent action execution with error handling

What will be the output of the following agent API code snippet when the action 'fetch_data' fails?

Agentic AI
class Agent:
    def __init__(self):
        self.actions = {'fetch_data': self.fetch_data}
    def fetch_data(self):
        raise Exception('Network error')
    def execute(self, action_name):
        try:
            return self.actions[action_name]()
        except Exception as e:
            return f'Error: {e}'
agent = Agent()
result = agent.execute('fetch_data')
print(result)
ANetwork error
BException: Network error
CNone
DError: Network error
Attempts:
2 left
💡 Hint

Look at the except block and what it returns.

Model Choice
advanced
2:00remaining
Choosing the best agent API pattern for dynamic task switching

Which agent API design pattern best supports dynamic switching between multiple tasks based on real-time input?

AHierarchical pattern with layered decision-making and task delegation.
BReactive pattern that immediately responds to inputs without internal state.
CBatch processing pattern that queues tasks and processes them sequentially.
DStatic pipeline pattern with fixed sequence of operations.
Attempts:
2 left
💡 Hint

Consider which pattern allows flexible control and task management.

Hyperparameter
advanced
2:00remaining
Impact of 'timeout' hyperparameter in agent API calls

In an agent API design, setting a 'timeout' hyperparameter controls:

AThe maximum time the agent waits for an action to complete before aborting.
BThe number of retries the agent makes after a failed action.
CThe priority level of the agent's tasks in the queue.
DThe size of the memory buffer storing past interactions.
Attempts:
2 left
💡 Hint

Think about what 'timeout' usually means in computing.

🔧 Debug
expert
3:00remaining
Debugging unexpected agent response in API design

An agent API is designed to return a JSON response with keys 'status' and 'result'. The following code snippet returns {'status': 'success'} but misses 'result'. What is the likely cause?

def agent_response(data):
    if data:
        return {'status': 'success'}
    else:
        return {'status': 'fail', 'result': None}
response = agent_response({'task': 'run'})
print(response)
AThe print statement is missing the 'result' key access.
BThe input data is empty, so the else branch is not executed.
CThe function does not include 'result' in the success case, causing incomplete response.
DThe function should return a string, not a dictionary.
Attempts:
2 left
💡 Hint

Check what keys are returned in each branch of the function.