> ## Documentation Index
> Fetch the complete documentation index at: https://solvea.cx/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced: write an agent prompt

The prompt is the core of Agent. A well-written prompt can make a agent reliable and effective, while a poorly written one can break the entire agent.

This guide shows how to use **structured prompt engineering** to build agent that behave consistently and perform tasks correctly.

<Tip>
  To see examples, explore prompts used in Agent templates.
</Tip>

## Structure Your Prompt

Avoid putting all instructions into a single block of text.\
Using a **modular structure** helps the AI model clearly understand its role, scope, and boundaries.

We recommend organizing every agent prompt into three core sections:

* **Role:** Define what responsibility the agent holds and how the agent behaves.
* **Tasks:** Describe the step-by-step workflow the skill should follow to complete its job.
* **Rules:** Set constraints, priorities, and edge-case handling to prevent unwanted behavior.

```
# Role
You are a assistant for... You are responsible for handling...
Your style is polite, warm...

# Tasks
## Task1:...
1.
2.
## Task2:...
1.

# Rules
1. You should...
2. Never...
```

## Write Tasks as a Process

When writing the **Tasks** section, think like a developer designing logic.

Break execution into clear steps and use structured flows. Numbered steps and conditional logic (If / Else) significantly improve reasoning accuracy and execution stability.

Task example:

```
# Tasks

## Task1: Appointment Scheduling

1. Extract user’s name and desired appointment time slot from the message.

2. Ask for Missing Information(If Needed)
- If the user has provided both name and desired time slot, skip this step and proceed to Step 3.
- If the user has provided only one piece of information or none, politely ask the user to supplement the missing details.

3. Check Availability via google_calendar
- If user’s slot is within available time, Proceed to Step 4.
- If conflict, Reply exactly: "The selected time slot is unavailable due to a conflict. Please confirm a new time slot."
  - Re-run Step 3 if user provides a new time slot.

4. Call google_calendar to add the confirmed time slot linked to the user’s name, then send a booking confirmation.
```

## Recommendations

* **Be Specific and Detailed**\
  Avoid vague instructions. Clearly define context, expected output, tone, format, and length.

  | ❌                                  | ✅                                                                                                               |
  | ---------------------------------- | --------------------------------------------------------------------------------------------------------------- |
  | Ask the user for appointment time. | Ask the user for 15-min dental checkup time slot (Mon-Fri 9AM–5PM, 30-min intervals only) in 1 polite sentence. |
* **Use Positive Guidance**\
  Instead of telling the agent what *not* to do, tell it what it *should* do.\
  This keeps the model focused on the desired behavior.

  | ❌                              | ✅                                                                  |
  | ------------------------------ | ------------------------------------------------------------------ |
  | Don’t ask for irrelevant info. | Ask only for guest name, check-in date, and desired spa time slot. |
* **Provide Few-Shot Examples**\
  Include 1–2 complete examples of ideal user–agent interactions.\
  This helps the model learn tone, structure, and response length through imitation.
* **Emphasize Critical Instructions**\
  For extremely important rules or steps, use **UPPERCASE** to draw attention.
* **Write in English When Possible**\
  While Solvea supports multiple languages, English prompts currently achieve the highest instruction-following accuracy and reasoning quality.

## Add Tools and Knowledge in the Prompt

You can reference tools, knowledge sources, and handoff actions directly in the prompt using `/` .

This allows the agent to:

* Retrieve knowledge
* Handoff to a human agent. (reason and action are required)
* Call tools

Prompt Example：

```
# Retrieve knowledge
- call retrieve_knowledge tool to answer customer's inquiries.

# Handoff to a human agent
- When the customer still cannot provide order number ,pleasse call Only Handoff.

# Call Tools
- use all of the tracking numbers to call logistics_inquiry tool to get the logistics details.
- use the order number to call shopify tool to get the tracking numbers of the order
- call google_calendar tool to add the event.
- call google_calendar tool to check if the time slot is available
- call google_sheet tool to retrieve the file "xx" and add a new row to the sheet.
```
