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

> ## Agent Instructions
> To search or read these docs, connect the Ringg docs MCP server at https://docs.ringg.ai/mcp (no key needed; tools search_ringg_ai and query_docs_filesystem_ringg_ai) instead of browsing pages one by one. Setup for each client: https://docs.ringg.ai/resources/mcp-server/docs-mcp-server/mcp-for-ai-assistants.md
> The dashboard labels agents "Assistants"; these docs say "agent". Both mean the same object, identified by agent_id.
> API base URL: https://prod-api.ringg.ai/ca/api/v0. Send the workspace API key in the X-API-KEY header, from server-side code only.
> Placing a call dials a real phone number and spends credits. Confirm the number with the user before calling.
> To act on a Ringg workspace (place calls, edit agents, read transcripts), use the separate Ringg workspace MCP server at https://mcp.ringg.ai/mcp: https://docs.ringg.ai/resources/mcp-server/workspace-mcp-server/overview.md

# Lesson: Knowledge base

> Create an EMI policy knowledge base from a CSV, wait for Ready, attach it to the EMI reminder agent, mention it in the prompt with @, and test it in live chat.

export const Quiz = ({question, answers, correctFeedback, incorrectFeedback}) => {
  const [selected, setSelected] = React.useState(null);
  const [checked, setChecked] = React.useState(false);
  const quizId = React.useId();
  const isCorrect = checked && answers[selected]?.correct;
  const reset = () => {
    setSelected(null);
    setChecked(false);
  };
  const optionStyle = (answer, i) => {
    const base = {
      display: "flex",
      alignItems: "flex-start",
      gap: "0.6rem",
      padding: "0.6rem 0.8rem",
      marginTop: "0.5rem",
      borderRadius: "0.6rem",
      border: "1px solid rgba(128, 128, 128, 0.35)",
      cursor: checked ? "default" : "pointer",
      lineHeight: 1.45
    };
    if (checked && answer.correct) {
      return {
        ...base,
        borderColor: "rgba(22, 163, 74, 0.8)",
        background: "rgba(22, 163, 74, 0.12)"
      };
    }
    if (checked && selected === i && !answer.correct) {
      return {
        ...base,
        borderColor: "rgba(220, 38, 38, 0.8)",
        background: "rgba(220, 38, 38, 0.1)"
      };
    }
    if (!checked && selected === i) {
      return {
        ...base,
        borderColor: "currentColor",
        background: "rgba(128, 128, 128, 0.12)"
      };
    }
    return base;
  };
  const buttonStyle = disabled => ({
    marginTop: "0.9rem",
    padding: "0.45rem 0.9rem",
    borderRadius: "0.5rem",
    border: "1px solid rgba(128, 128, 128, 0.5)",
    background: "rgba(128, 128, 128, 0.1)",
    color: "inherit",
    font: "inherit",
    fontSize: "0.9em",
    cursor: disabled ? "not-allowed" : "pointer",
    opacity: disabled ? 0.5 : 1
  });
  return <div style={{
    marginTop: "1.5rem",
    padding: "1rem 1.1rem",
    borderRadius: "0.8rem",
    border: "1px solid rgba(128, 128, 128, 0.35)"
  }}>
      <Badge color="green">Quiz</Badge>
      <p id={quizId + "-question"} style={{
    fontWeight: 600,
    margin: "0.6rem 0 0.2rem"
  }}>
        {question}
      </p>
      <div role="radiogroup" aria-labelledby={quizId + "-question"} aria-disabled={checked}>
        {answers.map((answer, i) => <label key={i} style={optionStyle(answer, i)}>
            <input type="radio" name={"quiz-" + quizId} checked={selected === i} onChange={() => !checked && setSelected(i)} disabled={checked} style={{
    marginTop: "0.3rem",
    flexShrink: 0
  }} />
            <span>{answer.text}</span>
          </label>)}
      </div>
      {checked && <div role="status" aria-live="polite" aria-atomic="true" style={{
    marginTop: "0.9rem",
    padding: "0.7rem 0.9rem",
    borderRadius: "0.6rem",
    lineHeight: 1.5,
    background: isCorrect ? "rgba(22, 163, 74, 0.12)" : "rgba(220, 38, 38, 0.1)"
  }}>
          <strong style={{
    marginRight: "0.4rem"
  }}>{isCorrect ? "✓" : "✗"}</strong>
          {isCorrect ? correctFeedback : incorrectFeedback}
        </div>}
      {!checked ? <button type="button" onClick={() => selected !== null && setChecked(true)} disabled={selected === null} style={buttonStyle(selected === null)}>
          Check answer
        </button> : <button type="button" onClick={reset} style={buttonStyle(false)}>
          Try again
        </button>}
    </div>;
};

export const RelatedTopics = ({items}) => <div className="not-prose mt-12">
    <div className="text-sm font-medium text-gray-500 dark:text-zinc-400 mb-3">Related topics</div>
    <div className="flex flex-col gap-2.5">
      {items.map(([title, href]) => <a key={href} href={href} className="flex items-center gap-2.5 text-sm text-gray-700 hover:text-gray-950 dark:text-zinc-300 dark:hover:text-white">
          <Icon icon="file-text" size={16} color="currentColor" />
          {title}
        </a>)}
    </div>
  </div>;

