Short answer: How to build an AI agent with ChatGPT depends on where it should live. There are two routes. Inside ChatGPT you extend it with plugins that carry an MCP connection and reusable skills. In code you use the OpenAI Agents SDK, which installs with pip install openai-agents. OpenAI’s visual Agent Builder is scheduled to shut down on November 30, 2026, so do not start a new project on it.
This guide covers only OpenAI’s own tools. For the general path that works with any vendor, start with our guide on how to build an AI agent, then come back here for the ChatGPT-specific steps. If the word “agent” is still fuzzy, What Is an AI Agent? gives the definition.
Building an agent with ChatGPT at a glance
| Route 1: inside ChatGPT | Plugins that package an MCP connection, plus optional skills |
| Route 2: in code | The OpenAI Agents SDK, Python |
| Route 3: remote tools via API | A remote MCP tool in the Responses API |
| Managed option | The Agents API, where OpenAI runs the agent and saves its progress |
| Visual builder | Agent Builder, shutting down November 30, 2026 |
| Skills needed | None for plugins, Python basics for the SDK |
| What you pay for | Your OpenAI account; check OpenAI’s pricing page for rates |
| Best first project | One narrow job with one or two read-only tools |
Which OpenAI route fits you
OpenAI’s agents guide describes three code-level building blocks. The Agents API is a managed route for long-running tasks where OpenAI runs the agent and saves its progress. The Agents SDK runs inside your own application and, in OpenAI’s words, gives your application control over where it is deployed, how state is stored, how approvals work and how it plugs into the rest of your system. The Responses API is the lower level, where you work with model responses directly.
Pick by who runs the thing:
- You want ChatGPT itself to do more: build a plugin.
- You want an agent inside your own product or script: use the Agents SDK.
- You want OpenAI to host a long-running agent: look at the Agents API.
If you would rather not build at all, a ready-made agent may already do the job. ChatGPT Deep Research is a good example for research tasks, and our AI agent frameworks page compares the code options.
Route 1: extend ChatGPT with a plugin
OpenAI’s ChatGPT docs say a plugin “packages an MCP connection for use in ChatGPT” and can also contain skills with reusable instructions. ChatGPT on the web uses remote MCP tools through plugins. That makes a plugin the way to give ChatGPT new actions, such as reading from your project tracker.
What to know before you start:
- A plugin needs a remote MCP server, since the web app only uses remote tools. Our remote MCP servers guide explains the difference from local ones.
- In Business and Enterprise workspaces, “Use plugins” is on by default, while the two MCP publishing permissions are off by default. Ask your workspace admin if a setting is missing.
- Each person installs and connects with their own account.
- Old GPT custom actions do not migrate to plugins. Each connection has to be rebuilt.
To connect a server you already have, follow our step-by-step guide on adding MCP servers to ChatGPT. For ready-made servers to start with, Vercel MCP and the rest of the MCP servers directory list the ones that work with ChatGPT.
OpenAI’s page does not say which ChatGPT plans include these features, so check your own workspace before you plan around it.
Route 2: build in code with the Agents SDK
The SDK is the route most developers want. It gives you the agent loop and handoffs, and you keep control of where it runs.
Install it and set your key:
pip install openai-agents
export OPENAI_API_KEY=sk-...
Then run a first agent. This is the Hello World from the SDK docs:
from agents import Agent, Runner
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
print(result.final_output)
The SDK has a small set of parts:
| Part | What it does |
|---|---|
| Agent | A model with instructions and tools |
| Handoffs and agents as tools | Let one agent delegate a task to another |
| Guardrails | Validate what goes into and comes out of the agent |
Our OpenAI Agents SDK page lists the licence and the languages it supports. The official Agents SDK docs have the full reference.
Route 3: give the agent tools through MCP
An agent is only useful once it can act. OpenAI’s Responses API can call a remote MCP server as a tool, so you do not write a connector by hand. This example, from OpenAI’s docs, points at the public OpenAI Docs server. Replace the model name with one your account can use.
from openai import OpenAI
client = OpenAI()
resp = client.responses.create(
model="YOUR_MODEL",
tools=[
{
"type": "mcp",
"server_label": "openai_docs",
"server_description": "Search and read the public OpenAI documentation.",
"server_url": "https://developers.openai.com/mcp",
"require_approval": "never",
},
],
input="Search the OpenAI docs for Responses API streaming and return the relevant links.",
)
print(resp.output_text)
Two settings matter:
require_approvalcontrols whether you approve tool calls before data is sent to the server. Approval is requested by default. The example sets"never"only because the server is public and read-only. Use"always"for anything that writes.allowed_toolslimits which tools are imported from a server. Servers can expose dozens, and importing all of them can raise cost and latency.
Read the OpenAI guide to MCP and connectors before you connect a server that holds private data.
A first project that works
A good first agent has one input, one output and no side effects. Say you want an agent that answers questions about a public documentation site. Give it the job in one sentence, connect one read-only MCP server and ask it ten real questions. Read each answer next to the source it used. If it cites the wrong page, tighten the instructions before you add anything else.
Once that works, add one capability at a time. A second tool, a handoff to a specialist agent or a guardrail that checks the final answer are all reasonable next steps. Change one thing, rerun the same ten questions and compare. This is slower than wiring everything up on day one, but it tells you which change helped and which one broke the agent.
How to choose between the SDK and plugins
Ask who will use the agent. If the users are your teammates and they already work in ChatGPT, a plugin puts the new tools where they are, and each person connects with their own account. If the users are customers, or the agent runs on a schedule with no person in the chat, the SDK is the better fit because you control deployment and approvals.
Ask also where the data lives. A plugin sends data to the MCP server you connect, and so does the SDK, so the same caution applies to both. The difference is that with the SDK you decide in code which tools the agent may call, which makes it easier to keep the list short.
A note on Agent Builder
Agent Builder is a visual canvas for multi-step agent workflows, with templates, preview runs and an Evaluate tab. OpenAI’s docs now say the product is scheduled to shut down on November 30, 2026. Existing users can keep using it during the transition, and ChatKit, the embeddable chat interface, remains available. If you have an old workflow there, the docs offer a Code option that lets you copy the workflow and run it yourself with the Agents SDK. For anything new, start with the SDK.
Test it before you trust it
Run the agent on ten real examples of its job, not one easy demo. Keep write actions behind approval until it has a clean record. Start with read-only tools and add more one at a time. Our AI agents for beginners guide has a checklist for the first week.
What this can’t do
An agent built on these tools is still a model calling functions. It can misread a vague task, pick the wrong tool or repeat a step. An MCP server you did not write receives whatever data your agent sends it, so review what it can reach. The plugin route needs a remote server, and the SDK route needs you to host and monitor the code yourself. Skip both if a ready-made agent already does your job.
FAQ
Can I build an AI agent inside ChatGPT without code?
You can extend ChatGPT with a plugin that packages an MCP connection, but the server behind it has to exist. If you have no server, connect an existing one from our directory. Writing a new server takes code.
What is the OpenAI Agents SDK?
It is OpenAI’s library for building agents in your own application. It handles the agent loop and handoffs between agents, and it installs with pip install openai-agents.
Is Agent Builder still available?
For now, yes, for existing users. OpenAI says it is scheduled to shut down on November 30, 2026. Plan new work on the Agents SDK instead.
Do I need an API key?
For the SDK and the Responses API, yes. The SDK reads OPENAI_API_KEY from your shell. Check OpenAI’s pricing page for current rates.
How do I make an agent safer?
Keep approvals on for any tool that writes data, limit the tools it can import and test on real examples first. A person should stay responsible for anything touching money or customers.
For more agents grouped by the job they do, browse our best AI agent frameworks page and the MCP servers directory.
Can I build an AI agent inside ChatGPT without code?
What is the OpenAI Agents SDK?
pip install openai-agents.Is Agent Builder still available?
Do I need an API key?
OPENAI_API_KEY from your shell. Check OpenAI’s pricing page for current rates.