# Train Your Agent

> Teach a new Mojeeb agent in three steps on the Agent Knowledge page: write its Main Instructions, add the facts it answers from by typing or uploading PDF, Word and text files, and test it in the test chat.

A new agent knows nothing about your business. Training it takes three steps on one page, [Agent Knowledge](https://dashboard.mojeeb.app/setup): tell it how to behave in the Main Instructions, give it the facts customers ask about, and try it in the test chat. Half an hour with your price list and your policies is usually enough for a first version.

## What does the agent learn from?

Three things on the Agent Knowledge page. The **Main Instructions** set its identity, tone, rules and when to hand over to a human. **Knowledge** entries hold the facts: prices, hours, branches, delivery, returns, product details. **Attachments** are files it can send, such as a menu or a catalog. The agent reads the instructions and all the knowledge on every reply, so everything you add is used at once.

## Step 1: How do I write the Main Instructions?

Click **Edit** on the **Main Instructions** row and write short rules, one per line: who the agent is, which language and tone to use, what it must always do, what it must never say, and when to pass the chat to your team. Put facts in knowledge entries, not here. The [Main Instructions](/docs/features/main-instructions) page has two complete examples to copy and adapt.

## Step 2: How do I add the facts?

Click **Add** and either type an entry with a **Title** and the text, or drop a file on **Attach files (optional)**. The text box shows a gray example, such as **Prices** with three price lines; type your own facts over it, one topic per entry. For a document, answer **Read it to answer questions** when asked; Mojeeb extracts the text and splits it into entries.

### Which files can I upload?

| Format | Extension | Notes |
|--------|-----------|-------|
| PDF | `.pdf` | Text-based; scanned images cannot be read |
| Word | `.docx` | Save legacy `.doc` files as `.docx` first |
| Plain text | `.txt` | UTF-8 |

A PDF or Word file can be up to 20 MB, a text file up to 10 MB, and each holds up to 120,000 characters of text. Excel and CSV are not accepted; paste the rows as text or export to PDF. Photos and videos become attachments the agent sends rather than reads.

## Step 3: How do I test the agent?

Use the test chat beside the list, or the **Test** button on a phone. Ask the questions your customers ask most, in Arabic and in English, including one the agent should not be able to answer, and check that it follows the instructions, uses the right facts, and hands over when it should. Fix the entry or the rule that caused a wrong answer and ask again; every change applies immediately.

## How do I get better results?

- **One topic per entry**, with a title that says what it holds
- **Exact facts**: the price, the hours, the policy, not a description of them
- **Keep it current**: edit entries when things change, delete what is discontinued
- **Cover the top ten questions** your team answers every day before anything else
- **Watch the size**: every 40,000 words of knowledge adds one message to the cost of each reply

## What's next?

- [Agent Knowledge](/docs/features/agent-knowledge) — the full tour of the page
- [Knowledge Base](/docs/features/knowledge-base) — editing, limits and export
- [Embed on website](/docs/getting-started/embed-on-website) — put the agent on your site
- [Channels](/docs/channels/whatsapp) — connect WhatsApp, Messenger and Instagram
