For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Agents API

Overview

Learn how to build agents that use tools, work with files in isolated sessions, and pick up where they left off.

What you’ll need

  • Basic familiarity with HTTP APIs.
  • An OpenAI API platform account. To set it up, read the API quickstart.

What you’ll learn

  • Reuse one agent configuration across independent sessions.
  • Give each session the tools, files, and credentials it needs.
  • Send tasks, handle function calls, and retrieve replies and files.
  • Carry customer context into new sessions.
  • Find where a model response or tool call led to an unexpected result.

Why use the Agents API?

Building agents that work in production is hard. Before even considering what the agent does, you need to solve several thorny infrastructure challenges:

The Agents API solves these infrastructure challenges for you, enabling you to deploy an entire fleet of agents with different access and capabilities at scale.

In this training, you will learn the techniques and concepts necessary to use the Agents API to deploy customized agents with shared configuration and tools. To help illustrate how it’s done, we’ll trace the deployment of a fleet of agents to scale customer support and sales engineering.

Herringbone logo

Use case: AI forward-deployed engineer for API integrations

To demonstrate the utility of an agent fleet, let’s consider a business called Herringbone, a fictional payments API provider. For a complex product like an API, a forward-deployed engineer (FDE) is often assigned to work directly with a customer to build and maintain their integration. As the customer gets started, and when the API changes, an FDE who knows both the product and the customer’s context is able to help a customer successfully implement the API.

However, assigning a human FDE to every customer is expensive. To give every customer the experience of a dedicated FDE, Herringbone is using the Agents API to deploy an agent for every customer that stays up to date both on the product and the customer’s implementation progress.

Herringbone's application

API client code
Tools with access to customer data and context

OpenAI Agents API

Shared agent configuration
Customer A

Fast-moving startup

Sessions
Hosted environments
Customer B

Enterprise using a proxy

Sessions
Hosted environments
Customer C

Partner API reseller

Sessions
Hosted environments
API requests Function-call events

Handling a breaking change

Let’s say Herringbone changes their API to start returning payment data one page at a time. When more payments are available, the response includes a cursor, a value the caller sends back to fetch the next page. The same change affects three customers differently.

  • Customer A, a fast-moving startup, calls the API directly. Every night it copies payments data into a finance report. Each payment must appear exactly once.
  • Customer B, an enterprise, uses a proxy to forward requests from its internal apps to Herringbone. The proxy needs to pass along the cursor.
  • Customer C, a partner API reseller, exposes its own API to merchants. Its merchants expect a single list of payments, even when Herringbone returns more than one page.

The customers may not know about the change yet. Herringbone’s app sends a review task to each customer’s session. Each FDE reviews the code that customer has authorized it to read. Through Herringbone’s app, the customer gets a note from their FDE explaining what changed in the API, how it affects their integration, and what to update, if anything.

Let’s step through how we’d accomplish this using the Agents API.