Bird
Raised Fist0
Agentic AIml~20 mins

What is an AI agent in Agentic AI - Practice Questions & Exercises

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
AI Agent Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the role of an AI agent

Which of the following best describes what an AI agent does?

AIt stores large amounts of data without interacting with anything.
BIt senses its environment and takes actions to achieve goals.
CIt only processes images without making decisions.
DIt randomly generates outputs without input.
Attempts:
2 left
💡 Hint

Think about how a robot or virtual assistant works by noticing things and acting.

Predict Output
intermediate
2:00remaining
Output of a simple AI agent simulation

What will be the output of this simple AI agent code that moves in a 1D space?

Agentic AI
class SimpleAgent:
    def __init__(self):
        self.position = 0
    def sense(self, environment):
        return environment[self.position]
    def act(self, perception):
        if perception == 'obstacle':
            self.position -= 1
        else:
            self.position += 1

environment = ['clear', 'clear', 'obstacle', 'clear']
agent = SimpleAgent()
for _ in range(3):
    p = agent.sense(environment)
    agent.act(p)
print(agent.position)
A1
B2
C-1
D0
Attempts:
2 left
💡 Hint

Track the agent's position step by step as it senses and acts.

Model Choice
advanced
2:00remaining
Choosing the right AI agent model for a task

You want to build an AI agent that learns to play a video game by trial and error. Which model type is best suited?

AReinforcement Learning agent
BSupervised Learning classifier
CUnsupervised clustering model
DRule-based expert system
Attempts:
2 left
💡 Hint

Think about learning from rewards and punishments over time.

Metrics
advanced
2:00remaining
Evaluating an AI agent's performance

Which metric best measures how well an AI agent achieves its goals over time?

ASilhouette score
BMean squared error
CPrecision
DCumulative reward
Attempts:
2 left
💡 Hint

Consider a score that adds up all successes and failures during tasks.

🔧 Debug
expert
2:00remaining
Debugging an AI agent's action logic

What error will this AI agent code raise when running?

Agentic AI
class Agent:
    def __init__(self):
        self.state = None
    def act(self, input):
        match input:
            case 'go':
                self.state = 'moving'
            case 'stop':
                self.state = 'stopped'
            case _:
                self.state = 'idle'
agent = Agent()
agent.act('stop')
ATypeError because 'input' is a reserved word
BAttributeError because 'state' is not defined
CSyntaxError due to missing colon after 'case "stop"'
DNo error, code runs fine
Attempts:
2 left
💡 Hint

Check the syntax of the match-case statements carefully.

Practice

(1/5)
1. What is the main role of an AI agent?
easy
A. To store large amounts of data without processing
B. To sense its environment and act to achieve goals
C. To only perform calculations without interaction
D. To display graphics on a screen

Solution

  1. Step 1: Understand the definition of an AI agent

    An AI agent is designed to sense its environment and take actions based on what it perceives.
  2. Step 2: Compare options with the definition

    Only To sense its environment and act to achieve goals describes sensing and acting to reach goals, which matches the AI agent role.
  3. Final Answer:

    To sense its environment and act to achieve goals -> Option B
  4. Quick Check:

    AI agent role = sensing and acting [OK]
Hint: Remember: AI agents sense, decide, then act [OK]
Common Mistakes:
  • Confusing data storage with agent action
  • Thinking AI agents only calculate without interaction
  • Assuming AI agents only display information
2. Which of the following is the correct cycle an AI agent follows?
easy
A. Perceive, decide, act
B. Act, decide, perceive
C. Decide, act, perceive
D. Store, process, delete

Solution

  1. Step 1: Recall the AI agent cycle

    An AI agent first perceives its environment, then decides what to do, and finally acts.
  2. Step 2: Match the cycle with options

    Perceive, decide, act correctly lists the cycle as perceive, decide, act.
  3. Final Answer:

    Perceive, decide, act -> Option A
  4. Quick Check:

    Agent cycle = perceive, decide, act [OK]
Hint: Think: Sense first, then choose, then do [OK]
Common Mistakes:
  • Mixing the order of actions
  • Confusing agent cycle with data processing steps
  • Choosing unrelated options like store or delete
3. Consider this simple AI agent code snippet:
class SimpleAgent:
    def __init__(self):
        self.state = 0
    def perceive(self, input):
        self.state += input
    def decide(self):
        return 'act' if self.state > 5 else 'wait'
    def act(self):
        return f'Action with state {self.state}'

agent = SimpleAgent()
agent.perceive(3)
agent.perceive(4)
decision = agent.decide()
action = agent.act()
print(decision, action)

What will be printed?
medium
A. act Action with state 0
B. wait Action with state 7
C. act Action with state 7
D. wait Action with state 0

Solution

  1. Step 1: Calculate the agent's state after perceiving inputs

    The agent starts with state 0, then perceives 3 (state=3), then 4 (state=7).
  2. Step 2: Determine decision and action based on state

    Since state=7 > 5, decide() returns 'act'. act() returns 'Action with state 7'.
  3. Final Answer:

    act Action with state 7 -> Option C
  4. Quick Check:

    State 7 > 5 means act and action with 7 [OK]
Hint: Add inputs to state, check if >5 for 'act' [OK]
Common Mistakes:
  • Forgetting to add both inputs
  • Confusing 'wait' and 'act' conditions
  • Printing state before updates
4. This AI agent code has a bug:
class BuggyAgent:
    def __init__(self):
        self.state = 0
    def perceive(self, input):
        self.state =+ input
    def decide(self):
        return 'act' if self.state > 5 else 'wait'

What is the bug?
medium
A. The state variable is not initialized
B. The decide method has wrong comparison operator
C. The class is missing an act method
D. The operator '=+' should be '+=' in perceive method

Solution

  1. Step 1: Inspect the perceive method

    The code uses 'self.state =+ input' which assigns positive input, not adding it.
  2. Step 2: Identify correct operator

    The correct operator to add input to state is '+=' not '=+'.
  3. Final Answer:

    The operator '=+' should be '+=' in perceive method -> Option D
  4. Quick Check:

    Use '+=' to add, not '=+' [OK]
Hint: Look for '=+' typo; it should be '+=' [OK]
Common Mistakes:
  • Thinking comparison operator is wrong
  • Ignoring missing act method (not a bug here)
  • Assuming state is uninitialized
5. You want to build an AI agent for a virtual assistant that can listen, understand commands, and respond. Which of these best describes the agent's main components?
hard
A. Sensors to listen, decision logic to understand, actuators to respond
B. Only a database to store commands and responses
C. A graphics engine to display animations
D. A random number generator to pick responses

Solution

  1. Step 1: Identify components needed for virtual assistant agent

    The agent must sense (listen), decide (understand commands), and act (respond).
  2. Step 2: Match components to options

    Sensors to listen, decision logic to understand, actuators to respond correctly lists sensors, decision logic, and actuators matching the agent cycle.
  3. Final Answer:

    Sensors to listen, decision logic to understand, actuators to respond -> Option A
  4. Quick Check:

    Agent components = sense, decide, act [OK]
Hint: Think: listen (sense), understand (decide), reply (act) [OK]
Common Mistakes:
  • Choosing only storage or graphics components
  • Ignoring the decision step
  • Picking random or unrelated components