How to train your AI Agent: Knowledge bases and prompts

How to train your AI Agent with knowledge bases and prompts

Regardless of technology, AI agents are only as smart as the knowledge and instructions you give them. Training your AI agent means providing useful knowledge for it to learn, and crafting clear, goal-driven prompts that reflect your brand, define its role, and help it navigate real conversations. A vague prompt results in a confused agent. Too much detail, and it may miss the point entirely.

AgentFlow lets you design smart, contextual AI agents using natural-language prompts. Whether you’re handling customer support, lead qualification, or FAQ automation, how you write your prompts directly impacts how your AI agent responds.

This article will guide you through best practices for creating a knowledge base, writing effective prompts and conditions, from tone and behaviour rules to fallback logic and exit criteria. You’ll also find industry-specific prompt examples to help you get started quickly, whether you’re in e-commerce, education, or other industries.

How to build a reliable knowledge base for your AI agent with training documents

building a reliable knowledge base for AI agents with PDFs, sheets, websites and more

Before configuring your prompts, you need to give your AI something to learn from. Training documents are the source of truth for your AI agent, as they tell it what your business does, what policies it should follow, and how to answer common questions accurately. If your AI gives incorrect or outdated answers, it’s often not a prompt problem, and the issue may be in the training material. Make sure the right details are available and easy to find. Your prompt tells the AI how to behave, but your documents tell it what to say.

SleekFlow’s AI Agent is able to learn from a variety of training documents, such as:

  • Website URLs

  • Help centre articles

  • Internal policy documents

  • Product catalogues

  • FAQ sheets

  • Pricing guide

  • Onboarding manuals

Best practices for using training documents

Best practices for using documents to train AI

Use current, business-specific content

Avoid uploading general or outdated content. Ensure the documents accurately reflect your latest policies, services, and tone.

Cover your most common questions

Start with the highest-impact topics: shipping and returns, pricing, product details, how-to guides, and contact channels. Fill knowledge gaps based on what customers ask most.

Structure content clearly

Use headings, bullet points, and consistent formatting. This helps the AI extract information accurately. Long blocks of text make it harder for the AI to find the right answer.

Avoid jargon unless intentional

If your audience doesn’t use technical terms, keep documents written in plain language. This helps the AI match its responses to your customers’ expectations.

Keep documents focused

Don’t overload a single document with multiple, unrelated topics. It’s better to break content into separate, themed documents, for example: “Returns Policy” vs “Order Tracking Help.”

Test and iterate

Ask the AI questions that reference the documents. Check how well it responds. If the answers are vague, restructure or clarify the source material.

How prompts shape your AI agent’s behaviour

Once your AI agent has access to accurate training documents, the next step is guiding how it uses that information, and here’s where prompts come in. Writing a prompt is more than just telling the AI what to say, as it shapes how your agent thinks, reacts, and responds in various situations. In AgentFlow, prompts help your AI agent understand three key aspects:

  • What it represents (your brand, team, or role)

  • What it should and shouldn't do (task scope, tone, guardrails)

  • How to behave in real conversations (reply style, when to exit, what signals to look for)

Vague prompts can lead to generic or unhelpful replies, while overly detailed or unfocused prompts might cause the agent to miss crucial information. The goal is to provide just enough context to guide the agent without overwhelming it.

Good vs bad prompts

A well-written prompt transforms your AI agent from a generic assistant into a brand-aligned, goal-oriented team member. However, this may be deceptively simple as vague instructions can lead to vague replies while overly complex ones can confuse the AI, or cause AI hallucination. Here’s a table illustrating the difference between good and bad AI prompts:

Good prompts

Bad prompts

Are goal-oriented and clearly state what the agent is expected to do.

Are vague or open-ended, with no clear task or context

Include specific instructions, keywords, or constraints

Ask the agent to “help” without clarifying what kind of help is expected

Provide context about your business, tone, or customer type

Assume the AI agent already knows how your business works

Anticipate what might go wrong, and guide the fallback behaviour

Leave the AI agent guessing when it’s unsure or in unfamiliar scenarios

How to write a good prompt

Imagine you’re onboarding someone new to your team. You wouldn’t just say, “Help our customers.” You’d explain who your customers are, what kind of help they usually need, and how they should communicate. Writing prompts for your AI agent work the same way. A good prompt should be:

  • Grounded in your business goal: Are you aiming to support users, drive sales, qualify leads, or route conversations? 

  • Clear about expectations: What should the agent always help with? What topics or actions are out of scope? 

  • Context-aware: What's the tone, topic, or customer persona the agent is interacting with? 

  • Flexible, not fragile: If something unexpected happens, does the prompt provide enough direction for the agent to handle it gracefully?

