Skip to content

Agentic Workflows Explained: How AI Agents Use Tools and APIs

Agentic workflows let AI models call tools and APIs across multi-step tasks. How function calling, the ReAct loop, Model Context Protocol, and orchestration work.

An Anthropic diagram shows an agentic workflow where AI agents call tools and APIs.
Credit: Anthropic

An agentic workflow is a process that lets an AI model call tools and APIs to complete a multi-step task autonomously. The model issues a tool call, reads the result, decides what to do next, and repeats that loop until the goal is satisfied or a stopping condition triggers. This pattern is what separates an AI agent from a single-turn chat assistant: the model is not generating one answer, it is choosing actions, observing consequences, and revising its plan. Vendor documentation from OpenAI and Anthropic frames the same primitives the same way, with function calling, structured output, and orchestration as the three pieces that turn a language model into a working agent. The reliability of any agentic workflow rests on how those primitives are wired together, how the tool schema is written, and where a human is kept in the loop.

What an Agentic Workflow Is

An agentic workflow is a sequence of model reasoning and tool-use steps that an AI agent executes to accomplish a goal that would require multiple API calls, decisions, or state changes to complete. The model is not following a fixed script; it is selecting the next action from a defined toolset based on what it has observed so far. OpenAI frames an agent as a model plus instructions plus a set of tools, run inside an orchestration layer that manages the loop (OpenAI, A Practical Guide to Building AI Agents). Google's documentation on AI agents describes the same shape: a model that perceives, reasons, and acts on its environment through tools, rather than producing a single output (Google Cloud, What Are AI Agents). For the broader system this pattern sits inside, see how modern AI systems generate outputs, and for the agent layer specifically, how autonomous AI agents work.

  • Model: a large language model such as Claude, GPT-4, or Gemini that produces the reasoning trace and selects which tool to call.
  • Tool use: any function, API, database query, or external service the model can invoke during the workflow.
  • Tool call: a single model-initiated invocation, expressed as a structured JSON object naming the tool and its arguments.
  • Orchestration: the runtime layer that executes tool calls, passes results back to the model, and tracks state across turns.
  • Multi-step task: a goal that cannot be answered in one response and requires several tool calls or decisions to finish.

How Function Calling Works

The function-calling mechanism is how an agentic workflow connects the model to external code: the model returns a structured JSON object naming the function and its arguments, the developer's runtime executes the function, and the result is passed back as a new message in the context. OpenAI's platform documentation describes the contract directly, stating that function calling lets the model call developer-defined functions by emitting a tool call object that the runtime then executes (OpenAI Platform, Function Calling). The model itself never runs code. It produces a structured output that conforms to the JSON Schema in the tool definition, and the orchestration layer is responsible for matching that output to a real function, calling it, and feeding the return value back. Anthropic's Claude API uses the same pattern under the label tool use, and Google's Gemini API exposes function calling on the same shape, so a tool use integration built against one vendor's function-calling contract can be ported to another with relatively little structural change.

  1. Define: the developer registers a tool with a name, a description, and a JSON Schema for its arguments.
  2. Request: the model receives the user prompt plus the list of available tools in its context.
  3. Emit: the model returns a structured tool call naming the function and supplying arguments that match the schema.
  4. Execute: the runtime parses the tool call, runs the matching function, and captures the return value.
  5. Return: the result is appended to the conversation as a tool-result message, and the model continues reasoning.

The ReAct Loop: Reasoning and Acting in Sequence

