Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start the ReAct agent with an initial prompt.
Agentic AI
agent = ReActAgent(prompt=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a simple question as the prompt instead of a reasoning instruction.
✗ Incorrect
The ReAct pattern starts with a prompt that encourages reasoning before acting, such as 'Think step-by-step and then act.'
2fill in blank
mediumComplete the code to make the agent perform an action after reasoning.
Agentic AI
response = agent.[1](input_text) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'think' instead of 'act' to perform the action.
✗ Incorrect
In the ReAct pattern, the agent acts on the input after reasoning, so the method to perform is 'act'.
3fill in blank
hardFix the error in the reasoning step method call.
Agentic AI
thought = agent.[1](context) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'act' or 'reason' which are not the exact method names.
✗ Incorrect
The correct method for the reasoning step in ReAct is 'think', which returns the agent's thought process.
4fill in blank
hardFill both blanks to create a loop that alternates reasoning and acting until done.
Agentic AI
while not done: thought = agent.[1](input_data) action = agent.[2](thought)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of 'think' and 'act'.
Using incorrect method names like 'run' or 'process'.
✗ Incorrect
The loop first calls 'think' to reason, then 'act' to perform the action, repeating until done.
5fill in blank
hardFill all three blanks to store thoughts, actions, and results in a dictionary.
Agentic AI
log = {
'thought': agent.[1](query),
'action': agent.[2](query),
'result': agent.[3](query)
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'respond' instead of 'observe' for the result.
Mixing up the order of methods.
✗ Incorrect
The ReAct pattern uses 'think' for reasoning, 'act' for actions, and 'observe' to get results from the environment.