<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh" -->

---
title: OpenAI Agents API: Build an AI Agent in Python | daily.dev
description: OpenAI's new Agents API lets you build an AI agent in plain Python with no framework to install, since OpenAI hosts the agent loop itself. The API entered...
canonical: https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: OpenAI Agents API: Build an AI Agent in Python | daily.dev
og:description: OpenAI's new Agents API lets you build an AI agent in plain Python with no framework to install, since OpenAI hosts the agent loop itself. The API entered...
og:url: https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh
og:image: https://api.daily.dev/og/posts/W6BMm1mJh.png
og:image:alt: OpenAI Agents API: Build an AI Agent in Python
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Agents API: Build an AI Agent in Python

**[Oxylabs](https://daily.dev/sources/oxylabs)** · 8 min read · 0 upvotes · 0 comments

## Summary

OpenAI's new Agents API lets you build an AI agent in plain Python with no framework to install, since OpenAI hosts the agent loop itself. The API entered public beta on September 10, is built on the harness powering Codex, and differs from the open-source Agents SDK where the loop runs in your own code. A demo agent asked for a Kindle Paperwhite's price first guesses $159.99 from training data, then after connecting to Oxylabs' hosted MCP Web Scraper API server, returns the live price of $199.99. The video also covers setup, API key scopes, streaming events, and caveats like beta instability, US-only data residency, and token usage not appearing in the stream.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=Ru1rINyyOZ8>

## Questions this post answers

### What is the difference between OpenAI's Agents API and the Agents SDK?

The Agents API is a hosted service where OpenAI runs the agent loop on its own servers, configured through a single API call specifying the model, instructions and tools. The Agents SDK, installed via pip install openai-agents, is an open-source package where the loop runs in your own code. OpenAI's docs call the SDK feature complete and point new projects toward the Agents API, which opened to public beta on September 10.

_Comparing agent-building approaches in Python gets easier with developer discussion curated on daily.dev._

### How do I connect an OpenAI agent to a hosted MCP server for web scraping?

Add a tool entry of type MCP with a label and a transport pointing to the server URL, passing a Basic auth token built from your credentials in the authorization field. Oxylabs hosts an MCP server at mcp.oxylabs.io exposing ten tools, four of which unlock Web Scraper API functionality, and setting required to True makes the turn fail if the server can't connect rather than silently continuing.

_Developers wiring MCP servers into agent workflows track these integration patterns on daily.dev._

### Why does an AI agent give a wrong price when asked about a live Amazon listing?

Without a tool to fetch live data, the agent answers from training data and has no way to know the current page content, giving an estimate like $159.99 for a Kindle Paperwhite. Adding a scraping tool over MCP let the same model and question return the actual live price of $199.99, a $40 difference, by calling a search tool to find the ASIN and a product tool to fetch the listing.

_Anyone debugging stale or hallucinated AI agent outputs can follow these grounding techniques on daily.dev._

## Similar posts on daily.dev

- [Building AI Agents in Python](https://daily.dev/posts/building-ai-agents-in-python-d6gjflukc) · Planet Python · 1 upvotes · 1 comments
- [The Ultimate Beginners’ Guide to Building an AI Agent in Python](https://daily.dev/posts/the-ultimate-beginners-guide-to-building-an-ai-agent-in-python-dkhiab38j) · Towards Data Science · 0 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#mcp](https://daily.dev/tags/mcp), [#crawling](https://daily.dev/tags/crawling)

[View this post on daily.dev](https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"OpenAI Agents API: Build an AI Agent in Python","url":"https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh"},"datePublished":"2026-10-22T16:18:16.885Z","dateModified":"2026-10-22T16:18:45.876Z","description":"OpenAI's new Agents API lets you build an AI agent in plain Python with no framework to install, since OpenAI hosts the agent loop itself. The API entered...","image":"https://i.ytimg.com/vi/Ru1rINyyOZ8/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/Ru1rINyyOZ8/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Oxylabs","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Oxylabs","logo":"https://media.daily.dev/image/upload/s--Nv1dkoGl--/f_auto/v1719003649/logos/oxylabs","url":"https://daily.dev/sources/oxylabs"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,mcp,crawling","timeRequired":"PT8M","video":{"@type":"VideoObject","name":"OpenAI Agents API: Build an AI Agent in Python","description":"OpenAI's new Agents API lets you build an AI agent in plain Python with no framework to install, since OpenAI hosts the agent loop itself. The API entered...","thumbnailUrl":"https://i.ytimg.com/vi/Ru1rINyyOZ8/sddefault.jpg","uploadDate":"2026-10-22T16:18:16.885Z","duration":"PT8M","url":"https://api.daily.dev/r/W6BMm1mJh","embedUrl":"https://www.youtube.com/embed/Ru1rINyyOZ8"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Oxylabs","item":"https://daily.dev/sources/oxylabs"},{"@type":"ListItem","position":3,"name":"OpenAI Agents API: Build an AI Agent in Python"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/openai-agents-api-build-an-ai-agent-in-python-w6bmm1mjh#faq","mainEntity":[{"@type":"Question","name":"What is the difference between OpenAI's Agents API and the Agents SDK?","acceptedAnswer":{"@type":"Answer","text":"The Agents API is a hosted service where OpenAI runs the agent loop on its own servers, configured through a single API call specifying the model, instructions and tools. The Agents SDK, installed via pip install openai-agents, is an open-source package where the loop runs in your own code. OpenAI's docs call the SDK feature complete and point new projects toward the Agents API, which opened to public beta on September 10. Comparing agent-building approaches in Python gets easier with developer discussion curated on daily.dev."}},{"@type":"Question","name":"How do I connect an OpenAI agent to a hosted MCP server for web scraping?","acceptedAnswer":{"@type":"Answer","text":"Add a tool entry of type MCP with a label and a transport pointing to the server URL, passing a Basic auth token built from your credentials in the authorization field. Oxylabs hosts an MCP server at mcp.oxylabs.io exposing ten tools, four of which unlock Web Scraper API functionality, and setting required to True makes the turn fail if the server can't connect rather than silently continuing. Developers wiring MCP servers into agent workflows track these integration patterns on daily.dev."}},{"@type":"Question","name":"Why does an AI agent give a wrong price when asked about a live Amazon listing?","acceptedAnswer":{"@type":"Answer","text":"Without a tool to fetch live data, the agent answers from training data and has no way to know the current page content, giving an estimate like $159.99 for a Kindle Paperwhite. Adding a scraping tool over MCP let the same model and question return the actual live price of $199.99, a $40 difference, by calling a search tool to find the ASIN and a product tool to fetch the listing. Anyone debugging stale or hallucinated AI agent outputs can follow these grounding techniques on daily.dev."}}]}
```

