Write pseudocode (does not need to compile) for a ReAct-style agent loop that alternates between reasoning and actions.
Thought
: internal reasoning about what to do next
Action
: the name of a tool to call (e.g.,
Search
,
Calculator
,
LookupDB
) or
Finish
ActionInput
: arguments for the tool
Action
is chosen:
Observation
.
Observation
back into the context for the next iteration.
Finish
or when a maximum number of steps is reached.
Provide the loop structure and the data you keep in state (e.g., conversation history, scratchpad, tool outputs).