> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/ja/build/agent.md).

# Agent

Agent とは、MaiAgent で作成する AI の対話役です。回答モード、システムプロンプト、言語モデル、ナレッジベース、ツールで構成されます。本記事では、Agent を作成する前に決めておくことも説明します。

## これは何ですか？ <a href="#what-is-this" id="what-is-this"></a>

Agent は、MaiAgent 上で作成する AI の対話役です。各 Agent は独立したチャットボットで、それぞれ独自のアイデンティティ、個性、知識、能力を持っています。

Agent を新入社員に例えると、次のことを伝える必要があります。

* **あなたは誰か**（システムプロンプト / System Prompt）
* **何を知っているか**（ナレッジベース、データベース）
* **何ができるか**（ツール、スキル）

設定が完了すると、Agent はさまざまな対話プラットフォームでユーザーに対応できます。

## 基本概念 <a href="#core-concepts" id="core-concepts"></a>

### 言語モデル（LLM） <a href="#language-model-llm" id="language-model-llm"></a>

Agent の理解力と回答能力は、背後にある大規模言語モデル（LLM）によって支えられています。LLM は Agent の「頭脳」と考えることができます。モデルによって、理解力、回答品質、速度、コストが異なります。

Agent を作成する際は、用途に合ったモデルを選択できます。MaiAgent は Claude、GPT など複数のモデルに対応しています。モデルの管理はプラットフォームが行うため、自分で管理する必要はありません。

> **選び方の目安**：正確な回答や複雑な推論が必要な場合 → 高性能なモデルを選びます。簡単な質問に頻繁に回答する場合やコストを抑えたい場合 → 高速で軽量なモデルを選びます。

### システムプロンプト（System Prompt） <a href="#system-prompt" id="system-prompt"></a>

システムプロンプトは Agent の振る舞いを決めます。例えば、次のように指定します。

* 「あなたは親切なカスタマーサポート担当者です。日本語で、専門的でありながら堅苦しくない口調で回答してください。」
* 「あなたは財務分析アシスタントです。財務に関する質問だけに回答し、不確かな数値については明確に伝えてください。」

適切なシステムプロンプトによって、Agent の回答品質を大きく向上させることができます。

### 回答モード <a href="#response-mode" id="response-mode"></a>

Agent 設定ページの「回答モード設定」で回答方法を選択します。新しく作成した Agent は、デフォルトで Agent モードになります。

* **Agent モード**（デフォルト）：複数のステップで推論する必要がある用途に適しています。Agent が、調べる情報や使用するツールを自ら判断します。
* **RAG Q\&A**：一般的な質疑応答に適しており、ナレッジベースの内容に基づいて直接回答します。
* **テンプレート**、**ハイブリッド**（「その他のモード」内）：テンプレートモードは、モデルが自由に生成するのではなく、ナレッジベースと FAQ に基づいて分類別に回答します。ハイブリッドモードは、一部をテンプレート形式で回答し、残りを自由に回答します。

各モードの違いと設定方法は、[Agent の作成](/maiagent-user-guide/ja/build/agent/setup.md#select-answer-mode-to-build-prompt)をご覧ください。

### メモリ <a href="#memory" id="memory"></a>

Agent には、次のメモリ機能があります。

* **会話メモリ**：同じ会話内で以前に話した内容を記憶します。「ベクトルメモリ」を有効にすると、古いメッセージも意味検索で取得できます。
* **会話横断検索**：回答時に、同じ連絡先の最近の別の会話を検索します。毎回自己紹介をする必要がありません。
* **永続メモリ**：会話から事実や好みを抽出して長期保存し、同じ連絡先との別の会話でも活用します。

> **詳細説明**：これらはすべて、Agent 設定ページの「詳細設定」にあります。「会話メモリ設定」では、ベクトルメモリ、会話横断検索、遡る日数、会話メモリで使用する Embedding／Reranker モデルを設定します。「永続メモリ」では、会話をまたぐメモリの有効・無効の状態と、保存されたメモリの一覧を確認できます。詳しくは、[会話横断検索](/maiagent-user-guide/ja/build/agent/cross-conversation-search.md)（[その他のオプション](/maiagent-user-guide/ja/build/agent/cross-conversation-search.md#other-memory-settings)を含みます）と[永続メモリ](/maiagent-user-guide/ja/build/agent/persistent-memory.md)をご覧ください。

## 何をすればよいですか？ <a href="#what-do-i-need-to-do" id="what-do-i-need-to-do"></a>

1. **Agent を作成します** — 名前を付け、言語モデルを選択します。
2. **システムプロンプトを書きます** — Agent の役割と回答スタイルを定義します。
3. **機能を追加します** — 必要に応じて、ナレッジベース、ツール、スキルを接続します。
4. **会話をテストします** — 内蔵チャットウィンドウで動作を確認します。
5. **プラットフォームに接続して公開します** — Web Chat、LINE などの対話プラットフォームにデプロイします。

## 関連記事 <a href="#further-reading" id="further-reading"></a>

* [Agent の機能](/maiagent-user-guide/ja/build/agent/explain.md)
* [Agent の作成](/maiagent-user-guide/ja/build/agent/setup.md)
* [システムプロンプト設計ガイド](/maiagent-user-guide/ja/build/agent/system-prompt.md)
* [Agent にシステムプロンプトを追加する](/maiagent-user-guide/ja/build/agent/add-system-prompt.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.maiagent.ai/maiagent-user-guide/ja/build/agent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
