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

# Managed topics

> Create curated topics with sample questions, answers, and actions to handle common caller requests.

Managed Topics define what your agent knows and how it responds. Each topic has sample questions, an answer, and optional actions (handoffs, SMS, tool calls). Topics cover the questions callers ask most: return policies, store hours, appointment availability, account lookups.

Managed Topics are found under **Build > Knowledge > Managed Topics tab**.

<Note>
  **Use Managed Topics when** you need precise control over what the agent says, or when the answer should trigger an action (SMS, handoff, tool call). **Use [Connected Knowledge](/connected-knowledge/introduction) instead** when you want to expose large volumes of external content (help articles, PDFs, FAQs) without curating individual topics.
</Note>

<div className="simplified-only">
  <Tip>
    [Agent Builder](/studio-assistant/introduction) pre-populates your Managed Topics from the URL or document you gave it at sign-up. Skim what it built, then ask in plain language to fix anything that's off ("tighten the refund answer", "add a topic for store hours"). You can also edit topics directly in this tab.
  </Tip>
</div>

<div className="full-only">
  If you need to add custom logic to your topics, such as API calls, data lookups, or conditional behavior, see the [Tools](/tools/introduction) section under **Build** in the sidebar.
</div>

## The Managed Topics interface

Searchable, filterable list of all topics. Click any topic to edit its content, sample questions, or actions. Supports bulk CSV import, activation toggling, and deletion.

## How retrieval works

<Frame caption="How retrieval finds the best-matching topic">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-rag-ven.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=eb1bbf63bd2813de43d87b6646628610" alt="Retrieval-augmented generation flow for Managed Topics" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1946" height="676" data-path="images/managed-topics/kb-rag-ven.png" />
</Frame>

The agent **does not** see all MTs at once. Instead, it uses [retrieval-augmented generation (RAG)](/managed-topics/RAG/introduction) to find the best match for the user's message.

