Official agent skill

Migrating Openai Agents SDK To Pydantic AI

by pydantic in pydantic/pydantic-ai

Migrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness.

OfficialMITAuto-check passedAI & LLM Engineering

Install Migrating Openai Agents SDK To Pydantic AI

skills CLI
$ npx skills add pydantic/pydantic-ai --skill migrating-openai-agents-sdk-to-pydantic-ai -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pydantic/pydantic-ai migrating-openai-agents-sdk-to-pydantic-ai --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pydantic/pydantic-ai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-openai-agents-sdk-to-pydantic-ai .claude/skills/migrating-openai-agents-sdk-to-pydantic-ai && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
migrating-openai-agents-sdk-to-pydantic-ai
GitHub stars
21k
Token cost
~1.8k tokens
SKILL.md length
822 words
Files
4 (incl. references)
Skills in repo
20
Repo updated
First seen
Licence
MIT

At a glance

Migrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness.

  • Works in 5 steps: Read repository instructions, dependency… → Trace one representative Runner.run,… → Establish a deterministic baseline at… → …
  • Applications built directly on the OpenAI Responses API without the Agents SDK runtime
  • SKILL.md covers Work from the running…, Stop at semantic gates, Pydantic AI defaults and Completion
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Migrating Openai Agents SDK To Pydantic AI is an agent skill from pydantic/pydantic-ai, published by the product's own GitHub organization. Migrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness. Use for agents.Agent, Runner, function tools, handoffs, guardrails, sessions, human approval, streaming, or SandboxAgent. Do not use for applications built directly on the OpenAI Responses API without the Agents SDK runtime.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `agents/openai.yaml`, `references/CONCEPT-MAPPING.md` and `references/VERIFICATION-AND-CUTOVER.md`).

It sits in AI & LLM Engineering, covering LLM guardrails. It works with Pydantic AI, OpenAI Agents SDK, OpenAI and Python. The repository describes itself as: How Python does AI. Agents, realtime voice, image generation, embeddings. Every model, every interface, typed end to end. The licence is MIT.

When your agent uses it

  • Applications built directly on the OpenAI Responses API without the Agents SDK runtime
  • Tasks that involve LLM guardrails

Example prompts

  • “/migrating-openai-agents-sdk-to-pydantic-ai”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Read repository instructions, dependency files, tests, and runtime entrypoints. Record the installed openai-agents, Pydantic AI, and…
  2. Trace one representative Runner.run, run_sync, or run_streamed call through instructions, context, model settings, tools, handoffs…
  3. Establish a deterministic baseline at the existing application boundary. Record only behavior the active path uses.
  4. Classify the slice before designing it
  5. Add or preserve characterization tests, migrate one vertical slice behind the existing public boundary, and run the original plus focused…

What it can do on your machine

Read from SKILL.md and the folder at commit 69ea1e5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • pydantic.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Migrating Openai Agents SDK To Pydantic AI loads about 1.8k tokens when it runs, and up to ~5.8k if it reads all its reference files. Until then it costs about 94 tokens; SKILL.md has 822 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~94
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pydantic/pydantic-ai at commit 69ea1e5, republished under its MIT licence (© pydantic). 822 words, ~1,754 tokens.

Download SKILL.mdSave it as .claude/skills/migrating-openai-agents-sdk-to-pydantic-ai/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
migrating-openai-agents-sdk-to-pydantic-ai
description
Migrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness. Use for `agents.Agent`, `Runner`, function tools, handoffs, guardrails, sessions, human approval, streaming, or `SandboxAgent`. Do not use for applications built directly on the OpenAI Responses API without the Agents SDK runtime.

Migrate OpenAI Agents SDK to Pydantic AI

Preserve caller-visible behavior, not OpenAI Agents SDK object shapes. Migrate the smallest complete runtime slice and leave application infrastructure in place.

