0
0
Agentic AIml~20 mins

Agent perception-reasoning-action loop in Agentic AI - Practice Problems & Coding Challenges

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

In the agent perception-reasoning-action loop, what is the primary role of the perception component?

ATo gather information from the environment and convert it into a form the agent can understand
BTo decide the best action based on the current knowledge
CTo store past actions for future reference
DTo execute the chosen action in the environment
Attempts:
2 left
💡 Hint

Think about how the agent first learns about its surroundings.

Predict Output
intermediate
2:00remaining
Output of a simple agent loop step

Given the following Python code simulating one step of an agent loop, what is the printed output?

Agentic AI
class SimpleAgent:
    def __init__(self):
        self.state = 'idle'
    def perceive(self, data):
        return data.upper()
    def reason(self, info):
        if 'HELLO' in info:
            return 'greet'
        return 'wait'
    def act(self, action):
        if action == 'greet':
            return 'Hello, human!'
        return '...' 

agent = SimpleAgent()
data = 'hello world'
info = agent.perceive(data)
action = agent.reason(info)
result = agent.act(action)
print(result)
A...
Bgreet
Chello world
DHello, human!
Attempts:
2 left
💡 Hint

Follow the flow: perceive converts to uppercase, reason checks for 'HELLO', then act responds.

Model Choice
advanced
2:00remaining
Choosing the best reasoning model for an agent

Which model type is best suited for the reasoning component of an agent that must make decisions based on uncertain and changing environments?

AProbabilistic graphical model (e.g., Bayesian network)
BDeterministic rule-based system
CStatic lookup table
DSimple linear regression
Attempts:
2 left
💡 Hint

Consider models that handle uncertainty and update beliefs.

Hyperparameter
advanced
2:00remaining
Hyperparameter affecting agent action speed

In an agent using reinforcement learning for action selection, which hyperparameter primarily controls how quickly the agent explores new actions versus exploiting known good actions?

ALearning rate (alpha)
BDiscount factor (gamma)
CExploration rate (epsilon)
DBatch size
Attempts:
2 left
💡 Hint

Think about the balance between trying new things and sticking to what works.

🔧 Debug
expert
3:00remaining
Debugging an agent loop causing infinite action repetition

Consider this agent loop snippet that causes the agent to repeat the same action endlessly. What is the most likely cause?

Agentic AI
class LoopAgent:
    def __init__(self):
        self.memory = []
    def perceive(self, env):
        return env.get_state()
    def reason(self, state):
        if state not in self.memory:
            self.memory.append(state)
            return 'explore'
        else:
            return 'explore'
    def act(self, action):
        return f'Action: {action}'

agent = LoopAgent()
env = type('Env', (), {'get_state': lambda self: 'state1'})()
for _ in range(3):
    s = agent.perceive(env)
    a = agent.reason(s)
    print(agent.act(a))
AThe perceive method does not update the environment state
BThe reason method returns 'explore' regardless of memory, causing repeated actions
CThe memory list is cleared after each action
DThe act method modifies the action incorrectly
Attempts:
2 left
💡 Hint

Look at the condition and returned action in the reason method.