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

# Agent Instructions

> Learn how to write effective AI Agent Instructions in TypingMind, with best practices, examples, and ready-to-use templates.

Agent Instructions tell your AI Agent what to do, how to behave, and what a successful response should look like.

Well-written instructions help your Agent stay focused, communicate consistently, and complete tasks more effectively.

The key is **not to write longer instructions, but to provide clearer direction.**

This guide covers practical techniques for writing Agent Instructions in TypingMind, based on modern AI prompting best practices.

## What makes a good Agent Instruction?

Think of your AI Agent as a capable new team member. It can handle many tasks, but it needs to understand your goals, your expectations, and the context behind its work.

A good instruction answers five questions:

| Component | What to define |
| - | - |
| Role | Who is the Agent, and who does it help? |
| Goal | What should the Agent accomplish? |
| Context | What information does it need to do the job well? |
| Behavior | How should it approach requests and communicate? |
| Boundaries | What should it avoid or ask permission before doing? |

You don't need to include every component in every instruction. Start with what's essential for your use case.

### Example: Vague vs. clear instructions

**Less effective:**

> You are a helpful customer support assistant. Answer customer questions professionally.

**More effective:**

> You are a customer support assistant for Acme, a project management platform.
>
> Help customers understand product features and resolve common issues using the available documentation.
>
> Provide direct, friendly answers. When troubleshooting, give clear steps customers can follow.
>
> If you cannot verify an answer, acknowledge the uncertainty instead of guessing.

The improved version explains the Agent's purpose, available information, expected behavior, and limitations.

## 5 steps to writing effective Agent Instructions

### 1. Define the role and goal

Start by telling the Agent who it is, whom it serves, and what it should achieve.

Be specific about the outcome, not just the job title.

**Example:**

```text theme={null}
You are a customer support assistant for Acme,
a project management platform.

Your goal is to help customers resolve issues
and understand product features efficiently.

Prioritize accurate answers and actionable solutions.
```

> [!TIP]
>
> Focus on the outcome you want. A clear goal often works better than a long list of rules describing every possible situation.

### 2. Give context and explain why it matters

AI models often perform better when they understand the reason behind an instruction.

Provide relevant background about your business, users, or workflow.

**Less effective:**

> Always keep your answers short.

**More effective:**

> Most customers contact us while working on a task. They need quick, practical answers so they can continue without reading lengthy explanations.

The second instruction explains *why* concise responses matter, helping the Agent apply the preference appropriately.

Useful context might include:

* Who will interact with the Agent
* What users typically need help with
* Your business or product background
* What matters most when responding
* Any important constraints

Avoid including information that doesn't help the Agent perform its responsibilities.

### 3. Describe the expected behavior

Explain how the Agent should approach common requests.

Modern AI models can often make reasonable decisions without detailed instructions for every scenario.

**Example:**

```text theme={null}
When responding to customers:

- Answer directly when the request is clear.
- Use available documentation for product-specific questions.
- Provide actionable steps for troubleshooting.
- Ask a clarifying question only when essential
  information is missing.
- If several solutions exist, recommend the most
  suitable one and briefly explain why.
```

Avoid overly rigid workflows unless your task requires a specific sequence.

For example, you don't need to require every response to include an introduction, analysis, recommendation, and conclusion.

Let the Agent adapt its response to the question.

### 4. Define communication style and output format

Tell the Agent how responses should sound and what format to use when necessary.

**Example:**

```text theme={null}
Communication style:
- Friendly, professional, and conversational.
- Use simple language and avoid unnecessary jargon.
- Lead with the answer or recommendation.
- Keep explanations concise but complete.
- Use numbered steps for instructions.
- Match the user's language when possible.
```

#### Use examples for consistent outputs

If your Agent needs to follow a specific structure, show what a good response looks like.

For example:

```text theme={null}
<example>
User: How do I invite my teammates?

Assistant:
You can invite teammates from your workspace settings.

1. Open Settings.
2. Select Team Members.
3. Click Invite Member.
4. Enter their email address and send the invitation.

Your teammate will receive an email with instructions
to join your workspace.
</example>
```

