AI Agent Hub
AI エージェント / プラグイン情報メディア
← 一覧へ
OpenAI Agents SDK (Python)
CODEX

OpenAI Agents SDK (Python)

OpenAI Agents SDK (Python)

OpenAI 公式のエージェント構築 SDK。ハンドオフ / ガードレール / トレース機能で Codex 等のモデルをマルチエージェントに組み上げられる。

原文: A lightweight, powerful framework for multi-agent workflows
#SDK#Python#公式#agents#ai#framework#llm#openai#python
REPO STATS

リポジトリ統計

⭐ Stars
26k
🍴 Forks
4k
⚠️ Open Issues
60
🌿 Language
Python
📄 License
MIT
🕒 最終更新
2026.05.07 (今日)
📅 公開日
2025.03.11
🌿 Branch
main
README

ドキュメント

— AI による自動翻訳 (2026.05.07 更新)

OpenAI Agents SDK PyPI

OpenAI Agents SDK は、マルチエージェントワークフローを構築するための軽量でありながら強力なフレームワークです。プロバイダーに依存しない設計で、OpenAI Responses および Chat Completions API、さらに 100 以上の他の LLM に対応しています。

Agents Tracing UI の画像

注記

JavaScript/TypeScript バージョンをお探しですか?Agents SDK JS/TS をご確認ください。

コアコンセプト:

  1. エージェント: 指示、ツール、ガードレール、ハンドオフで構成された LLM
  2. Sandbox エージェント: コンテナで動作するように事前構成されたエージェント。長期間にわたって作業を実行します。
  3. ツールとしてのエージェント / ハンドオフ: 特定のタスクのために他のエージェントに委譲します
  4. ツール: 様々なツールがエージェントにアクション実行機能を提供します(関数、MCP、ホストされたツール)
  5. ガードレール: 入力と出力の検証のための設定可能なセーフティチェック
  6. 人間の関与: エージェント実行全体で人間を関与させるための組み込みメカニズム
  7. セッション: エージェント実行全体における自動会話履歴管理
  8. トレーシング: エージェント実行の組み込みトラッキング。ワークフローを表示、デバッグ、最適化できます
  9. リアルタイムエージェント: gpt-realtime-1.5 と完全なエージェント機能を使用して強力な音声エージェントを構築できます

examples ディレクトリを確認して実践的な使用例を見たり、詳細は ドキュメント をお読みください。

始める

まず Python 環境をセットアップし(Python 3.10 以上が必須)、OpenAI Agents SDK パッケージをインストールしてください。

venv

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install openai-agents

音声サポートについては、オプションの voice グループをインストールしてください: pip install 'openai-agents[voice]'。Redis セッションサポートについては、オプションの redis グループをインストールしてください: pip install 'openai-agents[redis]'

uv

uv に詳しい場合は、パッケージのインストールはさらに簡単です:

uv init
uv add openai-agents

音声サポートについては、オプションの voice グループをインストールしてください: uv add 'openai-agents[voice]'。Redis セッションサポートについては、オプションの redis グループをインストールしてください: uv add 'openai-agents[redis]'

最初の Sandbox エージェントを実行する

Sandbox エージェント はバージョン 0.14.0 の新機能です。Sandbox エージェントは、ファイルシステムとあなたが構成・管理するコンテナ環境で実際の作業を実行するエージェントです。Sandbox エージェントは、エージェントがファイルを検査したり、コマンドを実行したり、パッチを適用したり、長期的なタスク全体でワークスペースの状態を維持する必要がある場合に便利です。

from agents import Runner
from agents.run import RunConfig
from agents.sandbox import Manifest, SandboxAgent, SandboxRunConfig
from agents.sandbox.entries import GitRepo
from agents.sandbox.sandboxes import UnixLocalSandboxClient

agent = SandboxAgent(
    name="Workspace Assistant",
    instructions="Inspect the sandbox workspace before answering.",
    default_manifest=Manifest(
        entries={
            "repo": GitRepo(repo="openai/openai-agents-python", ref="main"),
        }
    ),
)

