Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

mehmet akar
mehmet akar

Posted on • Originally published atmehmetakar.dev

Openai Agents SDK, Responses Api Tutorial

Openai Agents SDK, Responses Api is the new tools provided by Openai. I want to talk aboutOpenAI's New Tools for Building Intelligent Agents

Openai Agents SDK, Responses API

OpenAI has introduced a suite of new tools aimed at empowering developers and enterprises to build more sophisticated and reliable AI agents. These enhancements mark a significant step in making AI-driven applications more adaptable, efficient, and accessible.

Openai Responses API

TheResponses API is OpenAI’s new API primitive for leveraging built-in tools to build agents. It combines the simplicity of Chat Completions with the tool-use capabilities of the Assistants API. The API provides a more flexible foundation for developers by enabling multi-tool use and multiple model turns within a single API call.

  • Supportsweb search, file search, and computer use as built-in tools.
  • Offersa unified item-based design for easier management.
  • Allowsintuitive streaming events and simplified SDK access viaresponse.output_text.
  • Enablesbetter data storage and evaluation capabilities for agent performance analysis.

TheResponses API is available today, with standard pricing applying to tokens and tools used.

OpenAI’s Responses Api in action:

Openai Agents SDK

Openai Agents SDK

A major highlight is the release of anadvanced agent-building framework, which simplifies the integration of AI into complex workflows. The new tools allow for:

  • Seamless orchestration of multiple AI models.
  • Memory capabilities for agents to retain information across interactions.
  • Better security and compliance features to ensure enterprise-grade usage.
  • Multi-agent workflows that allow developers to integrate agents that work collaboratively.
  • Configurable handoffs between AI agents based on task requirements.

For example,Coinbase used the Agents SDK to prototype and deploy AgentKit, which enables AI agents to interact withcrypto wallets and other on-chain activities in just a few hours.

OpenAI’s Agents SDK in action:

New Built-in Tools for Agents

Web Search

Developers have already been utilizing web search for a variety of use cases, including shopping assistants, research agents, and travel booking agents—any application that requires timely information from the web. for a variety of use cases including shopping assistants, research agents, and travel booking agents—any application that requires timely information from the web.

One example isHebbia, which leverages the web search tool to help asset managers, private equity and credit firms, and law practices quickly extract actionable insights from extensive public and private datasets. to help asset managers, private equity and credit firms, and law practices quickly extract actionable insights from extensive public and private datasets. By integrating real-time search capabilities into their research workflows, Hebbia delivers richer, context-specific market intelligence and continuously improves the precision and relevance of their analyses, outperforming current benchmarks.

The web search tool in the API is powered by the same model used for ChatGPT search. Benchmarks such asSimpleQA, which evaluates the accuracy of LLMs in answering short, factual questions, show thatGPT‑4o search preview andGPT‑4o mini search preview achieve scores of90% and 88%, respectively.. OnSimpleQA, a benchmark that evaluates the accuracy of LLMs in answering short, factual questions,GPT‑4o search preview andGPT‑4o mini search preview score90% and 88% respectively.

SimpleQA Accuracy Benchmark

openai-response-api

Responses generated with web search in the API include links to sources, such as news articles and blog posts, allowing users to engage with more information while also giving content owners opportunities to reach a broader audience., such as news articles and blog posts, giving users a way to learn more. With these clear, inline citations, users can engage with information in a new way, while content owners gain new opportunities to reach a broader audience.

Additionally, websites and publishers have the option to appear in web search results within the API, enhancing visibility for their content.

Theweb search tool is available to all developers in preview in theResponses API. Developers also have direct access to OpenAI’s fine-tuned search models viagpt-4o-search-preview andgpt-4o-mini-search-preview in the Chat Completions API. Pricing starts at\$30 per 1,000 queries for GPT‑4o search and\$25 per 1,000 queries for GPT‑4o-mini search.

  • Providesfast, up-to-date answers with citations from the web.
  • Available inGPT-4o andGPT-4o-mini.
  • Enablesshopping assistants, research agents, and travel booking bots.

Example:

constresponse=awaitopenai.responses.create({model:"gpt-4o",tools:[{type:"web_search_preview"}],input:"What was a positive news story that happened today?",});console.log(response.output_text);
Enter fullscreen modeExit fullscreen mode

File Search

  • Retrievesrelevant information from large document volumes.
  • Supportsquery optimization, metadata filtering, and reranking.
  • Helps withcustomer support, legal research, and technical documentation queries.

Example:

constproductDocs=awaitopenai.vectorStores.create({name:"Product Documentation",file_ids:[file1.id,file2.id,file3.id],});constresponse=awaitopenai.responses.create({model:"gpt-4o-mini",tools:[{type:"file_search",vector_store_ids:[productDocs.id],}],input:"What is deep research by OpenAI?",});console.log(response.output_text);
Enter fullscreen modeExit fullscreen mode

