> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# クイックスタート

このガイドでは、最初の会話型エージェントを作成する方法を説明します。ビジネスユースケースに合わせた会話ワークフローを構築するための基盤となります。

> **Tip**
>
> [ElevenLabs agentsスキル](https://github.com/elevenlabs/skills/tree/main/agents)を使用すると、AIコーディングアシスタントから音声エージェントを構築・管理できます。
>
> ```bash
> npx skills add elevenlabs/skills --skill agents
> ```
>
> [ホスト型MCPサーバー](/docs/ja/eleven-agents/operate/hosted-mcp)をClaudeやその他のMCPクライアントに接続すれば、自然言語でエージェントを作成・管理することもできます。

## はじめに

ElevenLabs Agentsは、[ElevenAgentsダッシュボード](https://elevenlabs.io/app/agents)、[ElevenLabs API](/docs/ja/api-reference/introduction)、[Agents CLI](/docs/ja/eleven-agents/operate/cli)、または[ホスト型MCPサーバー](/docs/ja/eleven-agents/operate/hosted-mcp)から管理できます。

![ElevenLabs Agents](/docs/_fern-img/62ad20de44cee44a439b138d56764c801c4eb939cf3b0f167f594d5c6a6895fb.webp)

## 最初のエージェントを作成する

このクイックスタートガイドでは、まずAPIまたはWebダッシュボードでエージェントを作成します。次に、Webサイトへの埋め込みまたはElevenLabsダッシュボードを使ってエージェントをテストします。

#### Webダッシュボードでエージェントを構築

このガイドでは、プロダクト、ドキュメント、サービスに関する質問に回答できる会話型サポートアシスタントを作成します。このアシスタントをWebサイトやアプリに埋め込むことで、顧客にリアルタイムサポートを提供できます。

![ElevenLabs Agents](/docs/_fern-img/62ad20de44cee44a439b138d56764c801c4eb939cf3b0f167f594d5c6a6895fb.webp)

#### ElevenLabsにサインイン

[elevenlabs.io](https://elevenlabs.io/app/sign-up)にアクセスし、サインインまたはアカウントを作成してください。

#### 新しいアシスタントを作成

**ElevenLabsダッシュボード**で、名前を入力し、`Blank template`オプションを選択して新しいアシスタントを作成します。

![ダッシュボード](/docs/_fern-files/elevenlabs.docs.buildwithfern.com/61b0e1df291ea587a8ff3e116579a47f66d48c74b24f44cfcd4804a568eb0a9d/assets/images/conversational-ai/assistant-create-flow.gif)

#### アシスタントの動作を設定

**Agent**タブに移動して、アシスタントの動作を設定します。以下を設定してください。

#### 最初のメッセージ

ユーザーが会話を開始したときに、アシスタントが最初に音声で話すメッセージです。

**`First message`**

```plaintext First message
Hi, this is Alexis from <company name> support. How can I help you today?
```

#### システムプロンプト

このプロンプトで、アシスタントの動作、タスク、個性を指定します。

以下の例を会社の情報に合わせてカスタマイズしてください。

**`System prompt`**

```plaintext System prompt
You are a friendly and efficient virtual assistant for [Your Company Name]. Your role is to assist customers by answering questions about the company's products, services, and documentation. You should use the provided knowledge base to offer accurate and helpful responses.

Tasks:
- Answer Questions: Provide clear and concise answers based on the available information.
- Clarify Unclear Requests: Politely ask for more details if the customer's question is not clear.

Guidelines:
- Maintain a friendly and professional tone throughout the conversation.
- Be patient and attentive to the customer's needs.
- If unsure about any information, politely ask the customer to repeat or clarify.
- Avoid discussing topics unrelated to the company's products or services.
- Aim to provide concise answers. Limit responses to a couple of sentences and let the user guide you on where to provide more detail.
```

#### ナレッジベースを追加

**Knowledge Base**セクションに移動し、ビジネスに関するコンテキストをアシスタントに提供します。

ここで、関連ドキュメントや外部リソースへのリンクをアップロードできます。

* ドキュメント、FAQ、その他のリソースを追加して、アシスタントが顧客からの問い合わせに回答できるようにします。
* アシスタントが正確で最新の情報を提供できるよう、ナレッジベースを常に最新の状態に保ちます。

次に、アシスタントの音声を設定します。

#### 音声を選択

**Voice**タブで、[ボイスライブラリ](https://elevenlabs.io/voice-library)からアシスタントに最も適した音声を選択します。

![音声設定](/docs/_fern-img/14aad328f468daafa9ec95d3b7a55489a8cb1a34869368020e05b207c9b0360a.webp)

> **Note**
>
> 高品質な音声、モデル、LLMを使用すると、応答時間が長くなる場合があります。最適な顧客体験のために、アシスタントの想定ユースケースに応じて品質とレイテンシーのバランスを取ってください。

#### アシスタントをテスト

**Test AI agent**ボタンを押して、アシスタントと会話してみてください。

評価基準とデータ収集を設定し、会話を分析してアシスタントのパフォーマンスを改善します。

#### 評価基準を設定

アシスタント設定の**Analysis**タブに移動し、会話を評価するカスタム基準を定義します。

![分析設定](/docs/_fern-img/fee8bc444d5436c71eae3829b9ec8d5cdb6a57c4d4efe6483d7bfed2b066e438.webp)

各会話の文字起こしはLLMに渡され、特定の目標が達成されたかどうかが検証されます。結果は`success`、`failure`、`unknown`のいずれかになり、選択された結果の理由も表示されます。

`solved_user_inquiry`という名前の評価基準を追加してみましょう。

**`Prompt`**

```plaintext Prompt
The assistant was able to answer all of the queries or redirect them to a relevant support channel.

Success Criteria:
- All user queries were answered satisfactorily.
- The user was redirected to a relevant support channel if needed.
```

#### データ収集を設定

**Data collection**セクションで、各会話から抽出する詳細を設定します。

**Add item**をクリックし、以下を設定します。

1. **データ型：**「string」を選択
2. \*\*識別子：\*\*このデータポイントの一意の識別子を入力：`user_question`
3. \*\*説明：\*\*文字起こしから特定のデータを抽出する方法について、LLM向けの詳しい指示を指定します。

**`Prompt`**

```plaintext Prompt
Extract the user's questions & inquiries from the conversation.
```

> **Tip**
>
> 顧客になりきってアシスタントをテストしてください。質問をし、応答を評価して、パフォーマンスに満足できるまでプロンプトを調整します。

#### 会話履歴を確認

**Call history**タブで、各会話の評価結果と収集データを確認します。

![会話履歴](/docs/_fern-img/fd517a080ba2c0d678c1ce34ea79afbd0dad764a19da43ca045a1c29b693ee48.webp)

> **Tip**
>
> 会話履歴を定期的に確認し、よくある問題やパターンを特定してください。

新しく作成したエージェントはさまざまな方法でテストできますが、最も簡単なのは[ElevenLabsダッシュボード](https://elevenlabs.io/app/agents)を使う方法です。

> **Info**
>
> Webダッシュボードは、リアルタイム会話を処理するために内部で[React SDK](/docs/ja/eleven-agents/libraries/react)を使用しています。

自分のWebサイトでエージェントをすぐにテストしたい場合は、Agentウィジェットを使用できます。以下のHTMLスニペットをWebサイトに貼り付け、`agent-id`をエージェントのIDに置き換えてください。

```html
<elevenlabs-convai agent-id="agent-id"></elevenlabs-convai>
<script src="https://unpkg.com/@elevenlabs/convai-widget-embed" async type="text/javascript"></script>
```

#### CLIでエージェントを構築

#### CLIをインストール

**`Homebrew (macOS)`**

```bash title="Homebrew (macOS)"
brew install elevenlabs/tap/elevenlabs
```

**`Scoop (Windows)`**

```powershell title="Scoop (Windows)"
scoop bucket add elevenlabs https://github.com/elevenlabs/scoop-bucket
scoop install elevenlabs
```

**`npm`**

```bash title="npm"
npm install -g @elevenlabs/cli
```

**`curl`**

```bash title="curl"
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/elevenlabs/cli/releases/latest/download/elevenlabs-cli-installer.sh | sh
```

> **Tip**
>
> AIコーディングアシスタントを使っていますか？プロジェクトで`elevenlabs generate-skills`を実行すると、各コマンドグループ用の
> `SKILL.md`が`skills/`に作成されます。これにより、ドキュメントを貼り付けなくても、アシスタントがCLIのすべての機能を把握できます。
> 別の場所に配置するには`--output-dir`を使ってください。CLIに組み込まれたAPI定義を読み取るため、APIキーは不要で、オフラインでも動作します。また、
> インストールしているCLIのバージョンに常に対応します。

#### 新しいプロジェクトを初期化

```bash
elevenlabs agents init
```

これにより、設定ディレクトリとレジストリファイルを含むプロジェクト構造が作成されます。

#### ElevenLabsで認証

[ダッシュボードでAPIキーを作成](https://elevenlabs.io/app/settings/api-keys)し、安全に[CLIを使用](/docs/ja/api-reference/authentication)するために利用します。

次に、以下のコマンドを実行してElevenLabsで認証します。

```bash
elevenlabs auth login
```

OAuthで認証するためのブラウザウィンドウが開きます。CLIが認証情報を検証し、安全に保存します。

#### エージェントを作成

アシスタントテンプレートを使用して、最初のエージェントを作成します。

```bash
elevenlabs agents add "My Assistant" --template assistant
```

#### ElevenLabsプラットフォームにプッシュ

```bash
elevenlabs agents push
```

ローカルのエージェント設定がElevenLabsプラットフォームにアップロードされます。

#### エージェントをテスト

新しく作成したエージェントはさまざまな方法でテストできますが、最も簡単なのは[ElevenLabsダッシュボード](https://elevenlabs.io/app/agents)を使う方法です。ダッシュボードからエージェントを選択し、**Test AI agent**ボタンをクリックしてください。

> **Info**
>
> Webダッシュボードは、リアルタイム会話を処理するために内部で[React SDK](/docs/ja/eleven-agents/libraries/react)を使用しています。

自分のWebサイトでエージェントをすぐにテストしたい場合は、Agentウィジェットを使用できます。CLIを使用してHTMLスニペットを生成します。

```bash
elevenlabs agents widget embed <agent_id>
```

エージェントIDはプッシュ時に`agents.json`へ記録され、`elevenlabs agents status`で一覧表示できます。このコマンドでHTMLスニペットが出力されるので、Webサイトに直接貼り付けてください。

#### APIでエージェントを構築

#### APIキーを作成

[ダッシュボードでAPIキーを作成](https://elevenlabs.io/app/settings/api-keys)し、安全に[APIへアクセス](/docs/ja/api-reference/authentication)するために使用します。

キーは管理されたシークレットとして保存し、好みに応じて`.env`ファイルによる環境変数として、またはアプリの設定で直接SDKに渡してください。

**`.env`**

```js title=".env"
ELEVENLABS_API_KEY=<your_api_key_here>
```

#### SDKをインストール

#### SDK

`dotenv`ライブラリも使用して、環境変数からAPIキーを読み込みます。

```python
pip install elevenlabs
pip install python-dotenv
```

```typescript
npm install @elevenlabs/elevenlabs-js
npm install dotenv
```

#### CLI

ElevenLabs CLIをインストールします。Homebrew（macOS）とScoop（Windows）を推奨します。

**`Homebrew (macOS)`**

```bash title="Homebrew (macOS)"
brew install elevenlabs/tap/elevenlabs
```

**`Scoop (Windows)`**

```powershell title="Scoop (Windows)"
scoop bucket add elevenlabs https://github.com/elevenlabs/scoop-bucket
scoop install elevenlabs
```

**`npm`**

```bash title="npm"
npm install -g @elevenlabs/cli
```

**`curl`**

```bash title="curl"
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/elevenlabs/cli/releases/latest/download/elevenlabs-cli-installer.sh | sh
```

> **Tip**
>
> AIコーディングアシスタントを使っていますか？プロジェクトで`elevenlabs generate-skills`を実行すると、各コマンドグループ用の
> `SKILL.md`が`skills/`に作成されます。これにより、ドキュメントを貼り付けなくても、アシスタントがCLIのすべての機能を把握できます。
> 別の場所に配置するには`--output-dir`を使ってください。CLIに組み込まれたAPI定義を読み取るため、APIキーは不要で、オフラインでも動作します。また、
> インストールしているCLIのバージョンに常に対応します。

次に認証します。ブラウザが開き、CLIを承認できます。

```bash
elevenlabs auth login
```

#### エージェントを作成

使用する言語に応じて、`create_agent.py`または`createAgent.mts`という新しいファイルを作成し、以下のコードを追加します。

```python maxLines=0
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs
import os
load_dotenv()

elevenlabs = ElevenLabs(
    api_key=os.getenv("ELEVENLABS_API_KEY"),
)

prompt = """
You are a friendly and efficient virtual assistant for [Your Company Name].
Your role is to assist customers by answering questions about the company's products, services,
and documentation. You should use the provided knowledge base to offer accurate and helpful responses.

Tasks:
- Answer Questions: Provide clear and concise answers based on the available information.
- Clarify Unclear Requests: Politely ask for more details if the customer's question is not clear.

Guidelines:
- Maintain a friendly and professional tone throughout the conversation.
- Be patient and attentive to the customer's needs.
- If unsure about any information, politely ask the customer to repeat or clarify.
- Avoid discussing topics unrelated to the company's products or services.
- Aim to provide concise answers. Limit responses to a couple of sentences and let the user guide you on where to provide more detail.
"""

response = elevenlabs.conversational_ai.agents.create(
    name="My voice agent",
    tags=["test"], # List of tags to help classify and filter the agent
    conversation_config={
        "tts": {
            "voice_id": "aMSt68OGf4xUZAnLpTU8",
            "model_id": "eleven_flash_v2"
        },
        "agent": {
            "first_message": "Hi, this is Rachel from [Your Company Name] support. How can I help you today?",
            "prompt": {
                "prompt": prompt,
            }
        }
    }
)

print("Agent created with ID:", response.agent_id)
```

```typescript maxLines=0
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import "dotenv/config";

const elevenlabs = new ElevenLabsClient();

const prompt = `
    You are a friendly and efficient virtual assistant for [Your Company Name].
    Your role is to assist customers by answering questions about the company's products, services,
    and documentation. You should use the provided knowledge base to offer accurate and helpful responses.

    Tasks:
    - Answer Questions: Provide clear and concise answers based on the available information.
    - Clarify Unclear Requests: Politely ask for more details if the customer's question is not clear.

    Guidelines:
    - Maintain a friendly and professional tone throughout the conversation.
    - Be patient and attentive to the customer's needs.
    - If unsure about any information, politely ask the customer to repeat or clarify.
    - Avoid discussing topics unrelated to the company's products or services.
    - Aim to provide concise answers. Limit responses to a couple of sentences and let the user guide you on where to provide more detail.
`;

const agent = await elevenlabs.conversationalAi.agents.create({
    name: "My voice agent",
    tags: ["test"], // List of tags to help classify and filter the agent
    conversationConfig: {
        tts: {
            voiceId: "aMSt68OGf4xUZAnLpTU8",
            modelId: "eleven_flash_v2",
        },
        agent: {
            firstMessage: "Hi, this is Rachel from [Your Company Name] support. How can I help you today?",
            prompt: {
                prompt,
            }
        },
    },
});

console.log(`Agent created with ID: ${agent.agentId}`);
```

> **Note**
>
> 上で作成したエージェントには`"test"`タグが付与されます。このタグはエージェントの分類やフィルタリングに役立ちます。たとえば、テスト用エージェントと本番用エージェントを区別できます。

#### コードを実行

```python
python create_agent.py
```

```typescript
npx tsx createAgent.mts
```

上記のコードにより、基本設定を含むエージェントが生成され、エージェントIDがコンソールに出力されます。エージェントは次のステップでカスタマイズします。

#### エージェントをテスト

新しく作成したエージェントはさまざまな方法でテストできますが、最も簡単なのは[ElevenLabsダッシュボード](https://elevenlabs.io/app/agents)を使う方法です。ダッシュボードからエージェントを選択し、**Test AI agent**ボタンをクリックしてください。

> **Info**
>
> Webダッシュボードは、リアルタイム会話を処理するために内部で[React SDK](/docs/ja/eleven-agents/libraries/react)を使用しています。

自分のWebサイトでエージェントをすぐにテストしたい場合は、Agentウィジェットを使用できます。以下のHTMLスニペットをWebサイトに貼り付け、`agent-id`をエージェントのIDに置き換えてください。

```html
<elevenlabs-convai agent-id="agent-id"></elevenlabs-convai>
<script src="https://unpkg.com/@elevenlabs/convai-widget-embed" async type="text/javascript"></script>
```

提供されているSDKを使用してエージェントをWebサイトやアプリに埋め込む方法については、SDKタブを確認してください。

## 次のステップ

このクイックスタートガイドに続いて、以下を統合するとエージェントをさらに効果的にできます。

* ドメイン固有の情報を提供するための[ナレッジベース](/docs/ja/eleven-agents/customization/knowledge-base)
* タスクを代行できるようにする[ツール](/docs/ja/eleven-agents/customization/tools)
* 特定の会話へのアクセスを制限する[認証](/docs/ja/eleven-agents/customization/authentication)
* 会話を分析してパフォーマンスを改善する[成功評価](/docs/ja/eleven-agents/customization/agent-analysis/success-evaluation)
* 会話に関するデータを収集してパフォーマンスを改善する[データ収集](/docs/ja/eleven-agents/customization/agent-analysis/data-collection)
* 会話履歴を確認してパフォーマンスを改善する[会話保持](/docs/ja/eleven-agents/customization/privacy/retention)