> 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/en/build/agent/add-system-prompt.md).

# Add Role Instructions to an Agent

Add your designed system prompt to Agent settings: steps to open the Agent editing page, paste the system prompt, and save it.

Once you have designed your system prompt, you can add it in MaiAgent's Agent settings:

## Add a System Prompt <a href="#add-system-prompt" id="add-system-prompt"></a>

### 1. Open the Agent Settings Page <a href="#step-1-navigate-to-ai-agent-settings" id="step-1-navigate-to-ai-agent-settings"></a>

In the left menu, click <mark style="color:blue;">AI Features</mark> > <mark style="color:blue;">AI Assistants</mark>. Find the Agent you want to configure in the list, then click the <mark style="color:blue;">Edit</mark> icon in that row's <mark style="color:blue;">Actions</mark> column.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-4d2b79176a41568cb0cd9e0dc9e201b5671a6a6a%2Fai-agent-list-edit-button.png?alt=media" alt="Agent list with the Edit icon highlighted in the Actions column"><figcaption><p>Click the Edit icon in the Actions column to open Agent settings</p></figcaption></figure>

### 2. Switch to the Reply Mode Settings Page <a href="#step-2-switch-to-answer-mode-settings" id="step-2-switch-to-answer-mode-settings"></a>

In the settings menu on the left of the <mark style="color:blue;">Settings</mark> tab, click <mark style="color:blue;">Reply Mode Settings</mark>.

Set <mark style="color:blue;">Reply Mode</mark> to <mark style="color:blue;">RAG Q\&A</mark> or <mark style="color:blue;">Agent Mode</mark>, or expand <mark style="color:blue;">Other Modes</mark> and select <mark style="color:blue;">Hybrid</mark>:

{% hint style="warning" %}
You cannot set a system prompt in Template mode (under <mark style="color:blue;">Other Modes</mark>)
{% endhint %}

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-b814b654848f855a4cfe488c9517e7388c11cb3a%2Fai-agent-reply-mode-settings.png?alt=media" alt="Reply Mode Settings on the Settings tab, showing RAG Q&#x26;A, Agent Mode, and Other Modes options"><figcaption><p>Select a reply mode in Reply Mode Settings</p></figcaption></figure>

### 3. Enter Text in the System Prompt Section <a href="#step-3-enter-text-in-system-prompt-section" id="step-3-enter-text-in-system-prompt-section"></a>

In the <mark style="color:blue;">System Prompt</mark> section further down the same page, enter your system prompt, then click <mark style="color:blue;">Save</mark> in the lower-right corner.

<figure><img src="https://1360999650-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6v6TNkkOQVfRYfcNirHL%2Fuploads%2Fgit-blob-f56ca83283c5e1689fde5ff2f3808aa9ac70d906%2Fai-agent-instructions-field.png?alt=media" alt="System Prompt section with usage tips, quick prompt insertion, and an input field"><figcaption><p>Enter content in the System Prompt section</p></figcaption></figure>

Agent will then act according to the system prompt you defined, becoming your own customized Agent.

## System Prompt Edit History <a href="#instruction-edit-history" id="instruction-edit-history"></a>

Each time you save the system prompt, a version is recorded. Click “<mark style="color:blue;">Edit History</mark>” in the <mark style="color:blue;">System Prompt</mark> section to view a timeline of previous save times and their full content (the latest version appears at the top; scroll down to load earlier versions). Hover over a version to reveal two buttons:

| Button                                                | Function                                                                                                                                                                                                                                                                       |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <mark style="color:blue;">Apply</mark>                | Fills the system prompt field with that version's content and closes the window. You still need to click <mark style="color:blue;">Save</mark> in the lower-right corner for it to take effect, so you can compare the content first and change it back if needed              |
| <mark style="color:blue;">View Message History</mark> | Opens a list of conversations from the period when that system prompt version was in use. For each entry, click “<mark style="color:blue;">View Response Quality Control Details</mark>” to see the complete Q\&A; use this to compare which version produced better responses |

Before making major changes, open “Edit History” to check the current version. If your changes cause problems, you can apply an earlier version and save it at any time.


---

# 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/en/build/agent/add-system-prompt.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.
