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

# Prompt Engineering Guide

> Master the art of writing effective system prompts for your agents

The **System Prompt** is the most critical part of your agent's configuration. It defines the agent's identity, knowledge boundaries, and tone of voice.

## How the Prompt is Constructed

Our system automatically builds a final prompt for the AI by combining several elements:

1. **Time Context**: Current date and time are provided so the agent can handle time-sensitive queries.
2. **Language Instructions**: Instructions on which language to use (Dynamic or Specific).
3. **Your System Prompt**: The custom instructions you provide in the dashboard.
4. **Conversation Summary**: A summary of previous messages to maintain context in long chats.
5. **Knowledge Base Context**: Relevant snippets from your uploaded documents.

## Best Practices for Your System Prompt

### 1. Define the Persona

Start by telling the agent who it is.

> "You are a helpful and professional support assistant for Deflect."

### 2. Set the Scope

Be clear about what the agent should and should not do.

> "Only answer questions related to our services. If you don't know the answer based on the provided context, politely say you don't know and offer to create a ticket."

### 3. Define the Tone

Specify the desired style of communication.

> "Use a friendly, empathetic tone. Keep your responses concise and use bullet points for lists."

### 4. Handle Edge Cases

Tell the agent how to react when things go wrong.

> "If a user is frustrated or uses profanity, immediately offer to hand over the conversation to a human agent."

## Example Prompt

```text theme={null}
You are the Deflect Support Bot. Your goal is to help users with technical questions about our chatbot platform.

- Use the provided context to answer questions.
- If the answer isn't in the context, say: "I'm sorry, I don't have that information. Would you like me to open a support ticket for you?"
- Be professional and concise.
- Always offer a human handoff if the user asks for a "real person".
```