1. The retriever compares the message to the topic's **name**, **sample questions**, and **content**, with higher weighting given to the name and sample questions.
2. It returns the top matching topics to the LLM.
3. The [LLM](https://en.wikipedia.org/wiki/Large_language_model) selects the best match and generates a reply (and may trigger an **[action](/managed-topics/how-to-setup-action/introduction)**).

<Tip>
  [Raven](/agent-settings/raven) is the recommended model. It grounds answers in retrieved topics, says "I don't know" instead of hallucinating, and converts topic content into natural responses without example utterances.
</Tip>

## Types of Managed Topic entries

### Simple FAQ

Used when the agent just needs to answer a question with no follow-up or action required.

#### Single turn

One message in, one message out.

* Add a short, helpful reply in `content`.
* Leave `actions` empty.

#### Multi turn

Ask a clarifying question before giving the answer.

* Use branching inside `content` to structure the reply.
* Leave `actions` empty.

<Frame caption="Example, Pet policy (multi-turn)">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-multi.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=085e9af105bcb6e981c965fd3e7c0cae" alt="multi-pet_policy" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1400" height="1034" data-path="images/managed-topics/kb-multi.png" />
</Frame>

### Handoff

Used when the agent should offer to connect the user to a human agent.

#### Offer

Agent replies, then offers to transfer.

* `content`: Include the answer and the offer.
* `actions`: Trigger `transfer_call` (or another [handoff function](/call-handoff/introduction)) only if the user accepts.

<Frame caption="Example, Spa booking">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-handoff-spa.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=521a8c9cfab7f78820a2b4c84c8abdfe" alt="handoff_offer-spa" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1490" height="886" data-path="images/managed-topics/kb-handoff-spa.png" />
</Frame>

#### Direct

Immediate transfer with no agent reply.

* Leave `content` empty.
* Always run `transfer_call` in `actions`.

<Frame caption="Example, Billing handoff">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-direct-billing.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=24d63dc9961e6af63ca2ce9332bd5266" alt="handoff-direct-billing" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1496" height="842" data-path="images/managed-topics/kb-direct-billing.png" />
</Frame>

#### Conditional

Transfer based on user clarification, for example, group size or request type.

* `content`: Ask a disambiguating question.
* `actions`: Map each answer to the correct destination.

<Frame caption="Example, Room reservations">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-handoff-conditional.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=0c46ab67cbdea113ab396de3ef12a3d2" alt="handoff_conditional-room_reservation" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1490" height="1062" data-path="images/managed-topics/kb-handoff-conditional.png" />
</Frame>

### Outbound messaging

Used when you want to send a follow-up message via SMS or WhatsApp.

#### Offer

Offer to send a link via message.

* `content`: Include a short message and ask for consent.
* `actions`: If accepted, call `start_sms_flow`. See [SMS setup](/sms/introduction) for details.

<Frame caption="Example, Send a link">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-handoff-sms.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=40a16533e552d8a3fd77de25207d96d6" alt="SMS_offer" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1488" height="838" data-path="images/managed-topics/kb-handoff-sms.png" />
</Frame>

#### Conditional

Let the user choose which message to receive.

* `content`: Ask a branching question.
* `actions`: Map answers to different `sms_id`s.

<Frame caption="Example, Conditional SMS">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-sms-conditional.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=994d6e4e469d225ddc239217b6515281" alt="SMS_conditional" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1490" height="894" data-path="images/managed-topics/kb-sms-conditional.png" />
</Frame>

### Info only

Used for static reference material (like opening hours or prices). No interaction or action required.

* Fill `content`.
* Leave `actions` empty.

<Frame caption="Example, Opening hours">
  <img src="https://mintcdn.com/polyai/Qu880HppNqT19Eyr/images/managed-topics/kb-misc-info.png?fit=max&auto=format&n=Qu880HppNqT19Eyr&q=85&s=b439e82d208a34d44080caacd778b77c" alt="misc_info_dump_opening_hours" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="1474" height="1092" data-path="images/managed-topics/kb-misc-info.png" />
</Frame>

## Entity extraction and structured data collection

Managed Topics do not support entity extraction directly. If you need to collect structured data (names, dates, phone numbers, etc.) when a topic is matched, trigger a flow from the topic's action and configure [entity extraction](/flows/no-code/entities) in that flow's steps.

There are two ways to trigger a flow from a topic:

### Using the /Flow shortcut (no code)

In the topic's **Actions** field, type `/Flow` to insert a flow action. Select or create the target flow. When the topic matches, the agent enters the flow and can begin collecting entities.

### Using a tool call (code)

Alternatively, add a tool call action to the topic that calls `conv.goto_flow()`:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def start_booking_flow(conv: Conversation):
    conv.goto_flow("Collect booking details")
    return
```

This approach is useful when you need additional logic before entering the flow, for example, storing the originating topic name in `conv.state` so the agent can return to it after the flow completes.

### Returning to the topic after a flow

If the agent is answering an FAQ and takes a detour through a flow (e.g. to collect a date or verify identity), the agent can pick up where it left off after exiting the flow. To do this:

1. Before entering the flow, store the topic name in state (e.g. `conv.state.original_topic = "how_to_make_claim"`).
2. In the flow's exit function, check the stored topic and return a prompt directing the LLM back to the relevant topic content.

This avoids a generic "Is there anything else I can help with?" when the caller's original question has not yet been answered.

For the full triggering-flows reference, see [Triggering flows](/flows/triggering-flows).

## Best practices

### Writing good sample questions

Include at least **3 sample questions** per topic (maximum 20). This baseline helps the AI generalize intent across typical phrasings. For broad topics, add more to ensure better coverage.

* Focus on variety in **language and structure**, don't just make minor rewrites of the same sentence
* Think about how real users might describe the same issue, confused, specific, vague, or using non-standard terminology
* Additional examples should reflect **distinct phrasings**, not slight rewordings
* Vary sentence lengths alongside phrasing variety
* Consider including short queries ("billing help") alongside full questions ("Why was I charged twice this month?")

If migrating from an intent-based project, you might have more than 10 sample questions. Focus on keeping the most diverse items that preserve the full semantic scope of the original list.

### Topic naming

Because the topic **Name** is shown to the retriever, it should be semantically close to the topic content. For instance, a topic about payment disputes named "general\_behavior-payment" will likely trigger on payment queries in general rather than only on disputes.

* Make topic names **semantically descriptive**, the name should clearly reflect what the topic is about
* Avoid generic names like `Misc`, `Help`, `Info`, or `General`
* Use natural language: `Payment dispute resolution` is better than `payment_dispute_v2`

### Writing topic content

* Keep replies **brief, helpful, and consistent** with your brand style
* Give the agent **one task per turn**, do not mix text responses and tool calls in the same round
* Break down multi-step processes into **multiple turns or topics** rather than cramming everything into a single entry
* For multi-turn topics, structure the conversation so each turn has a clear purpose (ask a question, provide information, or trigger an action)
* After answering a simple FAQ, ensure the agent asks if the user needs more help, either in the topic content or in the [Behavior](/agent-settings/rules) section

### Using actions effectively

* Use `actions` **only when necessary**, if the agent just needs to answer a question, leave actions empty
* Limit to **one action per turn** for reliability
* When an action requires a handoff, include the handoff utterance as a parameter to `transfer_call` rather than mixing a `content` response with the action
* For conditional actions (transfer to different destinations based on caller response), use the disambiguating question in `content` and map each answer to its destination in `actions`

### General guidelines

**Do this:**

* Use specific topic names.
* Add **3–20** realistic sample phrasings per topic.
* Keep replies short, helpful, and on-brand.
* Use `actions` only when necessary.
* Split multi-part flows into separate turns or topics.
* Give the agent one task per turn, either speak or act, not both.

**Avoid this:**

* Bundling multiple intents into one topic.
* Running more than one action in a single turn.
* Using vague topic names like `Misc`, `Help`, or `Info`.
* Mixing text and tool calls in the same turn.

### Common anti-patterns

**Mixing text and tool calls in one turn:** For best results, split utterances and tool calls into separate turns, give the agent one task per turn. When a topic requires both a spoken response and an action, structure it so the response happens in one turn and the action in the next.

<Tabs>
  <Tab title="Good">
    Turn 1: Agent answers the question and asks if the user wants to be transferred.

    Turn 2: If the user says yes, call `transfer_call` with a handoff utterance.
  </Tab>

  <Tab title="Bad">
    Single turn: Answer the question, then immediately call `transfer_call` with utterance, the agent may skip one of these tasks.
  </Tab>
</Tabs>

**Overloading a topic with multiple intents:** If a topic covers "billing questions" but includes return policies, refund processes, and payment methods, it becomes too broad. Split each into its own topic with specific sample questions.

**Missing follow-up prompt:** Without a follow-up question like "Is there anything else I can help with?", the agent may hallucinate a next step. Add this to each simple FAQ's content or configure it in the [Behavior](/agent-settings/rules) section.

## Live collaboration

Multiple users can edit Managed Topics at the same time. Changes are synced in real time, so you can collaborate on topic content without overwriting each other's work.

## Activating and deactivating topics

<Frame caption="Activate or deactivate a topic in Managed Topics">
  <img src="https://mintcdn.com/polyai/Dlkm5JXi7Fl7VLZ9/images/release-notes/2511/kb-toggle.png?fit=max&auto=format&n=Dlkm5JXi7Fl7VLZ9&q=85&s=b3efc3d96ed4f299f47c4b2706d2e250" alt="kb-toggle" style={{ maxWidth: '720px', width: '100%', margin: '0 auto', display: 'block' }} width="3018" height="704" data-path="images/release-notes/2511/kb-toggle.png" />
</Frame>

Not every topic needs to be available all the time. You can temporarily **deactivate** a topic to keep it out of retrieval without deleting it or removing its content.

* Inactive topics are **ignored by the [LLM](https://en.wikipedia.org/wiki/Large_language_model)** and marked clearly in the UI.
* Activation status is **environment-specific**, so you can test changes safely in Sandbox before going live. Learn more about [environments and versions](/environments-and-versions/introduction).
* CSV import/export includes an `Active` column (`Y`/`N`) for bulk updates.

This is useful for seasonal articles, phased rollouts, A/B tests, or hiding content that is not ready for production.

<div className="developer-only">
  ## Automate with the Agents API

  If you already have a knowledge base somewhere else (a help center, CMS, or intents list), you can create and sync topics programmatically instead of clicking through the UI.

  <AccordionGroup>
    <Accordion title="Seed or sync topics via the Agents API" icon="code">
      The [Agents API](/api-reference/agents/introduction) has full CRUD for knowledge base topics. This is especially handy for the initial migration or for scheduled syncs from an external source.

      <CodeGroup>
        ```bash curl theme={"theme":{"light":"github-light","dark":"github-dark"}}
        # Create a knowledge base topic on the main branch
        curl -X POST https://api.us.poly.ai/v1/agents/AGENT_ID/branches/main/knowledge-base/topics \
          -H "x-api-key: $POLYAI_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{
            "name": "Password reset",
            "sampleQuestions": ["How do I reset my password?", "I forgot my password"],
            "content": "To reset your password, visit the account portal..."
          }'
        ```

        ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
        import os, requests

        BASE = "https://api.us.poly.ai"
        HEADERS = {"x-api-key": os.environ["POLYAI_API_KEY"]}

        # Sync all FAQ entries from your CMS into PolyAI topics
        for faq in cms.list_faqs():
            requests.post(
                f"{BASE}/v1/agents/{AGENT_ID}/branches/main/knowledge-base/topics",
                headers=HEADERS,
                json={
                    "name": faq["title"],
                    "sampleQuestions": faq["variants"],
                    "content": faq["answer"],
                },
            )
        ```
      </CodeGroup>

      See [Knowledge base endpoints](/api-reference/agents/endpoint/knowledge-base/list-knowledge-base-topics) for the full list.
    </Accordion>
  </AccordionGroup>
</div>

## Resources

<CardGroup cols={2}>
  <Card title="Actions guide" icon="bolt" href="/managed-topics/how-to-setup-action/introduction">
    Add tool calls, handoffs, and SMS triggers to topics.
  </Card>

  <Card title="FAQ troubleshooting" icon="circle-question" href="/troubleshoot/faq">
    Common issues with topics, rules, and actions.
  </Card>

  <Card title="Maintenance guide" icon="wrench" href="/learn/maintain/knowledge-base">
    Keep topics accurate and up to date over time.
  </Card>

  <Card title="Knowledge base endpoints" icon="square-terminal" href="/api-reference/agents/endpoint/knowledge-base/list-knowledge-base-topics">
    Create and sync topics via the Agents API.
  </Card>
</CardGroup>