The ReAct pattern structures an agentic workflow as alternating thought and action steps: the model writes a reasoning trace, issues a tool call, reads the returned observation, then reasons again before the next action. The label is short for Reason and Act, introduced by Yao et al. in the ReAct paper, and the pattern is the most widely cited in agent literature because it makes the model's intermediate steps inspectable rather than hidden (Yao et al., ReAct: Synergizing Reasoning and Acting in Language Models). Anthropic's engineering guidance on building effective agents recommends exactly this kind of explicit loop, with the model deciding at each iteration whether it has enough information to answer or whether another tool call is needed (Anthropic, Building Effective Agents). The reasoning trace is not a side effect. It is the substrate that lets the model correct course when a tool returns an empty result, a permission error, or data that contradicts its earlier plan. Without that intermediate text, an agent that hits a bad observation has no anchor for revising its next action, and the failure compounds across steps.

  1. Thought: the model writes a short reasoning step describing what it knows and what it needs next.
  2. Action: the model emits a tool call with arguments selected from the available toolset.
  3. Observation: the orchestration layer runs the tool and appends the result to the context as a new message.
  4. Iterate: the model reads the observation, writes the next thought, and either calls another tool or returns a final answer.

Tool Schema Design and Why It Matters

A well-designed tool schema is the single most controllable variable in an agentic workflow: precise parameter names, tight enum constraints, and clear descriptions reduce hallucinated arguments and wrong-tool selection without any change to the model itself. Anthropic's engineering note on writing tools for agents argues the point directly, recommending that you describe a tool the way you would explain it to a new hire on your team and that you name parameters unambiguously, such as user_id rather than user (Anthropic, Writing Tools for Agents). The JSON Schema is the contract the model is constrained to. If a date field accepts any string, the model will eventually hand it a free-text phrase; if the schema demands an ISO-8601 date, the structured output validator rejects anything else before it reaches the function. Tight schemas push errors out of the runtime and into the model, where they are recoverable in the next reasoning step.

  • Name the parameter the way the model talks: customer_id beats cid; descriptive names cut argument hallucination.
  • Constrain with enums: a fixed list of allowed values prevents the model from inventing a category that does not exist downstream.
  • Describe the function in one sentence: the description is the model's only signal for when to choose this tool over a similar one.
  • Use required fields aggressively: optional arguments invite the model to omit context the function actually needs.
  • Validate the structured output: reject and re-prompt on schema mismatch before any function runs against bad data.

Model Context Protocol: A Cross-Vendor Tool Standard

Model Context Protocol (MCP) standardizes how an agentic workflow connects to external tools and data sources by defining a uniform server interface that any compliant client can call without custom adapter code. Anthropic introduced Model Context Protocol as an open standard so that the integration work for a new data source is written once, against the protocol, rather than separately for each model vendor or agent framework (Anthropic, Introducing the Model Context Protocol). The practical effect is decoupling. A team that exposes its document store, ticketing system, or analytics API as an MCP server can plug it into a Claude agent, a GPT-4 agent built on OpenAI's tools, or a LangGraph workflow without rewriting the tool layer for each. The wider movement matters because tool sprawl is the friction that kills most agent rollouts in production: every new API needs auth, schema, retry handling, and a description tuned to the model. For background on the systems being plugged together, see API integration platforms that connect services.

  • MCP server: a process that exposes tools, resources, and prompts on a defined protocol surface.
  • MCP client: the agent runtime (Claude Desktop, an OpenAI agent runner, LangGraph) that connects to one or many servers.
  • Resource: a read-only handle the model can fetch, such as a file, a record, or a query result.
  • Tool: a function the model can invoke through the same protocol surface as a native function call.

Orchestration: Managing State, Retries, and Routing

The orchestration layer of an agentic workflow is responsible for everything the model cannot do itself: maintaining state across turns, routing tool outputs back to the correct model call, retrying on failure, and enforcing rate limits or cost budgets. The model emits a tool call; the orchestrator decides what to do with it. LangChain's LangGraph documentation positions the orchestration layer as a stateful graph in which nodes are model or tool calls and edges encode the routing logic, so the workflow's control flow is explicit and inspectable rather than buried in chained prompts (LangChain, LangGraph). OpenAI's practical guide makes the same argument with a different vocabulary, recommending that production agents separate the model loop from the side-effect layer so that retries, timeouts, and human-in-the-loop checkpoints can be added without touching the prompt. For the wider context on routing infrastructure, see how API gateways manage routing and rate limiting.

