How to build agents with GPT-5

I will discuss how I am building agentic systems using GPT-5 from Opelai. I recently discussed how I use GPT-5 successfully, and today I will be continuing the GPT-5 Coverage by discussing successfully using GPT as an agent. Having agents with tools available in your application will soon be a basic user requirement for most AI applications, which is why you should start using them as soon as possible.
I'll cover how you can use GPT-5 as a powerful question-answering model by allowing access to your data and providing it with useful tools to answer user questions. This document aims to be a high-level overview of the possibilities you should use GPT-5 as an agent. I am not sponsored by Opena.
Why use GPT-5 as an agent?
Whenever you think about using a program like GPT-5 as an agent, it's always important to think about it that's it. You need to know why you are using it and what problem you are trying to solve. Some problems you may be working on are:
- Access to internal knowledge base
- Coding agent
- They get the workflow
These are all good reasons to use an agentic system, and GPT-5 is a tool that can help achieve all of these.
The main reason I chose to use GPT-5 for my agent is that I often work with a document corpus, and OpenAI has an integrated environment that is useful to solve the problems I am trying to solve.
In all the different sections of this article, I will cover the different tools available in Opena. Be aware that there are plenty of alternatives out there that are cheaper or better suited to your needs. Gemini's Gemini comes to mind as the most important platform with an open feature with Opelai, and you should definitely consider the rest. In addition, there are a plethora of open source tools out there.
Data access
Rag is a powerful way to gain access to your data. Usually, the rag is created artificially by entering information and entering your information before feeding it into a vector database such as pinecone. However, now there are good alternatives out there that actually offer managed rag services. Both OpenAI and Gemini offer an API to upload files, where they depend on and embed your files automatically, making it accessible with a simple API call. This provides easy and convenient access to your data. You can find details on this API page. Some of the example code I will show will be on this page.
After you have uploaded your documents and placed them in the vector storage, you can perform a vector search to find the right documents with:
user_query = "When is our latest data management agreement from?"
results = client.vector_stores.search(
vector_store_id=,
query=user_query,
)
This will return an array of documents and some chunks from those documents, similar to what pinecone does. You can continue to use these chunks to answer user questions.
However, you can make vector storage more powerful by giving GPT-5 access to it through a tool.
from openai import OpenAI
client = OpenAI(api_key="")
response = client.responses.create(
model="gpt-5",
input="When is our latest data management agreement from?",
tools=[{
"type": "file_search",
"vector_store_ids": [""]
}]
)
This is very powerful because now you have made the vector storage available in GPT-5 with the tool. When you now enter a user question, GPT-5 decides that it needs to use a tool to answer the user's question. When it determines that it needs to use a tool, GPT-5 does the following:
- Reasons for what tools or vector storage exist, and where to use them.
- Does the question rewrite: You write 5 different types of user quickly, but they are designed to get the right information about the rag.
- It praises 5 stimuli in parallel, and takes the most relevant documents
- It determines whether it has enough information to answer the user's question.
- If so, it answers the user's question
- Otherwise, it can search further in the vector(s)
This is a simple and powerful way to get your data, and OpenAI actually handles all the nice quirks:
- Folding and embedding documents
- Deciding when to perform a vector search
- Rewriting the question
- Finding relevant documents in accordance with questions
- Determining if there is enough information to answer the user's question
- To answer a User's question
Gemini recently made a rag-based system managed by their own api files, essentially providing the same service.
Use of GPT-5 tools
In the previous section, I discussed the last vector tool you can find available in GPT-5. However, you can also make another tool available in GPT-5. A classic example is providing GPT-5 access to Get_Weather The tool, so it can reach the current climate. The current example is from the OpenAi documentation.
from openai import OpenAI
client = OpenAI()
tools = [
{
"type": "function",
"name": "get_weather",
"description": "Get current temperature for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and country e.g. Bogotรก, Colombia",
}
},
"required": ["location"],
"additionalProperties": False,
},
"strict": True,
},
]
response = client.responses.create(
model="gpt-5",
input=[
{"role": "user", "content": "What is the weather like in Paris today?"},
],
tools=tools,
)
Now you need to decide what tools you should make available to your agent, so that they can better answer the questions you will provide. For example:
- If you are working with external databases, you must create a tool to search these databases, and inform the model that it will use the tool
- Python execution tool: You can give the model a tool to execute Python code, and see the result with
- Calculation tool: Instead of LLM doing the calculations itself (inefficient and error-prone), you can provide a calculation tool to calculate the calculation.
And so on. The important part here is that you give the agent the best opportunity to answer the user's questions as possible. However, it is also easy to make the mistake of making too many tools available. It is important that you follow the general guidelines in handing out tools to your agent, ensuring:
- Tools are always well explained
- Tools are not comparable: It should always be clear from the model (and any human learning of the tool) when the tool should be used, and when not
- Less overlap between tools
I touched on the topic of Agent ai tools more in my previous article How to build tools for AI Agents.
When we describe the GPT-5 tools, you can also provide guidance on whether a tool is needed or not. A necessary tool would be a vector search to search, where you force the model to search for a vector query in all user requests, ensuring the answers are always based on the document corpus. However, Get_Weather The function should be an optional function, processing the function should only be invoked when the user asks about the weather.
You can also make tools using connectors. Connectors are actually tools that provide other applications, such as:
This allows GPT to, for example, write your emails, search specific threads in slack, check designs in GITHI, or view code in GitHub.
Agents Pack
It's also worth mentioning that OpenAi has made an agent SDK that you can log in with Python or Tyraycript. Agents SDKs are useful for complex scenarios that create agents, where you need:
- Make the agent perform a complex, derived action
- Maintain context between tasks
For example, you can create specific agents, looking for specific tasks (retrieving information, summarizing information, etc.
There are many similar SDKS agents out there, which makes creating your own agent easy. Some good alternatives are:
- Langgraph
- Crewai
- Agent Development Kit
These packages all serve the same purpose of making AI Agents easier to create, and thus more accessible.
Lasting
In this article, I discussed how to use GPT-5 as an AI agent. I started discussing when you need to make agents, and why GPT-5 is one of the many good options. Then I was drawn to OpenAi's Vector storage, and how you can create a vector storage Super easily, and make it available to your agent as a tool. In addition, I discussed provisioning your agent with other custom tools and agent SDKs that you can use to create advanced agentic programs. Equipping your LLMS with tools is an easy way to empower your agents and enable them to respond to user queries. As I said at the beginning of this article, users will begin to expect that many AI applications will have agents available that can perform actions with tools, and this is a topic that you should read more about doing as soon as possible.
๐ Find me in the community:
๐ฉ Subscribe to my newsletter
๐ง๐ป Get in touch
๐ lickEdin
๐ฆ X / Twitter
โ๏ธ Medium
You can also read my article at:



