0
0
Agentic AIml~10 mins

Chain-of-thought reasoning in agents 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 agent's reasoning with a clear thought.

Agentic AI
agent_thought = "I need to analyze the problem step by step: [1]"
Drag options to blanks, or click blank then click option'
AFirst, I will gather all relevant information.
BRun the final action immediately.
CIgnore the input data.
DSkip reasoning and guess.
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing to skip reasoning or ignore data leads to poor decisions.
2fill in blank
medium

Complete the code to add a reasoning step that evaluates options.

Agentic AI
agent_thought += " Next, I will [1] to decide the best action."
Drag options to blanks, or click blank then click option'
Arandomly pick an action
Bignore the consequences
Cevaluate all possible actions carefully
Dchoose the first action without thinking
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing actions without evaluation leads to errors.
3fill in blank
hard

Fix the error in the agent's reasoning update to correctly append the next thought.

Agentic AI
agent_thought = agent_thought [1] " Finally, I will execute the chosen action."
Drag options to blanks, or click blank then click option'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using arithmetic operators other than '+' causes errors.
4fill in blank
hard

Fill both blanks to create a dictionary that maps each step to its description.

Agentic AI
reasoning_steps = {1: [1], 2: [2]
Drag options to blanks, or click blank then click option'
A"Gather information"
B"Ignore data"
C"Evaluate options"
D"Skip reasoning"
Attempts:
3 left
💡 Hint
Common Mistakes
Putting 'Ignore data' or 'Skip reasoning' as steps breaks the chain.
5fill in blank
hard

Fill all three blanks to complete the agent's chain-of-thought function.

Agentic AI
def chain_of_thought(agent_input):
    thoughts = []
    thoughts.append([1])
    thoughts.append([2])
    thoughts.append([3])
    return " -> ".join(thoughts)
Drag options to blanks, or click blank then click option'
A"Gather information"
B"Evaluate options"
C"Execute action"
D"Ignore input"
Attempts:
3 left
💡 Hint
Common Mistakes
Including 'Ignore input' breaks the reasoning chain.