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

Create a shared agent configuration

Any implementation of the Agents API starts with a saved agent. It specifies which model does the work, which instructions it follows, and which tools it can use to take actions or get information. After it’s created, you can use the agent in future sessions using a unique id.

Step 1 of 3Create a common agent configurationHTTP request from Your app to OpenAI Agents API.
Your app
Sends the model, shared instructions, and function definitions.
HTTP request
OpenAI Agents API
Saves the settings for reuse across sessions.

Create a common agent configuration

Request JSON · POST /v1/agents

Key components of the agent configuration

These are the key properties of an agent configuration. To change a setting for a single session, override it when you create the session. Update the saved agent to change the defaults for future sessions. Changes to the agent configuration aren’t updated for sessions that have already started.

Input Explanation
model The model ID selects the model that processes input, requests tool calls, and generates replies.
instructions The API appends this text to the agent’s base instructions. Describe the agent’s role, the rules it should follow, and when to use each tool. Send the task itself as session input.
tools List the tools the model can request, such as web search or computer use. For a custom function, supply its name, description, and a JSON Schema that defines which arguments it accepts. Your app runs the function.

Example: Configure an agent to review customer integrations

Herringbone’s shared instructions tell the agent to inspect the customer’s code, propose the smallest change that preserves the intended behavior, and report which tests it ran. Herringbone describes the pagination change in the task it sends to each session, so it can reuse the same instructions for the next API change. Two function tools give the agent access to the details of each integration.

  • get_integration_context takes no arguments. It returns the customer’s integration code, constraints, and notes from earlier reviews.
  • save_integration_context takes one required string, note. It records a detail for future sessions, such as who maintains the proxy or why a report needs a particular column.

When Herringbone handles either call, its backend uses the session ID to look up the customer and check access. The agent never chooses whose records to read or write.

To run the example, set up your API key and client library (SDK). Copy the instructions from Full prompt into a file named herringbone-fde.md in the directory where you run the code. The cURL example uses jq, a command-line tool for building and reading JSON.

Shared agent configuration example
Configure Herringbone's AI forward-deployed engineer
from pathlib import Path

from openai import OpenAI

client = OpenAI()
agent = client.beta.agents.create(
    name="Herringbone forward-deployed engineer",
    model="gpt-6.2-astra",
    instructions=Path("herringbone-fde.md").read_text(encoding="utf-8"),
    tools=[
        {
            "type": "function",
            "name": "get_integration_context",
            "description": (
                "Read integration code, constraints, and saved notes for the current customer."
            ),
            "parameters": {
                "type": "object",
                "properties": {},
                "additionalProperties": False,
            },
        },
        {
            "type": "function",
            "name": "save_integration_context",
            "description": "Save a note for future sessions about this customer or integration, such as a contact, constraint, or design decision.",
            "parameters": {
                "type": "object",
                "properties": {"note": {"type": "string"}},
                "required": ["note"],
                "additionalProperties": False,
            },
        },
    ],
)
print(agent.id)

Storing the agent configuration ID

The SDK examples print the saved agent’s ID. The cURL example returns the full agent object. Store its id so your app can reuse it when a customer requests a review.

Ask your coding agent
Create a saved agent with shared review instructions. Define get_integration_context with no arguments and save_integration_context with one required string, note. Let the agent save useful customer or integration context for future sessions. Use the session ID to look up the customer in our records. Check the user’s permissions before reading or writing any data. Store the returned agent ID for new sessions. Read this lesson for context: https://developers.openai.com/api/training/agents-api/1-create-a-shared-agent-configuration.md