{
  "id": 22983990,
  "title": "OpenAI Agents SDK tutorial (Python): first agent, tools, handoffs, MCP",
  "url": "https://urgent.news/2026/12/01/openai-agents-sdk-tutorial-python-first-agent-tools-handoffs-mcp",
  "topic": "ai",
  "section": "AI",
  "published": "2026-12-01T17:21:32.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/pluginstackai/openai-agents-sdk-tutorial-python-first-agent-tools-handoffs-mcp-11i2"
  },
  "original_language": null,
  "account": "OpenAI's Agents SDK for Python provides a framework for building agents with models, instructions, tools, and the capability to pass conversations to other agents. This tutorial walks you through creating an agent that uses your own Python functions, routes questions between specialists, remembers earlier turns, and calls an MCP server.\n\nTo get started, ensure you have Python 3.10 or newer installed. Create a project folder with its own virtual environment to keep the SDK and its dependencies separate from your system Python. Install the openai-agents package using pip install openai-agents. Set the OPENAI_API_KEY environment variable in your terminal to authenticate with the OpenAI service.\n\nThe basic structure of an agent involves creating a model with instructions and tools. You can run the agent using the Runner.run() function in async code, which is suitable for web servers and running multiple agents simultaneously. Runner.run_sync() is an alternative for plain scripts, but it won't work inside an already running event loop.\n\nAgents can utilize function tools, which are ordinary Python functions that the model can decide to call. These tools are defined using the @tool decorator from the agents.decorators module. The SDK also supports hosted tools like WebSearchTool() and FileSearchTool(), which you can add to the tools list in the same way.\n\nOne of the key features of the Agents SDK is the ability to hand off conversations between agents. This allows for more specialized responses to complex queries. Each specialist agent should have a handoff_description to indicate when to route the conversation.",
  "summary": "OpenAI Agents SDK tutorial for Python Checked against the official docs: Nov 4, 2026 The OpenAI Agents SDK ( openai-agents on PyPI) is OpenAI's open-source Python framework for building agents: a model with instructions, tools it can call, and the option to hand a conversation to another agent. This tutorial goes from an empty folder to an agent that uses your own Python functions, routes…",
  "summary_source": "publisher",
  "key_points": [
    "Install Python 3.10+, create project folder with virtual environment",
    "Install openai-agents package via pip install openai-agents",
    "Agents can hand off conversations to specialized agents"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}