> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/feature/ai-agent/how-do-you-write-ai-agent-instructions-correctly.md).

# How do you write AI agent instructions correctly?

Learn how to write default and scenario-based instructions for Fancy AI agents, and combine them with knowledge and routing settings to make customer service responses better fit business needs.

**Good AI instructions are not better just because they are longer; they should clearly tell Fancy how to respond, when it needs to confirm first, and what it cannot decide on its own.**

For example, you can ask Fancy to use Traditional Chinese, keep responses brief, and ask questions first when information is insufficient, instead of guessing product prices or promising refunds on its own.

## What is the difference between instructions, knowledge, and routing?

| What you want to set                                                        | Suitable features to use        |
| --------------------------------------------------------------------------- | ------------------------------- |
| What tone you want Fancy to use, and how it should structure its replies    | **Default instructions**        |
| How Fancy should respond when customers encounter special issues            | **Scenario-based instructions** |
| Product prices, shipping fees, business hours, return and exchange policies | **Knowledge**                   |
| Need to transfer to a human agent or switch to a fixed flow                 | **Routing**                     |

For example, 'the return period is 7 days' is a service policy and is suitable for knowledge sources; 'if you're unsure about the return period, say you need to confirm it first and don't guess' is better written in instructions.

## 1. Default instructions: principles that apply to all conversations

It is recommended to start by writing from the following aspects:

* **Service goal:** What issues should Fancy mainly help customers solve?
* **Response tone:** Should it be formal, friendly, or brief and direct?
* **Response style:** Should it answer the key point first and then add steps?
* **When information is insufficient:** What should it ask first instead of guessing?
* **Important limitations:** What matters must be confirmed by a human?

### Example of default instructions

> You are the online customer service for this store. Please respond to customers in Traditional Chinese in a professional, friendly, and easy-to-understand way. Answer the key point first, and use brief bullet points when needed. Please answer according to the information provided by the company; if you cannot confirm the price, stock, return eligibility, or delivery time, please state that clearly and do not guess or guarantee results. If necessary, guide the customer to seek help from a human agent.

This kind of instruction can first establish Fancy's basic service style, and other special situations can be added separately later.

## 2. Scenario-based instructions: add guidance for specific situations

If some rules only apply to specific situations, you can add scenario-based instructions so everything doesn't get crowded into the default instructions.

| Scenario name                | Instruction example                                                                                                                                             |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Insufficient information** | When the customer's question is missing necessary information, ask for the one or two most important details first and do not guess directly.                   |
| **Defective product**        | When a customer reports that a product is damaged, first confirm the product and order information; before it is verified, do not promise a refund or exchange. |
| **No service policy found**  | When no clear rule can be found, tell the customer that further confirmation is needed and do not make up an answer.                                            |
| **Customer is upset**        | Stay respectful, first confirm the issue the customer is facing, and then provide possible solutions.                                                           |

**Scenario-based instructions can help Fancy respond appropriately in different situations.** Fancy will determine how to apply these instructions based on the customer's question and the conversation content, but the actual response may still differ from what you expected. After setting them, it is recommended to confirm the results through 'test chat'. If you need to handle customer requests according to a fixed process, it is recommended to use a conversation script; if you need to transfer to a human or switch to a designated script, please use **Routing**settings.

## 3. How to write instructions so they are easier to understand

It is recommended to write in the format of **"When this situation occurs → What should be done → What should not be done"** .

| Not clear enough                                                      | Suggested rewrite                                                                                                                                          |
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Please maintain a good attitude.                                      | When the customer is dissatisfied, first confirm the problem and remain respectful; do not argue with the customer.                                        |
| Please answer all questions in detail.                                | First answer the key point in a short message; when action steps are needed, explain them item by item.                                                    |
| Handle problems smartly.                                              | If order information is missing, ask first instead of guessing the order status.                                                                           |
| Do not provide incorrect information.                                 | When you cannot find a clear price, policy, or timeframe, please say that further confirmation is needed.                                                  |
| If the customer wants to return the item, just help them complete it. | First determine whether the customer is asking about the policy or submitting a request; formal requests should be handled through the designated process. |

When writing, keep three principles in mind:

1. **Make the text clear and concise.** Put the most important rules first and avoid repetition or contradictions.
2. **Manage instructions and data separately.** Content that changes frequently, such as product prices and policies, is better kept in knowledge sources for easier updates.
3. **When actual actions are needed, use the corresponding feature.** Instructions can regulate how to respond, but they do not mean a refund, order change, or human transfer has already been completed.

## Things to note when writing instructions

**Please avoid making the instructions too long.** If there is too much content, some instructions may not be fully applied, causing Fancy's replies to differ from expectations. It is recommended to prioritize important response principles and handling methods, and keep product information, prices, and service policies in 'Knowledge' for maintenance. After setup is complete, you can use 'test chat' to confirm whether Fancy responds as expected.

## 4. How do you set up and test in FIRST LINE?

{% stepper %}
{% step %}

### Go to 'AI Agent'

Open FIRST LINE's **AI Agent**management page and select the Fancy you want to configure.
{% endstep %}

{% step %}

### Write default instructions

In **Instructions** tab, first write down the service principles that should be followed in all conversations, such as tone, response style, and how to handle insufficient information.
{% endstep %}

{% step %}

### Add the needed scenario-based instructions

Add rules for common complaints, special policies, or important service situations; you do not need to create one instruction for every single issue.
{% endstep %}

{% step %}

### Confirm knowledge and routing

Check whether product, service, and policy information has been added to the knowledge sources. When you need to transfer to a human or switch conversation scripts, please configure routing separately.
{% endstep %}

{% step %}

### Test chat and adjust

Test using different ways customers may ask questions. Confirm whether the replies for general questions, follow-up questions, insufficient information, and special situations match expectations, then adjust the instructions gradually.
{% endstep %}
{% endstepper %}

## Frequently asked questions

### Do I need to paste all company policies into the default instructions?

No. Default instructions are suitable for explaining Fancy's service principles; product information, policies, and FAQs are better kept in knowledge sources for easier updates.

### Why didn't Fancy respond according to the instructions?

Please first confirm that the settings have been saved, and check whether the wording is clear, whether it conflicts with other instructions, and whether Fancy has enough knowledge to refer to. After making changes, it is recommended to test chat again.

### Can instructions replace human transfer or conversation scripts?

It is not recommended. If you want Fancy to hand off to a person in specific situations, or let customers enter a fixed service flow, please use **Routing**and the corresponding settings.

{% hint style="info" %}
AI replies may still contain errors. When dealing with refunds, fees, contracts, or other matters that require confirmation, please combine the company's existing service policies with human verification procedures.
{% endhint %}

If you want to learn how to use conversation scripts together, please refer to [How can Fancy work with conversation scripts?](https://help.firstline.cc/feature/ai-agent/start-ai-agent-from-scenario).