Orchestration concernWhat the model handlesWhat the orchestrator handles
State across turnsReads context, decides next actionPersists conversation, tool results, and memory between calls
Tool executionEmits a structured tool callRuns the function, captures the return value, formats the tool-result message
Error handlingReasons over an error observationCatches exceptions, retries with backoff, surfaces fatal errors
Rate and cost limitsNot visible to the modelEnforces per-tool quotas, per-session budgets, and circuit breakers
RoutingNames a tool by IDResolves the tool ID to a function, MCP server, or sub-agent

Human-in-the-Loop Checkpoints and Guardrails

An agentic workflow that can write to external systems, send communications, or spend money must pause for explicit human approval before any action that cannot be undone. Anthropic's guidance on building effective agents argues that human-in-the-loop review is the single most effective safeguard for high-impact steps, and recommends an approval gate around any irreversible action even when the rest of the loop runs autonomously (Anthropic, Building Effective Agents). The checkpoint does not need to be heavyweight. It can be a single confirmation prompt, a queue a reviewer drains once an hour, or a Slack message that blocks the workflow until acknowledged. What matters is that the orchestration layer treats the approval as a hard gate, not a suggestion the model can route around through reasoning. For an applied pattern in a different domain, see automated threat response workflows that balance speed with human oversight.

  • Define the irreversible set: outbound email, payments, deletions, schema changes, public posts, account modifications.
  • Gate before execution, not after: the orchestrator holds the tool call until the human approves, never replays after the fact.
  • Show the full tool call: the approver sees the function name, arguments, and the reasoning step that led to it.
  • Log the decision: approvals and rejections feed back into the reasoning trace so the model can learn the boundary.
  • Fail closed: if the approval channel is unreachable, the workflow halts rather than guessing the answer.

References

Frequently Asked Questions

What is an agentic workflow?

An agentic workflow is a process in which an AI model issues tool calls, receives results, and iterates until a multi-step task is complete. The model decides which tool to invoke at each step rather than executing a fixed script, so the sequence adapts to intermediate outputs. A single workflow might call a web search API, read a file, update a database record, and send a notification before finishing.

What is function calling in the context of AI agents?

Function calling is the mechanism by which a model requests execution of a developer-defined function by returning a structured JSON object that names the function and its arguments. The developer's code runs the function and passes the result back to the model as a new message. OpenAI's platform documentation describes function calling as the primary interface for connecting a model to external tools and APIs.

What is the ReAct pattern used in agentic workflows?

ReAct is a prompting strategy that alternates reasoning steps with action steps inside the same model context. The model writes a thought, issues a tool call, reads the observation, then writes another thought before the next action. This makes the reasoning trace inspectable and helps the model recover from incorrect tool outputs without losing task context.

What is Model Context Protocol and why does it matter for tool use?

Model Context Protocol (MCP) is an open standard that defines a uniform interface for connecting AI models to external tools, data sources, and services. MCP lets a model call any MCP-compliant server without custom adapter code, reducing the integration overhead when an agentic workflow needs to reach many different APIs or data stores.

When does an agentic workflow need a human checkpoint?

An agentic workflow needs a human checkpoint before any irreversible action, such as sending email, submitting payments, or deleting records. Anthropic's guidance on building effective agents recommends pausing for explicit approval at high-impact steps even when the overall loop runs autonomously. The checkpoint may be a simple approval UI, a confirmation message, or a review queue depending on the system's risk profile.

Share this guide

Julian Beaumont

Julian Beaumont covers artificial intelligence and large language models for techshooked, following a model from research paper to product feature. Coverage explains what a new model can do, how it was trained and evaluated, where its benchmarks are strong and where they stop being informative, and what the change means for the developers building on its API.