Best practices for writing prompts

best practices for writing prompts for AI agents

AgentFlow uses natural-language prompts to guide your AI agent's behaviour across various configurations, including overall instructions, guardrails, actions, and exit conditions. Crafting specific and intentional prompts ensures your agent responds accurately, maintains your brand voice, and navigates different conversation types effectively. To write effective prompts and instructions for your AI agent in AgentFlow, follow these best practices:

1. Be specific about your business context

Providing clear context about your company, what the agent represents, and what it should handle helps your AI agent understand its role and generate relevant replies. This leads to more accurate and helpful conversations.

2. Define tone, style, and level of detail

Stating how your AI agent should sound and how much detail it should give ensures consistency with your brand voice and avoids overly long or overly vague answers.

3. Guide how the agent should behave in different situations

Good prompts don’t just define what to say, they clarify how the agent should react to uncertainty, edge cases, or sensitive topics. This helps reduce off-topic replies and improves reliability.

4. Use clear, structured prompts

For each action, write prompts that describe what output is expected. This helps your AI agent perform consistently across conversations.

5. Write precise exit conditions

The “Exit condition” field tells the AI what kind of message or signal to look out for before exiting the conversation. This is not the message the AI will send but rather a natural-language rule that describes when the exit should be triggered. Writing a clear, specific condition helps the AI detect user intent accurately and prevents it from exiting too early or staying in the conversation longer than needed.

6. Avoid vague or open-ended instructions

Instructions like “respond nicely” or “help the customer” don’t provide enough context. Your AI agent performs best when it has a clear purpose, role, and constraints.

7. Avoid over-prompting or conflicting instructions

Trying to “cover everything” in a single prompt can lead to confusing or inconsistent AI behaviour. If your instructions are too long, repetitive, or contradictory, your AI agent may struggle to know what to prioritise, or may fall back to vague, generic replies. Writing intentional prompts is not about saying more but about saying the right things in the right place.

A good AI Agent starts with a good foundation

Training your AI is about giving it the right foundation to work from. With accurate, well-structured training documents and clearly written prompts, your AI becomes a reliable extension of your team. Whether it’s answering questions, qualifying leads, or routing enquiries, your agent performs best when it knows what to say and how to say it. Below is an illustrated table of our best practices for writing prompts, so you know how to get started.

Best practice

Where to apply

Good example

Bad example

Be specific about your business context

“Instructions” (overall behaviour)

“You are a support agent for Cat Paradise, a premium cat grooming and spa service. Help customers book appointments and answer grooming-related questions.”

“You’re a support assistant. Help people.”

Define tone, style, and level of detail

“Instructions”, “Send message”

“Use a friendly and casual tone.”

“Just sound nice.”

Guide how the agent should behave in different situations

“Instructions”, “Guardrails”, “Send message”

“If the customer asks something not covered in the knowledge base, politely ask for clarification. Avoid referencing external sources or assumptions. Provide as much business-specific context as possible to ensure accurate, on-brand responses.”

“If unsure, figure it out.”

Use clear, structured prompts in actions

“Send message”, “Calculate lead score”

“Recommend one service plan based on what the customer needs. Highlight the key benefit in one sentence. If multiple options apply, ask a follow-up question to narrow it down.”

“Just write a response”

Write precise exit conditions

“Exit conditions”

“Exit when the user says they want to talk to a human agent.”, “Exit if the message includes phrases like ‘cancel’, ‘stop’, or ‘end chat’.”

“Leave when it makes sense.”, “Say goodbye.”, “End the chat.”

Avoid vague or open-ended instructions

All prompt fields

“You are a support assistant helping customers understand product features. Keep answers short and friendly, and ask for clarification when needed.”

“You’re here to help. Just be helpful.”

Avoid over-prompting and conflicting instructions

All prompt fields (especially “Instructions” and “Send message”)

Write one prompt per intent. Keep it focused on a single goal (e.g. tone, fallback behaviour, or task scope). Place additional instructions in the correct fields (e.g. guardrails for edge cases).

“Keep replies short and detailed.” (unclear priority) “Use casual tone but greet formally.” (inconsistent tone) “Escalate refund requests” + “Answer refund questions directly.” (unclear fallback)

Frequently Asked Questions


Share Article

Recommended for you

Automate your growth with SleekFlow

Get started for free and supercharge your customer engagement.