Openai Realtime Agents JP banner
Sunwood-ai-labs Sunwood-ai-labs

Openai Realtime Agents JP

Development community

Description

This is a simple demonstration of more advanced, agentic patterns built on top of the Realtime API.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

![Realtime API エージェントデモのスクリーンショット](/public/screenshot.png)

🤖 Realtime API エージェントデモ

[![GitHub stars](https://img.shields.io/github/stars/Sunwood-ai-labs/openai-realtime-agents?style=flat-square)](https://github.com/Sunwood-ai-labs/openai-realtime-agents/stargazers) [![License](https://img.shields.io/github/license/Sunwood-ai-labs/openai-realtime-agents?style=flat-square)](https://github.com/Sunwood-ai-labs/openai-realtime-agents/blob/main/LICENSE)

[![Next.js](https://img.shields.io/badge/Next.js-black?style=flat-square&logo=next.js)](https://nextjs.org/) [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![OpenAI](https://img.shields.io/badge/OpenAI-412991?style=flat-square&logo=openai&logoColor=white)](https://openai.com/)

OpenAI Realtime APIを活用した高度なエージェントパターンのデモンストレーションです。主に以下の機能を実装しています:

  • 定義されたエージェントグラフに基づく連続的なエージェント遷移 (OpenAI Swarmにインスパイアされています)
  • 重要な判断が必要な場合のo1-miniなどのより高度なモデルへのバックグラウンドエスカレーション
  • ステートマシンに基づくプロンプト制御(例:ユーザー認証時の名前や電話番号を1文字ずつ確認する機能)

このリポジトリを使用すれば、20分以内にマルチエージェントのリアルタイム音声アプリを構築できます!

🚀 セットアップ

  • Next.js + TypeScriptで構築されています
  • 依存関係のインストール: npm i
  • 環境変数にOPENAI_API_KEYを設定
  • サーバー起動: npm run dev
  • ブラウザでhttp://localhost:3000を開くと、自動的にsimpleExampleエージェントセットに接続されます

🤖 エージェントの設定

`src/app/agentConfigs/simpleExample.ts`での設定例:

import { AgentConfig } from "@/app/types";
import { injectTransferTools } from "./utils";

// エージェントの定義
const haiku: AgentConfig = {
  name: "haiku",
  publicDescription: "俳句を作成するエージェント", // agent_transfer toolのコンテキスト
  instructions:
    "ユーザーにテーマを尋ね、そのテーマに関する俳句を日本語で作成してください。",
  tools: [],
};

const greeter: AgentConfig = {
  name: "greeter",
  publicDescription: "ユーザーに挨拶をするエージェント",
  instructions:
    "ユーザーに日本語で挨拶し、俳句を聞きたいか尋ねてください。はいと答えた場合は'haiku'エージェントに転送してください。",
  tools: [],
  downstreamAgents: [haiku],
};

// d