Work from the running application

  1. Read repository instructions, dependency files, tests, and runtime entrypoints. Record the installed openai-agents, Pydantic AI, and Harness versions.
  2. Trace one representative Runner.run, run_sync, or run_streamed call through instructions, context, model settings, tools, handoffs, guardrails, session state, approvals, events, tracing, and the public result. Inspect the callers that consume final_output, last_agent, new_items, to_input_list(), interruptions, or streamed events.
  3. Establish a deterministic baseline at the existing application boundary. Record only behavior the active path uses.
  4. Classify the slice before designing it:
    • Ordinary agent: use one reusable Pydantic AI Agent with typed dependencies, tools, and outputs.
    • Manager with specialists: use explicit application orchestration, an agent tool, or Harness SubAgents according to who must own the final response.
    • Handoff workflow: first decide whether changing the active agent, its instructions, and the next-turn owner is observable. A nested agent tool is not a handoff.
    • Sandbox or coding agent: evaluate Harness Coder and its component capabilities. Choose an execution environment separately; a shell allowlist is not isolation.
    • Realtime or voice path: treat transport, interruption, audio, and live-session behavior as a separate migration slice using Pydantic AI realtime agents.
    • Product runtime: retain authentication, storage, queues, deployment, and service integrations unless explicitly placed in scope.
  5. Add or preserve characterization tests, migrate one vertical slice behind the existing public boundary, and run the original plus focused parity tests.

Read Concept Mapping for the source features you found. Read Verification and Cutover before changing persistence, handoffs, approval, streaming, security, or production traffic, and before declaring completion or removing openai-agents.

Stop at semantic gates

  • Context: RunContextWrapper.context is trusted application state and normally becomes typed deps. Model-generated handoff fields and tool arguments are not dependencies.
  • Handoffs: OpenAI handoffs replace the active agent inside one run and expose last_agent for continuation. Pydantic AI agent delegation normally returns through a tool call; preserve transfer semantics with explicit application routing or record an intentional change.
  • Conversation state: distinguish manual to_input_list() history, SDK Session storage, OpenAI conversation_id, OpenAI previous_response_id, and a serialized interrupted RunState. Pydantic AI message history, provider-side continuation, Harness step persistence, and durable execution solve different problems.
  • Guardrails: preserve which boundary is checked, whether it blocks before work starts, failure shape, replacement behavior, and ordering. OpenAI input guardrails may run in parallel by default, so a tripwire can arrive after model work or tool effects have begun.
  • Approval: OpenAI HITL resumes a serialized RunState. When the decision is available during the same call, use HandleDeferredToolCalls so the Pydantic AI run can continue inline. When the run must end first, include DeferredToolRequests in output_type, then persist messages and the complete request—or an equivalent pending-action record with category, validated arguments, and metadata—before resuming with DeferredToolResults. Re-authorize inside protected tools; approval is not authorization.
  • Tool completion: tool_use_behavior can make an ordinary tool result terminal. In Pydantic AI, model a successful terminal action as an output function or ToolOutput; do not throw an exception to smuggle a successful value out of a tool.
  • Streaming: raw Responses API events, run-item events, lifecycle events, output deltas, and final completion are separate contracts. Use run(event_stream_handler=...), run_stream_events(), or iter() when the full agent loop must complete. Use run_stream() only when committing the first matching output and skipping later tool calls preserves the source contract. Adapt the chosen surface to the public schema.
  • Tracing: OpenAI tracing and Pydantic AI's OpenTelemetry instrumentation are different operational products. Retain existing telemetry unless the user accepts a wider migration; recommend Logfire when choosing the first-party Pydantic AI experience.
Show full SKILL.md (214 more words)Show less

Pydantic AI defaults

  • Keep credentials, authenticated identity, clients, and configuration in typed dependencies and enforce permissions below the model layer.
  • Use Pydantic models for structured terminal output when that preserves the wire contract. Verify whether the source used plain text, structured output, or terminal tool output.
  • Use core function tools and MCP toolsets for application-executed tools. Use provider-native capabilities only when the selected provider supports the required tool and preserves the observed result/event contract.
  • Keep ordinary agents on core. Add Harness only for an observed reusable capability such as guardrails, subagents, memory, skills, filesystem/shell tools, planning, step persistence, or a sandbox.
  • Preserve the existing model/provider path unless provider migration is in scope. Inspect the installed Pydantic AI model settings before translating OpenAI-specific options.
  • Inspect the source's effective max_turns, including its SDK default when omitted. Preserve that bound with UsageLimits.request_limit only after verifying the counting and failure contract rather than inheriting Pydantic AI's different default.