result = Runner.run_sync(
    agent,
    "Inspect the repo README and summarize what this project does.",
    # Run this agent on the local filesystem
    run_config=RunConfig(sandbox=SandboxRunConfig(client=UnixLocalSandboxClient())),
)
print(result.final_output)

# This project provides a Python SDK for building multi-agent workflows.

(実行時には OPENAI_API_KEY 環境変数を設定してください)

(Jupyter ノートブックユーザーの場合は hello_world_jupyter.ipynb をご覧ください)

examples ディレクトリを確認して実践的な使用例を見たり、詳細は ドキュメント をお読みください。

謝辞

オープンソースコミュニティ、特に以下の優れた成果に感謝します:

このライブラリの オプション依存関係は以下の通りです:

また、プロジェクト管理には以下のツールを使用しています:

私たちはコミュニティの他のメンバーが当社のアプローチを基に発展させることができるよう、Agents SDK をオープンソースフレームワークとして継続的に構築することに取り組んでいます。

— GitHub から取得した原文(一部省略の場合あり)

OpenAI Agents SDK PyPI

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows. It is provider-agnostic, supporting the OpenAI Responses and Chat Completions APIs, as well as 100+ other LLMs.

Image of the Agents Tracing UI

Note

Looking for the JavaScript/TypeScript version? Check out Agents SDK JS/TS.

Core concepts:

  1. Agents: LLMs configured with instructions, tools, guardrails, and handoffs
  2. Sandbox Agents: Agents preconfigured to work with a container to perform work over long time horizons.
  3. Agents as tools / Handoffs: Delegating to other agents for specific tasks
  4. Tools: Various Tools let agents take actions (functions, MCP, hosted tools)
  5. Guardrails: Configurable safety checks for input and output validation
  6. Human in the loop: Built-in mechanisms for involving humans across agent runs
  7. Sessions: Automatic conversation history management across agent runs
  8. Tracing: Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
  9. Realtime Agents: Build powerful voice agents with gpt-realtime-1.5 and full agent features

Explore the examples directory to see the SDK in action, and read our documentation for more details.

Get started

To get started, set up your Python environment (Python 3.10 or newer required), and then install OpenAI Agents SDK package.

venv

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install openai-agents

For voice support, install with the optional voice group: pip install 'openai-agents[voice]'. For Redis session support, install with the optional redis group: pip install 'openai-agents[redis]'.

uv

If you're familiar with uv, installing the package would be even easier:

uv init
uv add openai-agents

For voice support, install with the optional voice group: uv add 'openai-agents[voice]'. For Redis session support, install with the optional redis group: uv add 'openai-agents[redis]'.

Run your first Sandbox Agent

Sandbox Agents are new in version 0.14.0. A sandbox agent is an agent that uses a computer environment to perform real work with a filesystem, in an environment you configure and control. Sandbox agents are useful when the agent needs to inspect files, run commands, apply patches, or carry workspace state across longer tasks.

from agents import Runner
from agents.run import RunConfig
from agents.sandbox import Manifest, SandboxAgent, SandboxRunConfig
from agents.sandbox.entries import GitRepo
from agents.sandbox.sandboxes import UnixLocalSandboxClient

agent = SandboxAgent(
    name="Workspace Assistant",
    instructions="Inspect the sandbox workspace before answering.",
    default_manifest=Manifest(
        entries={
            "repo": GitRepo(repo="openai/openai-agents-python", ref="main"),
        }
    ),
)

result = Runner.run_sync(
    agent,
    "Inspect the repo README and summarize what this project does.",
    # Run this agent on the local filesystem
    run_config=RunConfig(sandbox=SandboxRunConfig(client=UnixLocalSandboxClient())),
)
print(result.final_output)

# This project provides a Python SDK for building multi-agent workflows.

(If running this, ensure you set the OPENAI_API_KEY environment variable)

(For Jupyter notebook users, see hello_world_jupyter.ipynb)

Explore the examples directory to see the SDK in action, and read our documentation for more details.

Acknowledgements

We'd like to acknowledge the excellent work of the open-source community, especially:

This library has these optional dependencies:

We also rely on the following tools to manage the project:

We're committed to continuing to build the Agents SDK as an open source framework so others in the community can expand on our approach.

RELATED

同じカテゴリの他のツール