0
0
Agentic AIml~10 mins

What is an AI agent in Agentic AI - Interactive Quiz & Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define an AI agent that takes actions based on observations.

Agentic AI
class AIAgent:
    def __init__(self):
        pass

    def act(self, observation):
        return [1]
Drag options to blanks, or click blank then click option'
ANone
Bself
Cobservation
Daction
Attempts:
3 left
💡 Hint
Common Mistakes
Returning the observation instead of an action.
Returning self which is not an action.
2fill in blank
medium

Complete the code to initialize the AI agent's internal state.

Agentic AI
class AIAgent:
    def __init__(self):
        self.state = [1]
Drag options to blanks, or click blank then click option'
A{}
B[]
CNone
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list [] which is less descriptive for state.
Setting state to None which means no state.
3fill in blank
hard

Fix the error in the method that updates the agent's state with new observations.

Agentic AI
def update_state(self, observation):
    self.state.update([1])
Drag options to blanks, or click blank then click option'
Aself
BNone
Cstate
Dobservation
Attempts:
3 left
💡 Hint
Common Mistakes
Passing self or None which causes errors.
Passing state which is not defined in this scope.
4fill in blank
hard

Fill both blanks to create a method that decides an action based on the agent's state.

Agentic AI
def decide_action(self):
    if 'goal' in self.state and self.state['goal'] [1] 0:
        return 'move_towards_goal'
    else:
        return [2]
Drag options to blanks, or click blank then click option'
A>
B'idle'
C<
D'wait'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' which reverses the logic.
Returning 'wait' instead of 'idle' which is not the expected action.
5fill in blank
hard

Fill all three blanks to implement a simple AI agent loop that updates state, decides action, and acts.

Agentic AI
def run_agent(agent, observation):
    agent.state.update([1])
    action = agent.[2]()
    return agent.[3](action)
Drag options to blanks, or click blank then click option'
Aobservation
Bdecide_action
Cact
Dupdate_state
Attempts:
3 left
💡 Hint
Common Mistakes
Calling the wrong methods in the wrong order.
Passing wrong arguments to methods.