[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3

Stateful Context & Tool Search

🚀 The Responses API 10 min 200 BASE XP⌨ HANDS-ON LAB

Persistent Conversations

Unlike Chat Completions where you manually manage message history, the Responses API can persist conversations server-side.

// First message
const r1 = await openai.responses.create({
  model: "o3-mini",
  store: true,
  input: "My name is Alex and I'm building a SaaS app."
});

// Follow-up - references the previous response
const r2 = await openai.responses.create({
  model: "o3-mini",
  store: true,
  previous_response_id: r1.id,
  input: "What tech stack would you recommend for my project?"
});

Tool Search

When you have dozens of function tools or MCP servers, loading all their schemas into context wastes tokens. Tool Search defers tool loading until the model needs them.

const response = await openai.responses.create({
  model: "o3-mini",
  tools: [
    { type: "function", name: "get_weather", ... },
    { type: "function", name: "book_flight", ... },
    // ... 50 more functions
  ],
  tool_search: true, // Only inject relevant tools
  input: "What's the weather in London?"
});
💡 Cost Saving: Tool Search can reduce input tokens by 80%+ when working with large tool catalogs. The model only sees the tools relevant to the current query.
⌨ HANDS-ON LABQuery Responses with Dynamic Tool Choice
⭐ +150 XP

OpenAI's tool search dynamically filters tools for the model. Fire a Responses API request with tool_choice set to auto.

1POST to /v1/responses with tool_choice set to auto across registered tools.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
How do you reference a previous conversation in the Responses API?
Send the full message history
Use the previous_response_id parameter
Create a Thread object
Store messages in a database