Computer Use Automation

Developers can use the computer use tool to automate browser-based workflows like performing quality assurance on web apps or executing data-entry tasks across legacy systems.

One example isUnify, a system designed to streamline revenue growth through AI agents. By leveraging OpenAI’s computer use tool, Unify’s agents can access previouslyunreachable data via APIs—such as verifying a business’s real estate expansion throughonline maps. This analysis serves as acustom trigger for personalized outreach, allowing go-to-market teams to engage buyers with greater accuracy and efficiency.

Another example isLuminai, which has integrated the computer use tool toautomate operational workflows for large enterprises struggling with legacy systems lacking API support. In a pilot project with a major community service organization,Luminai automated the application processing and user enrollment process in just days, something traditional robotic process automation (RPA) systems had failed to achieve in months.

Before launchingComputer-Using Agent (CUA) in Operator last year, OpenAI conducted extensivesafety testing and red teaming, addressing three primary risks:misuse, model errors, and frontier risks. With the introduction of CUA in the API, OpenAI has implemented additional safeguards, including:

  • Safety checks to guard against prompt injections.
  • Confirmation prompts for sensitive actions.
  • Tools to help developers isolate execution environments.
  • Enhanced detection of potential policy violations.

Despite these mitigations, the model is still susceptible toerrors, particularly in non-browser environments. Benchmark tests show thatCUA’s performance on OSWorld is 38.1%, indicating the need forhuman oversight in real-world automation scenarios.

Benchmark Comparison for OSWorld, WebArena, and WebVoyager

openai-agents-sdk-computer-use

Starting today, thecomputer use tool is available as aresearch preview in theResponses API for select developers inusage tiers 3-5. Pricing is set at\$3 per 1M input tokens and\$12 per 1M output tokens.

Developers can now build AI-powered tools that performcomputer automation tasks, including:

  • Capturing mouse and keyboard actions.
  • Automating workflows across multiple software applications.
  • Enhancing enterprise productivity through AI-driven task execution.

Example:

constresponse=awaitopenai.responses.create({model:"computer-use-preview",tools:[{type:"computer_use_preview",display_width:1024,display_height:768,environment:"browser",}],truncation:"auto",input:"I'm looking for a new camera. Help me find the best one.",});console.log(response.output);
Enter fullscreen modeExit fullscreen mode

4. AI Safety and Governance Enhancements

Recognizing the importance of responsible AI use, OpenAI has reinforced its safety measures with:

  • Stronger bias detection algorithms.
  • More transparent AI decision-making processes.
  • Advanced compliance tracking tools for regulatory requirements.
  • Additional safety evaluations for automation-related risks.

Openai Agents SDK Tutorial

OpenAI has also provided newcode examples for integrating AI into applications efficiently:

Example: Using the Agents SDK to build AI agents

fromagentsimportAgent,Runner,WebSearchTool,function_tool@function_tooldefsubmit_refund_request(item_id:str,reason:str):return"success"support_agent=Agent(name="Support & Returns",instructions="You are a support agent who can submit refunds",tools=[submit_refund_request],)shopping_agent=Agent(name="Shopping Assistant",instructions="You are a shopping assistant who can search the web",tools=[WebSearchTool()],)triage_agent=Agent(name="Triage Agent",instructions="Route the user to the correct agent.",handoffs=[shopping_agent,support_agent],)output=Runner.run_sync(starting_agent=triage_agent,input="What shoes might work best with my outfit so far?",)print(output)
Enter fullscreen modeExit fullscreen mode

Deprecation of the Assistants API

OpenAI has announced that theAssistants API will be deprecated by mid-2026 in favor of theResponses API. Developers are encouraged to migrate applications to the Responses API, which offers:

  • Full feature parity with Assistants API.
  • Support for Assistant-like and Thread-like objects.
  • Better flexibility, speed, and efficiency.

A detailedmigration guide will be provided by OpenAI closer to the sunset date.

Openai Agents SDK, Responses API: Final Thoughts

OpenAI continues to push the boundaries of what’s possible with artificial intelligence. With these new tools, businesses and developers can createsmarter, safer, and more scalable AI solutions. As these advancements roll out, the AI landscape is set to become more innovative and impactful than ever before.

For more details, visit OpenAI’s official announcement here:openai.com/news

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I am Startup Hunter & Programming-DB Geek. I will try to give some insights about fresh AI-ML & Dev. Tools Startups, programming tools, DBs, new services and its problems&solutions.
  • Location
    Bursa, Türkiye
  • Education
    Koc University, Istanbul, Türkiye.
  • Work
    Independent Researcher
  • Joined

More frommehmet akar

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp