Prepare and test your skills
Prepare and test your skills
The ReAct framework (opens in a new tab) is a prompting approach that combines reasoning with acting so a model can solve multi-step tasks. ReAct stands for Reasoning and Acting, and it lets the model think through a problem and then use external tools for help. This combination supports generative AI applications (opens in a new tab) that need current or specific information the model does not already have.
The ReAct framework is a method that interleaves step-by-step thought with concrete tool use to improve model output. The model does not only generate text from training data, it also decides when it needs outside help and requests it from another system. That outside system runs in its own environment and returns a result that the model uses to continue reasoning. This pattern supports more accurate answers for tasks that depend on fresh or specific data.
The ReAct loop is a repeating cycle where reasoning guides the next action and each action result guides the next reasoning. The model moves through an ordered sequence until it has enough evidence to answer:
This cycle makes task completion autonomous because the model decides the order of operations based on what each observation reveals. The workflow depends on both sides, since the model cannot finish without tool results and the tool is only useful when the model asks a clear question.
External tool integration is the connection that lets a model reach beyond its own text generation to retrieve dynamic information. The model sends a structured request to the selected tool, the tool executes in its own environment, and the result returns across the trust boundary into the model context. This separation matters because the model handles language and decisions while the tool handles factual lookup and real actions. Common tools include:
Exam tip: Chain-of-thought uses reasoning alone to show its steps, while ReAct adds tool actions and observations between reasoning steps when outside information is needed.
ReAct for multi-step tasks is the best choice when the answer depends on information that changes or lives outside the model. Choose ReAct when the task requires lightweight tool calling, such as looking up current prices, verifying facts, comparing records, or completing dependent lookups. It also fits latency-sensitive and search-related work where each step depends on the result of the last search. Do not use ReAct when the model can answer directly from instructions alone, since added tool calls add time and complexity without benefit.
Technique selection is the practice of matching a prompting method to task complexity, model capabilities, and required precision. Prompt engineering (opens in a new tab) is a test-driven and iterative process where you define the objective, test the prompt, and use results to improve it. Because large language models predict likely next text from training patterns, both the content and the structure of a prompt change what the model produces.
The prompt engineering workflow is a test-driven and iterative process that enhances model performance. The workflow starts by clearly defining the objective and expected outcome for each prompt, then systematically testing prompts to find areas of improvement. Content supplies the instructions, examples, and context the model needs, while structure uses ordering, labeling, and delimiters to help the model parse that information.
Prompt components that drive results include required parts and optional controls over model behavior. The objective states what the model should achieve, and instructions give step-by-step directions for completing the task. Optional components add precision and consistency:
Matching prompting technique to task complexity means choosing how much reasoning and structure the task demands. When one prompt asks for several distinct cognitive actions, such as summarize, extract entities, translate, and draft an email, it is likely doing too much and should be split into separate prompts. For chain-of-thought (CoT) prompting, examples must show step-by-step reasoning before the final structured answer, because reversing that order teaches the wrong pattern. When Thinking is enabled, test prompting without explicit reasoning instructions and compare whether the model’s own reasoning already improves performance.
Vertex AI Studio (opens in a new tab) includes an AI assistant that speeds up prompt writing by refining or generating prompts. To refine a prompt, follow this order:
To generate a prompt instead, first click Help me write, then describe what the prompt should achieve, then click Generate prompt, then click Insert and Submit. If the response is unsatisfactory, delete the prompt and repeat the process.
The Compare feature in Vertex AI Studio shows how a different prompt, model, or parameter setting changes output by displaying prompts and responses side by side. You can compare against a new prompt, another saved prompt, or a ground truth, which is your preferred answer that all other responses are evaluated against. Comparing against a ground truth generates additional evaluation metrics, and those metrics are not affected by the region you select. The Compare feature does not support prompts with media or chat prompts with more than one exchange.
Parameters that balance precision and resource use control randomness, output size, and how much the model reasons before answering. Choosing them is a tradeoff between precision and diversity, and safety filters can still block responses regardless of settings:
| Parameter | What it controls | How to choose |
|---|---|---|
| Temperature | Randomness in token selection | Lower for true or correct responses; higher for diverse or unexpected results |
| Output token limit | Maximum text output from one prompt, where a token is about four characters | Raise it when the answer needs to be longer |
| Thinking budget | How much the model thinks before answering | Auto lets the model think only when needed; Manual sets the token budget; Off disables thinking |
| Structured output | Forces output into a specific format such as JSON | Choose when output must be machine-readable |
| Grounding | Connects the model to Google Search, Google Maps, or your own data | Choose Google for public sources, or Your data for RAG Engine, Agent Search, or Elasticsearch |
Max responses sets the maximum number of responses per prompt, while Top-P changes how the model selects tokens for output. Structured output turns off grounding options, so the two cannot be combined.
Exam tip: Structured output and grounding cannot be used together — selecting structured output turns off the grounding options.
Common prompt design failures are repeatable mistakes that reduce output quality and should be checked before testing a technique. Review the prompt for these issues:
Chain-of-Thought (CoT) prompting (opens in a new tab) is a technique that asks a model to show step-by-step reasoning before giving its final answer. Instead of jumping directly to a result, the model works through a complex problem as a sequence of smaller logical steps. This explicit reasoning path guides what the model predicts next and improves accuracy on logic, calculation, and judgment tasks.
How Chain-of-Thought prompting works is that reasoning flows from the prompt to intermediate steps to the final answer. The prompt provides instructions and examples that demonstrate reasoning first, and the model follows that pattern by generating its own steps before producing structured output. Because large language models predict what is likely to come next, seeing and generating steps in order keeps the final answer grounded in prior logic. Order matters: first the step-by-step reasoning, then the final answer that depends on it.
Exam tip: In Chain-of-Thought examples, always show step-by-step reasoning before the final structured answer, never the answer before the reasoning.
Logic decomposition in Chain-of-Thought prompting means breaking a large request into smaller cognitive actions that run in a clear sequence. A prompt that asks the model to summarize, extract entities, translate, and draft an email in one pass is trying to accomplish too much at once. Splitting that work into separate prompts or clearly ordered steps gives the model a clear path for each action and for handling edge cases. Clear structure supports decomposition, since ordering, labeling, delimiters, output format, and concrete few-shot examples show where one step ends and the next begins.
When explicit reasoning improves output accuracy is when a task is complex, requires a specific format, or involves nuanced tone or judgment. In these cases, step-by-step instructions plus illustrative examples show the model how to approach the problem, what details matter, and what the finished output should look like. Explicit steps also help with incomplete inputs or edge cases because they force the model to check assumptions instead of skipping to an answer. There is a distinction between explicit reasoning instructions written in the prompt and built-in Thinking (opens in a new tab), which is a model capability that generates its own internal reasoning, so test Thinking alone against Thinking plus explicit instructions and keep the more accurate version.
Chain-of-Thought (CoT) prompting uses reasoning alone to show step-by-step reasoning before the final answer, while the ReAct framework adds tool actions and observations between reasoning steps when outside information is needed. Chain-of-Thought improves accuracy on logic, calculation, and judgment tasks by working through a complex problem as sequential steps, whereas ReAct interleaves thought with concrete tool use to retrieve dynamic information the model does not already have.
The ReAct framework is the best choice when the answer depends on information that changes or lives outside the model. Choose it for lightweight tool calling such as looking up current prices, verifying facts, comparing records, or completing dependent lookups, and for latency-sensitive and search-related work where each step depends on the result of the last search, but do not use it when the model can answer directly from instructions alone because added tool calls add time and complexity without benefit.
The ReAct loop is a repeating cycle where reasoning guides the next action and each action result guides the next reasoning until there is enough evidence to answer. The ordered sequence is Thought where the model reasons about the goal and missing information, then Action where the model calls an external tool such as a search function or an API, then Observation where data flows from the tool back to the model as new evidence. The model then reasons again with the new evidence and either takes another action or produces the final answer only after the evidence is sufficient.
No, structured output and grounding cannot be used together because selecting structured output turns off the grounding options. Structured output forces output into a specific machine-readable format such as JSON, while grounding connects the model to Google Search, Google Maps, or your own data for public sources or retrieval-augmented data.
A financial analyst team is using a large language model on Google Cloud to solve complex multi-step math and deductive logic problems from corporate earnings reports. When prompted directly for a final numerical calculation, the model frequently makes logical errors and arrives at incorrect conclusions.
Which prompting technique should the team implement to improve accuracy by having the model decompose the problem into intermediate logical steps before answering?
Last updated