OpenAI for AI agents: function calling, the Responses API and the Agents SDK
What OpenAI provides for building an agent
OpenAI does not ship a finished agent for your business. It provides models and the interfaces your software uses to call them, and it also offers a managed Agents API in which OpenAI runs the loop for you. An agent is the program you write around those interfaces: it sends the task to a model, receives the model’s reply, carries out any tool the model asks for, and sends the result back. The model supplies the judgment about which step comes next, and your code supplies the limits.
Three parts of the platform matter most for an agent. Function calling describes your tools to the model. The Responses API is a core interface for a conversation that mixes text and tool use. The Agents SDK is a set of helpers that structure the loop, so your team does not write the loop from scratch.
How function calling lets an agent act in your systems
You describe each tool with a name, a plain-language description and a schema that lists the parameters and their types. A tool might look up a customer by email, read an order status or save a draft reply in your CRM. The model sees these descriptions and can answer with a request to call one of them, with arguments filled in.
The model never runs the tool itself. Your application receives the request, checks it, runs the function and returns the result as the next input. This split is the main safety point. Your code can refuse a call that breaks a rule, ask a person to approve it, or limit which records the function can return, whatever the model asked for.
- Give each tool one narrow job, with a description that says when to use it and when not to.
- Validate every argument before the function runs, and reject values outside the expected range.
- Return only the fields the model needs, so personal data is not sent back into the prompt by default.
- Log each request and each result so you can trace what the agent did.
The Responses API and OpenAI’s built-in tools
The Responses API lets one request carry the conversation state, the tool definitions and the model’s output items, which makes multi-step work easier to follow. OpenAI also offers built-in tools that run on its side, such as web search, file search over documents you upload, and tools that run code or shell commands in a hosted environment. The list changes over time, so read the current tool reference before you plan around any one of them.
Built-in tools save work for common jobs, such as answering from your uploaded policy documents. They also mean some data travels to OpenAI’s tool infrastructure, so check the data terms for each one before you use it with customer records. For anything that writes to your own systems, a custom function you control is usually the safer choice.
The Agents SDK: the loop, handoffs and guardrails
The Agents SDK gives you the loop in code. You define an agent with its instructions, attach its tools, and let the SDK run the cycle of model call, tool call and result until the model returns a final answer or a limit stops it. Current versions also include concepts for handing a task from one agent to another, checking inputs and outputs with guardrail functions, and recording traces so you can review each run.
The SDK speeds up the build, but it does not make an agent safe by itself. Set the maximum number of turns, write guardrails that match your business rules, and keep the approval step in code you own. Read the SDK’s current documentation for the exact names and options.
Data terms and where your data goes
Every request an agent makes sends the text it contains to the model provider. The API data terms differ from those of consumer chat products, and they change, so read OpenAI’s current business data terms and the agreement your company signs before you connect real customer data. The separate guide on using the OpenAI API for business covers projects, keys and regional options in more detail.
Whatever you decide, limit what each agent reads. Send only the records a task needs, remove fields that are not needed, and avoid placing secrets such as passwords or access tokens in prompts. The safest design gives the model the minimum it needs and keeps the full record in your own database.
Common mistakes when building on OpenAI
Most failures come from the surrounding design, not the model. Teams often hard-code one model name and find later that it has been replaced, so keep the model name in configuration. Others give a tool more access than the task needs.
Testing is the other common gap. Run the agent on a set of real past cases, including the awkward ones, and compare its tool calls with what a careful person would have done. Re-run the same set after every change to the instructions, the tools or the model.
- Pinning the agent to a model name that is not in configuration, so an upgrade needs a code change.
- Letting a tool write to a live system without a check or an approval step.
- Sending full customer files into every prompt when two fields would do.
- Skipping logs, which makes a wrong answer impossible to trace later.
How Hundred Seas helps
Hundred Seas is a product studio in Taipei that builds AI agents on Claude and on OpenAI models. We choose the model for each task on cost, speed, quality and where the client’s data has to stay, and we write the tools and approval steps around it so the agent only touches what it has been allowed to touch.
We begin with a scope step of about one week at a fixed price, which ends in a written plan and a firm quote. The build follows in weekly releases of working software, and a monthly run plan keeps the agent running and current as the models and the platform change.
Questions
- Do I need the Agents SDK to build an agent with OpenAI?
- No. You can write the loop yourself by calling the API, running each requested function and sending the result back. The SDK saves that work and provides structure for handoffs, guardrails and traces. Many teams start with the SDK because it reduces the code they must maintain, then decide whether the features fit their case.
- What is the difference between function calling and a built-in tool?
- With function calling, your own code runs the tool, so you control its access and logging. A built-in tool runs on OpenAI’s side, such as file search or web search. Built-in tools are quicker to start, but custom functions are usually better for anything that reads or writes your business systems.
- Can an OpenAI agent take actions in my CRM or email?
- Yes, if you give it a tool that does so. Your code performs the action, not the model. Start with read-only tools and drafts, and add write actions only behind an approval step once the agent has passed a test set of real cases.
- Where can I check the current models and features?
- Use OpenAI’s official documentation. Its API reference lists the models, the tool types, the SDK options and the deprecation notices. Model names and features change, so check those pages on the day you build, not a guide written earlier.
- Should my agent use OpenAI or another provider?
- Choose by task. Compare each provider on quality for your examples, speed, cost on your own sample, and where it processes data under its current terms. Keep the provider behind one configuration layer so you can switch later without rewriting the tools.