0
0
Agentic AIml~10 mins

ReAct pattern (Reasoning + Acting) in Agentic AI - Interactive Code Practice

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

Complete 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'
A"Think step-by-step and then act."
B"What is the weather today?"
C"Calculate the sum of 2 and 3."
D"Hello, how are you?"
Attempts:
3 left
💡 Hint
Common Mistakes
Using a simple question as the prompt instead of a reasoning instruction.
2fill in blank
medium

Complete 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'
Athink
Brun
Cact
Dprocess
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'think' instead of 'act' to perform the action.
3fill in blank
hard

Fix the error in the reasoning step method call.

Agentic AI
thought = agent.[1](context)
Drag options to blanks, or click blank then click option'
Areason
Bthink
Crespond
Dact
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'act' or 'reason' which are not the exact method names.
4fill in blank
hard

Fill 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'
Athink
Bact
Crun
Dprocess
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of 'think' and 'act'.
Using incorrect method names like 'run' or 'process'.
5fill in blank
hard

Fill 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'
Athink
Bact
Cobserve
Drespond
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'respond' instead of 'observe' for the result.
Mixing up the order of methods.