openai-agents-sdk-skill
Expert skill for implementing OpenAI Agents SDK with function tools, MCP server integration, and context management for building intelligent AI assistants.
npx skills add majiayu000/claude-skill-registry --skill openai-agents-sdk-skill --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
The skill defines a Todo assistant that uses OpenAI Agents SDK with OpenRouter as the model provider, and exposes a set of function tools to manage tasks (add, list, complete, update, delete). It includes an MCP server integration pathway to connect to an MCP server for extended workspace operations, as well as a context manager to track conversational history. It also provides a complete agent implementation that wires tools, context, and the OpenRouter-backed model configuration.
How it works
- Sets up an OpenRouter-backed model with environment-driven configuration (OPENROUTER_API_KEY, OPENROUTER_BASE_URL, OPENROUTER_MODEL) and creates RunConfig with the model and provider.
- Defines tools via function_tool wrappers: add_task, list_tasks, complete_task, update_task, delete_task, each returning structured Task-like data or dicts suitable for agent outputs.
- Provides MCP server integration through MCPServerStdio for extended capabilities, including setup, connection, and cleanup, and attaches MCP servers to the agent when available.
- Implements a ContextManager to initialize and manage a history list, add user/assistant messages, retrieve context, clear history, and add memory markers.
- Builds a Todo Assistant agent with a name, multi-line instructions, and a tools list. It optionally includes MCP server references and runs via Runner with the configured OpenRouter settings.
- Includes a usage example and an MCP server pattern section demonstrating a basic MCP server skeleton for todo operations.
When to use it
- When creating AI agents with function tools and structured outputs
- When integrating Model Context Protocol (MCP) servers
- When managing conversational history and context
- When building tool-enabled AI assistants
- When implementing dynamic tool filtering and security
What it can touch
- Tools exposed on the agent: add_task_tool, list_tasks_tool, complete_task_tool, update_task_tool, delete_task_tool
- MCPServerStdio for MCP integration (optional, if setup is invoked)
- Environment-driven model configuration for OpenRouter via OpenAI/RunConfig objects
Caveats
- Requires OPENROUTER_API_KEY to be set in environment variables; otherwise initialization raises a ValueError.
- The code includes placeholder production stubs (e.g., in-memory task data, mocked responses) indicating integration points with real services would be needed in production.
- The MCP server patterns section provides example code; actual server modules and entry points (e.g., app.mcp.todo_server, app.mcp.todo_operations) must exist in the project for full functionality.
# OpenAI Agents SDK Skill Use this skill when implementing AI assistants using the OpenAI Agents SDK with function tools, MCP server integration, and context management. ## When to Use - Creating AI agents with function tools and structured outputs - Integrating Model Context Protocol (MCP) servers - Managing conversational history and context - Building tool-enabled AI assistants - Implementing dynamic tool filtering and security ## Core Components ### 1. Agent Creation with OpenRouter ```python # app/agents/todo_agent.py import os from agents import Agent, Runner from agents import AsyncOpenAI, OpenAIChatCompletionsModel from agents.run import RunConfig from pydantic import BaseModel, Field from typing import Annotated import asyncio class TodoAgent: """AI agent for managing todo tasks with OpenAI Agents SDK using OpenRouter.""" def __init__(self, user_id: str): self.user_id = user_id # Setup OpenRouter client using specific configuration openrouter_api_key = os.getenv("OPENROUTER_API_KEY") openrouter_base_url = os.getenv("OPENROUTER_BASE_URL", "https://openrouter.ai/api/v1") openrouter_model = os.getenv("OPENROUTER_MODEL", "mistralai/devstral-2512:free") if not openrouter_api_ke
- When to Use
- Core Components
- 1. Agent Creation with OpenRouter
- 2. Function Tools with Pydantic Models
- 3. MCP Server Integration
- 4. Context Management and History
- 5. Complete Agent Implementation
- MCP Server Patterns
- 1. Basic MCP Server Implementation
- Best Practices
- 1. Security Considerations
- 2. Error Handling
- Integration with Existing Systems
- 1. Connecting to Todo Services
What does the openai-agents-sdk-skill skill do?
Expert skill for implementing OpenAI Agents SDK with function tools, MCP server integration, and context management for building intelligent AI assistants.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill openai-agents-sdk-skill --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
