0
0
Agentic AIml~10 mins

Why state management prevents agent confusion in Agentic AI - Test Your Understanding

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

Complete the code to initialize the agent's state dictionary.

Agentic AI
agent_state = [1]
Drag options to blanks, or click blank then click option'
ANone
B[]
C{}
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list or None instead of a dictionary for state storage.
2fill in blank
medium

Complete the code to update the agent's state with a new observation.

Agentic AI
agent_state['last_observation'] = [1]
Drag options to blanks, or click blank then click option'
A0
BNone
Cagent_state
Dnew_data
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning None or zero instead of the actual new data.
3fill in blank
hard

Fix the error in the code that tries to access a missing key in the agent's state safely.

Agentic AI
last_action = agent_state.get([1], 'no_action')
Drag options to blanks, or click blank then click option'
A'last_action'
B'last_observation'
C'current_state'
D'next_move'
Attempts:
3 left
💡 Hint
Common Mistakes
Using keys that do not exist in the state dictionary.
4fill in blank
hard

Fill both blanks to create a function that resets the agent's state and logs the reset event.

Agentic AI
def reset_agent_state():
    agent_state = [1]
    log_event([2])
Drag options to blanks, or click blank then click option'
A{}
B'Agent state reset'
C[]
D'Reset complete'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list instead of a dictionary for state reset.
Logging an unclear or incorrect message.
5fill in blank
hard

Fill all three blanks to update the agent's state with a new action, check if the state has changed, and return the updated state.

Agentic AI
def update_state(agent_state, new_action):
    old_state = agent_state.copy()
    agent_state[[1]] = [2]
    if agent_state != old_state:
        print([3])
    return agent_state
Drag options to blanks, or click blank then click option'
A'last_action'
Bnew_action
C'State updated'
D'No change'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect keys or values for updating state.
Not comparing states correctly before printing.