**Part 3: Making your agent smarter · Lesson 2 of 4 · 20 minutes**

## Objective

Create a knowledge base of Acme's EMI policies, attach it to Ananya and tell her when to use it, so she answers policy questions from the document instead of guessing.

## The scenario

Customers ask what happens if they pay late. Acme's policy: a grace period of 3 days after the due date, a late fee of ₹500 after that, and payment by UPI, net banking or at a branch. The prompt holds only what the agent needs on every call; policies go in a knowledge base, which other agents can share.

## Hands-on

<Frame caption="Attaching knowledge bases and mentioning one in the prompt">
  <video alt="Attaching knowledge bases and mentioning one in the prompt" aria-label="Attaching knowledge bases and mentioning one in the prompt" controls muted playsInline className="w-full rounded-xl" style={{ aspectRatio: "16 / 10" }} preload="metadata" controlsList="nodownload noremoteplayback" poster="/media/agents-knowledge-base/poster.webp">
    <source src="https://mintcdn.com/ringgai-0da73d20/zhzhS2waLZvF8qXk/media/agents-knowledge-base/video.webm?fit=max&auto=format&n=zhzhS2waLZvF8qXk&q=85&s=708cf0c8d93f232e90b67edff7c33235" type="video/webm; codecs=&#x22;av01.0.09M.08&#x22;" data-path="media/agents-knowledge-base/video.webm" />
  </video>
</Frame>

<Steps>
  <Step title="Write the policy file">
    Create `emi-policy.csv` with two columns, `question` and `answer`, and one row per policy: the grace period, the late fee and the payment methods. Clear columns help the agent match answers.
  </Step>

  <Step title="Create the knowledge base">
    In the sidebar, open **Inventory → Knowledge base** and click **Create**. Set **Name** to `EMI policy`; it is saved as `emi_policy` and cannot be renamed later. On **Upload files**, drop the CSV. It opens in a preview with **Column Configuration** below; keep the **Type** Ringg guessed for each column and leave **Exact match** off. Click **Save**: "Knowledge base creation started".
  </Step>

  <Step title="Wait for Ready, then ask it a question">
    The file's chip goes from **Processing** to **Indexed**, and on the list the status goes from **Training** to **Ready**. Open the knowledge base; it opens on the file's contents, so click the back arrow to reach the test chat. Type "What is the late fee?" into **Ask a question about your data...**. The answer names the fee and lists the file it came from. If it is wrong here, fix the CSV before you touch the agent.
  </Step>

  <Step title="Attach it to Ananya">
    Open the agent, click **Knowledge Base** in the editor sidebar, then **Select Knowledge Base**, and tick `emi_policy`: "Knowledge base attached successfully". The button now shows the count.
  </Step>

  <Step title="Tell her when to use it">
    In **Prompt**, in the **FAQs** section, type `@` and pick `emi_policy` from the **Knowledge Bases** group. Write: "For questions about late fees, the grace period or payment methods, answer from @emi\_policy. If the answer is not there, say you will check and have an advisor call back." Click **Save**.
  </Step>
</Steps>

## Checkpoint

<Check>
  The **Knowledge Base** panel lists `emi_policy` below the button. Open **Test assistant**, pick **Live chat**, click **Start** and type "What happens if I pay late?": the reply gives the 3-day grace period and the ₹500 fee, the same answer the knowledge base's own chat gave.
</Check>

## Exercise

Click the trash icon on `emi_policy` in the **Knowledge Base** panel. Expected result: "Knowledge base detached successfully", and the `@emi_policy` mention in the prompt turns red, because the menu lists only attached knowledge bases. Attach it again and the chip is back to normal.

## What you learned

* Short facts the agent needs on every call go in the prompt; policies, price lists and FAQs go in a knowledge base, which several agents can share.
* A knowledge base must be **Ready** before an agent can use it. Test it in its own chat first, then in the agent.
* Attaching makes the knowledge base available, and the agent decides when to search it; the `@` mention tells her which questions it answers.

<Quiz
  question="You attach emi_policy to Ananya and the toast confirms it, but on a test chat she still guesses at the late fee. What is the most likely cause?"
  answers={[
{ text: "The knowledge base must be re-uploaded after attaching", correct: false },
{ text: "The prompt never mentions @emi_policy, so she does not know which questions it answers", correct: true },
{ text: "CSV files only work with Exact match on", correct: false },
{ text: "Attaching works only after the first real call", correct: false },
]}
  correctFeedback="Right. Attaching makes the knowledge base available, but the agent decides when to search it, and the @ mention in the prompt tells her which questions it answers. Add it in FAQs, say when to use it, and save."
  incorrectFeedback="Not quite. Once the knowledge base is Ready and attached, what remains is the prompt: the @emi_policy mention tells Ananya which questions to answer from it. Re-uploading, Exact match or a real call do not change that."
/>

<RelatedTopics items={[["Knowledge base", "/documentation/inventory/knowledge-base"], ["Attach a knowledge base", "/documentation/build-agents/customize-agent-behaviour/attach-a-knowledge-base"]]} />


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