Examples are especially useful when you need consistent formatting, a particular writing style, or specialized responses.

> [!NOTE]
>
> TypingMind also supports Few-shot Prompting, allowing you to provide example conversations separately from your main Agent Instructions.

### 5. Set boundaries and decision-making rules

Clear boundaries help prevent unwanted actions, unsupported claims, and responses outside the Agent's responsibilities.

**Example:**

```text theme={null}
Boundaries:
- Do not invent product features, pricing, or policies.
- Clearly acknowledge information you cannot verify.
- Do not claim an action was completed unless
  the available tools confirm it.
- Stay focused on customer support.
- Request confirmation before making irreversible changes.
```

When setting boundaries, explain the preferred alternative whenever possible.

**Less effective:**

> Never provide incorrect information.

**More effective:**

> When information is missing or uncertain, explain what you can confirm and suggest how the customer can obtain the remaining details.

For Agents with access to Plugins or external services, distinguish between answering a question and performing an action.

For example:

```text theme={null}
If a user asks whether an order can be canceled,
explain the cancellation policy.

Do not actually cancel an order unless the user
explicitly requests that action and the necessary
authorization is available.
```

This is particularly important for Agents that can modify data, send messages, or interact with external applications.

## Ready-to-use Agent Instructions template

Use this template as a starting point.

Copy it into the **Agent Instructions** field in TypingMind and replace the placeholders with your own details.

```text theme={null}
# Role
You are a [type of assistant] helping [target audience].

# Goal
Your primary goal is to [desired outcome].

A successful interaction should help users
[describe the result they should achieve].

# Context
[Provide relevant business, product, or audience context.]

This matters because [explain important priorities
or why certain behavior is expected].

# Responsibilities
- [Main responsibility 1]
- [Main responsibility 2]
- [Main responsibility 3]

# Behavior
- Answer directly when the user's request is clear.
- Ask for clarification only when necessary.
- Provide actionable guidance when appropriate.
- Adapt the level of detail to the user's needs.

# Communication Style
- Use a [tone] tone.
- Keep responses [concise/detailed].
- Use [preferred language or formatting].
- Lead with the most useful information.

# Boundaries
- Stay focused on [scope].
- Acknowledge uncertainty instead of guessing.
- Do not claim actions were completed without confirmation.
- [Other important restrictions]
```

> [!TIP]
>
> You don't need to fill in every section. Remove sections that aren't relevant to your Agent. A shorter, focused instruction is usually easier to maintain and improve.

## Advanced techniques

Once your basic instruction works well, consider these techniques for more complex Agents.

### Structure complex instructions with XML tags

For Agents with multiple responsibilities, XML tags can help separate instructions, context, and examples.

**Example:**

```text theme={null}
<role>
You are a customer support assistant for Acme.
</role>

<goal>
Help customers resolve product-related questions
accurately and efficiently.
</goal>

<guidelines>
- Use available documentation when answering.
- Keep answers clear and practical.
- Ask for clarification only when necessary.
</guidelines>

<boundaries>
- Do not invent product information.
- Do not perform account changes without authorization.
</boundaries>
```

XML tags are optional. Simple headings or Markdown sections are often sufficient.

Use whichever structure makes your instructions easier to understand and maintain.

### Give the Agent appropriate autonomy

For more capable AI models, avoid micromanaging every step.

Instead, define the goal, constraints, and conditions that require user input.

**Example:**

```text theme={null}
Complete the requested task using the information
and tools available.

Make reasonable decisions within the requested scope.

Ask for confirmation before destructive or irreversible
actions, significant scope changes, or decisions requiring
information only the user can provide.

Do not perform unrelated tasks or make unrequested changes.
```

This approach helps Agents work independently while respecting user control.

### Keep responses focused

More capable models may sometimes provide more detail than the task requires.

A simple communication rule can help:

```text theme={null}
Lead with the answer or outcome.

Include supporting details only when they help
the user understand the result or decide what to do next.

Prioritize clarity over unnecessary length.
```

### Verify actions and results

For Agents using tools, distinguish between what the Agent intends to do and what has actually happened.

**Example:**

```text theme={null}
When reporting task progress or completion,
base claims on verified tool results.

If an action fails or cannot be confirmed,
explain the actual outcome.

Never report a task as completed based only
on an attempted action.
```

This is especially useful for Agents handling external services, business workflows, or multi-step tasks.

## Give your Agent knowledge and tools

Instructions control behavior, but they don't automatically provide access to company information or external systems.

TypingMind offers additional features to extend your Agent's capabilities.

| Feature | Purpose |
| - | - |
| Agent Instructions | Define the Agent's role, goals, and behavior. |
| Training Files | Provide reference documents directly in the Agent's context. |
| Knowledge Base | Retrieve relevant information from uploaded documents. |
| Dynamic Context | Retrieve information from connected external endpoints. |
| Plugins | Allow the Agent to use supported tools and services. |
| Memory | Retain relevant user-specific information when enabled. |

For example, a customer support Agent might use product documentation through a Knowledge Base, retrieve account information through Dynamic Context, and use Plugins for supported actions.

> [!NOTE]
>
> Features such as Dynamic Context, Plugins, and Memory must be configured separately. Writing an instruction alone does not grant an Agent access to these capabilities.

Learn more in [AI Agents Overview](https://docs.typingmind.com/ai-agents/ai-agents-overview.md).

## Test and improve your instructions

Even well-written instructions should be tested with realistic conversations.

Start by asking your Agent questions that reflect actual user needs.

For a customer support Agent, try:

| Test scenario | Example question |
| - | - |
| Basic question | "How do I invite a teammate?" |
| Troubleshooting | "I can't log in to my account." |
| Missing information | "Why isn't it working?" |
| Unverified information | "Will this feature launch next week?" |
| Action request | "Can you delete my account?" |
| Outside scope | "Can you help me plan my vacation?" |

Check whether your Agent:

* [ ] Understands the user's request and stays within its role.
* [ ] Gives accurate, useful answers.
* [ ] Follows your preferred communication style.
* [ ] Asks clarifying questions only when necessary.
* [ ] Acknowledges uncertainty instead of inventing information.
* [ ] Respects boundaries and action permissions.

When something doesn't work, update the relevant part of your instruction and test again.

Avoid adding multiple new rules after a single unexpected response. First identify whether the problem comes from unclear instructions, missing knowledge, unavailable tools, or model behavior.

> [!WARNING]
>
> Agent Instructions improve consistency but cannot guarantee perfect accuracy. For sensitive or high-impact use cases, include appropriate verification and human review.

## Common mistakes to avoid

| Mistake | Better approach |
| - | - |
| Writing vague instructions | Define a specific goal and expected outcome. |
| Adding too many rules | Keep only instructions that meaningfully guide behavior. |
| Giving conflicting directions | Remove contradictions and clarify priorities. |
| Micromanaging every step | Let the Agent choose how to complete tasks within clear boundaries. |
| Expecting instructions to provide knowledge | Attach relevant documents or configure appropriate data sources. |
| Never testing the Agent | Use realistic scenarios and refine based on results. |

## Final tips

The most effective Agent Instructions combine a clear purpose with enough context and flexibility for the AI to make good decisions.

Remember:

1. **Start with the goal.** Explain what success looks like.
2. **Provide useful context.** Include the information and reasoning that guide decisions.
3. **Be clear, not overly prescriptive.** Focus on important behaviors rather than every possible situation.
4. **Use examples when needed.** Show the expected output instead of relying on vague descriptions.
5. **Set meaningful boundaries.** Define what the Agent can do and when to ask for confirmation.
6. **Test and refine.** Improve instructions using real conversations and observed results.

A good Agent Instruction doesn't need to be long. It needs to make the Agent's job clear.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.