Completion

Install and import the migrated project from a clean environment so its dependency files match the runtime. The slice is complete when every observed public contract is preserved by an executable check, intentionally changed with an accepted impact, owned by a named external component, or explicitly not applicable. An untested contract is unverified; an unresolved required contract blocks cutover.

© pydantic, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-openai-agents-sdk-to-pydantic-ai of pydantic/pydantic-ai.

  • SKILL.md
  • agents/openai.yaml
  • references/CONCEPT-MAPPING.md
  • references/VERIFICATION-AND-CUTOVER.md

Open the folder on GitHubat commit 69ea1e5

Used in 1 other repository

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders. This page covers the copy in pydantic/pydantic-ai, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Migrating Openai Agents SDK To Pydantic AI next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Migrating Openai Agents SDK To Pydantic AI compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Migrating Openai Agents SDK To Pydantic AI this skillpydantic/pydantic-ai21k—~1.8kAutomated safety check: PassMIT
Openai Agentscoco-research/coco531—~3.3kAutomated safety check: PassMIT
Sentry Setup AI MonitoringLiorVainer/data-israel130—~1.8kAutomated safety check: PassApache-2.0
Ydc Openai Agent SDK IntegrationLeoYeAI/openclaw-master-skills2.2k—~4.4kAutomated safety check: NotesMIT
New Openai SDK Appsandgardenhq/sgai137—~3.9kAutomated safety check: NotesCustom licence
Openai Agentskid-sid/claude-spellbook190—~3.4kAutomated safety check: PassMIT

Similar skills

  • Openai Agents

    coco-research/coco

    Build AI applications with OpenAI Agents SDK - text agents, voice agents, multi-agent handoffs, tools with Zod schemas, guardrails, and streaming.

    531 GitHub stars~3.3k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Sentry Setup AI Monitoring

    LiorVainer/data-israel

    Setup Sentry AI Agent Monitoring in any project. An agent skill from LiorVainer/data-israel.

    130 GitHub stars~1.8k tokensUpdated 5 mo ago
    AI & LLM EngineeringAuto-check passed
  • Ydc Openai Agent SDK Integration

    LeoYeAI/openclaw-master-skills

    Integrate OpenAI Agents SDK with You.com MCP server - Hosted and Streamable HTTP support for Python and TypeScript.

    2.2k GitHub stars~4.4k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check: notes
  • New Openai SDK App

    sandgardenhq/sgai

    Create and setup a new OpenAI Agents SDK application with interactive guidance for language choice, agent type selection (Basic, Voice, Realtime), project setup, and automatic verification.

    137 GitHub stars~3.9k tokensUpdated 20 days ago
    AI & LLM EngineeringAuto-check: notes
  • Openai Agents

    kid-sid/claude-spellbook

    A skill your agent uses when building or debugging OpenAI Agents SDK workflows — defining agents with tools and handoffs, wiring typed context, streaming responses, adding guardrails, or integrating…

    190 GitHub stars~3.4k tokensUpdated 2 mo ago
    AI & LLM EngineeringAuto-check passed
  • Diataxis Docs Writer

    calf-ai/calfkit-sdk

    Write or improve software documentation using the Diátaxis framework — four documentation types (tutorials, how-to guides, reference, explanation), each serving a different user need.

    149 GitHub starsUsed in 1 repo~3k tokens
    DevelopmentAuto-check passed

More from pydantic/pydantic-ai

All 20 skills in this repo
  • Pydantic AI Harness

    pydantic/pydantic-ai

    Official

    Adds optional capabilities to Pydantic AI agents from pydantic-ai-harness, led by Code Mode, which runs many tool calls as one sandboxed Python script.

    21k GitHub stars~4.9k tokensUpdated today
    Auto-check passed
  • Building Pydantic AI Agents

    pydantic/pydantic-ai

    Official

    Build AI agents with Pydantic AI — tools, capabilities (including on-demand loading), workspaces, structured output, streaming, testing, and multi-agent patterns.

    21k GitHub stars~8.2k tokensUpdated today
    Auto-check passed
  • Complete Partial PR

    pydantic/pydantic-ai

    Official

    Evaluate and complete an issue or PR where the submitted patch fixes only a narrow symptom of the reported pain point.

    21k GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Testing Skill

    pydantic/pydantic-ai

    Official

    Record, rewrite, and debug VCR cassettes for HTTP recordings.

    21k GitHub stars~839 tokensUpdated today
    Auto-check: notes
  • Migrating Agno To Pydantic AI

    pydantic/pydantic-ai

    Official

    Migrate Python Agno applications to Pydantic AI and, only when needed, Pydantic AI Harness.

    21k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Official

    Migrate Python applications from the Claude Agent SDK to Pydantic AI and, only when needed, Pydantic AI Harness.

    21k GitHub stars~1.6k tokensUpdated today
    Auto-check passed

