OpenAI's stack and the Responses API
Agentic AI Foundations · Lesson 9 of 20 · 56:39
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Oracle Agentic AI Foundations Associate exam (1Z0-1157-26). In this lesson: OpenAI's stack (models, the Responses API, and the Agents SDK), calls and conversation state with previous_response_id, built-in tools (web search, file search, and code interpreter) and function calling, and how to choose the right layer. Includes three original practice questions, with Fairhaven Furniture, a fictional furniture seller, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Which layer to build on?
Fairhaven's second team prefers OpenAI's own tools to LangChain. Before writing any code, they must choose a layer: call the Responses API directly, or build on the Agents SDK. That choice decides how much of the agent they write themselves.
OpenAI's stack
OpenAI's agent stack has four layers. At the bottom are the models: reasoning models that think step by step for complex tasks, and faster models for quick answers. On top sits the Responses API, OpenAI's main API for agents: it can keep conversation state, offers built-in tools, and handles function calling. Above it, the Agents SDK is a higher level Python framework, built on the Responses API, for agents, multi-agent workflows, guardrails, and tracing. And at the top is your application: its business logic, its interface, and your own code.
A first response
The simplest call takes two parameters: the model, and the input, which can be a plain string. The response has an output_text property, with the text of the answer. Instructions play the role of a system prompt, and the input can also be a list of messages with roles. Compared with the older Chat Completions API, there's no message array to build, and no nested fields to read, and OpenAI recommends the Responses API for new projects, rather than Chat Completions or the older Assistants API.
Conversation state
With the older API, you sent the whole conversation history with every request, so long conversations cost more and more tokens. With the Responses API, you pass previous_response_id, set to the ID of the last response. OpenAI keeps the history on its servers, and links each response to the one before, so you do not send it again. That's especially useful when tools return large results, which no longer travel back and forth.
Built-in tools
The Responses API also has built-in tools, which you enable with one line in the tools list. Web search finds current information on the internet. File search searches documents that you've uploaded to OpenAI, for example product manuals. Code interpreter lets the model write and run Python code, for example to analyze data, and there are others, like computer use and image generation. The model decides when to use each tool: asked for the capital of France, it answers from what it knows, without searching.
Choosing a layer
So which layer should you build on? First question: do you need multiple steps? If not, for a question, perhaps one tool call, and an answer, use the Responses API: it's simple, direct, and gives you full control. If you do, but you need no multiple agents, guardrails, or orchestration, the Responses API still works, but you write the loop yourself. And if you need any of those, the Agents SDK gives you the loop, handoffs, guardrails, and tracing, so it's the right choice.
Recap
Let's recap. OpenAI's stack has four layers: models, the Responses API, the Agents SDK built on it, and your application. A response needs a model and an input, output_text holds the answer, and previous_response_id continues a conversation that OpenAI keeps on its servers. Built-in tools, like web search, file search, and code interpreter, take one line, and the model decides when to use them. Use the Responses API for simple calls and full control, and the Agents SDK for multiple agents, guardrails, and orchestration.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
A customer asks Fairhaven’s assistant several follow-up questions. The developer wants each request to continue the same conversation, without resending the earlier turns. What should each request include?
- The ID of the previous response
- The full message history, every time
- A new instructions string each turn
- The web_search tool in the tools list
Show the answer
The ID of the previous response
Previous_response_id links the new request to the last response, and OpenAI keeps the history on its servers. “The full message history, every time” is what the older Chat Completions API required, and it costs more tokens as the conversation grows. “A new instructions string each turn” sets the assistant's behavior, but carries no memory of earlier turns. And “The web_search tool in the tools list” would let the model search the internet, which has nothing to do with conversation state.
Fairhaven uploads its care and warranty guides to OpenAI, and wants the assistant to answer customers’ questions from them. Which built-in tool fits?
- Web search, for current pages
- Code interpreter, to run Python
- File search, over uploaded files
- Computer use, to click through them
Show the answer
File search, over uploaded files
File search searches documents uploaded to OpenAI, so the assistant can answer from Fairhaven's own guides. “Web search, for current pages” would search the public internet, not Fairhaven's private documents. “Code interpreter, to run Python” lets the model write and run Python code, for example to analyze data. And “Computer use, to click through them” would let the model control a computer interface, which is not needed to read documents.
Fairhaven’s developer builds a single agent that takes several steps, with no handoffs and no guardrails, and wants full control of every call. What’s true of using the Responses API?
- It cannot run more than one step
- It works, but they write the loop
- It requires the Agents SDK as well
- It hides each call from the developer
Show the answer
It works, but they write the loop
The Responses API can run a multi-step agent, but the developer writes the loop: calling tools, sending results back, and deciding when to stop. “It cannot run more than one step” is wrong, because nothing limits the Responses API to one step. “It requires the Agents SDK as well” is not required: the Agents SDK is built on the Responses API, not the other way around. And “It hides each call from the developer” is the opposite of the truth: calling the API directly gives full control of every call.