ReAct Agent: Reasoning + Acting
Implement the ReAct (Reasoning + Acting) pattern with Gemini 3.8 Flash and the Wikipedia API: first the classic Thought→Action→Observation loop with text tags, then the same agent with native function calling and thinking. Finally, a look at the ready-made managed agents in the Gemini API.
What is ReAct
ReAct (Reasoning + Acting) is a technique in which the model alternates between reasoning and actions with tools. Each iteration produces a Thought–Action–Observation triple: the model thinks, calls a tool, reads the result and decides what to do next.
The pattern comes from a 2022 paper, written before models had built-in function calling. Actions were written as tags in plain text and parsed with regular expressions. Gemini now has two built-in mechanisms for the same job: thinking (the model reasons before it answers) and function calling (tools are declared in the request). First we build the classic text-based ReAct to see how the loop works, then we rewrite the agent with native tools.
The rest of this lesson opens after a free sign-up
Sign up with email or Google: the first two lessons of every course stay open for good, and the whole catalog is open for 7 days. No card needed.