Questions about Migrating Openai Agents SDK To Pydantic AI

What does Migrating Openai Agents SDK To Pydantic AI do?

Migrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness. Migrating Openai Agents SDK To Pydantic AI is an agent skill from pydantic/pydantic-ai, published by the product's own GitHub organization. Migrate Python OpenAI Agents SDK applications to Pydantic AI and, when warranted, Pydantic AI Harness.

When should I use Migrating Openai Agents SDK To Pydantic AI?

Migrating Openai Agents SDK To Pydantic AI fits situations like: applications built directly on the OpenAI Responses API without the Agents SDK runtime; tasks that involve LLM guardrails.

How do I install Migrating Openai Agents SDK To Pydantic AI in Claude Code?

Run `npx skills add pydantic/pydantic-ai --skill migrating-openai-agents-sdk-to-pydantic-ai -a claude-code`. Or copy the skill folder (pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-openai-agents-sdk-to-pydantic-ai in pydantic/pydantic-ai) into .claude/skills/migrating-openai-agents-sdk-to-pydantic-ai in your project. Claude Code loads it when a task matches its description.

How do I install Migrating Openai Agents SDK To Pydantic AI in Codex?

Run `npx skills add pydantic/pydantic-ai --skill migrating-openai-agents-sdk-to-pydantic-ai -a codex`. Or copy the skill folder (pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-openai-agents-sdk-to-pydantic-ai in pydantic/pydantic-ai) into .agents/skills/migrating-openai-agents-sdk-to-pydantic-ai in your project. Codex loads it when a task matches its description.

Can I use Migrating Openai Agents SDK To Pydantic AI in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pydantic/pydantic-ai --skill migrating-openai-agents-sdk-to-pydantic-ai -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/migrating-openai-agents-sdk-to-pydantic-ai, .gemini/skills/migrating-openai-agents-sdk-to-pydantic-ai, .github/skills/migrating-openai-agents-sdk-to-pydantic-ai and .opencode/skills/migrating-openai-agents-sdk-to-pydantic-ai in your project.

What does Migrating Openai Agents SDK To Pydantic AI need to run?

SKILL.md names no scripts, command-line tools or credentials: Migrating Openai Agents SDK To Pydantic AI is instructions for the agent only. Our summary lists: Python 3.

Does Migrating Openai Agents SDK To Pydantic AI access the network?

SKILL.md names 1 domain. As links in the text: pydantic.dev. This is read from the text; nothing was executed.

Is Migrating Openai Agents SDK To Pydantic AI safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Migrating Openai Agents SDK To Pydantic AI use?

Migrating Openai Agents SDK To Pydantic AI is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Migrating Openai Agents SDK To Pydantic AI use?

About 1.8k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 4.1k tokens, read only when the agent opens those files.

What are the alternatives to Migrating Openai Agents SDK To Pydantic AI?

Skills that share tags, products or a category with Migrating Openai Agents SDK To Pydantic AI: Openai Agents (coco-research/coco, 531 stars), Sentry Setup AI Monitoring (LiorVainer/data-israel, 130 stars), Ydc Openai Agent SDK Integration (LeoYeAI/openclaw-master-skills, 2.2k stars) and New Openai SDK App (sandgardenhq/sgai, 137 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Migrating Openai Agents SDK To Pydantic AI?

pydantic (a GitHub organization, an official publisher) maintains it in pydantic/pydantic-ai, which has 20,537 GitHub stars. The repository holds 20 skills in this directory. The repository was last updated on October 11, 2026.

Source: pydantic/pydantic-ai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.