Skip to main content

Topics are the agent’s knowledge base. They are queried through retrieval-augmented generation (RAG), and when a user’s input matches a topic, the agent retrieves its content and follows its actions.

Topics are how you teach the agent facts and guidance about specific subject areas without putting everything into flows or rules.

Location

Topics live in the topics/ directory. Each topic is stored as its own YAML file:
The filename is derived from the topic’s name field, cleaned to lowercase snake_case — a topic named Opening Hours & Locations is stored as topics/opening_hours_locations.yaml.

What a topic contains

Each topic has five main fields, plus optional tags:

Example

How topics work

A topic combines two kinds of information:

Content

The factual material that the agent retrieves through RAG.

Actions

The behavioral instructions that tell the agent what to do with that content.
This split is important: content is for facts, actions are for behavior.

Example queries

example_queries help the system understand when a topic should be retrieved.

Good example queries should:

  • cover different ways a user might ask about the same subject
  • reflect realistic user phrasing
  • stay focused on one subject area

Limits and guidance

  • use no more than 20 example queries
  • cover meaningful variation, not every minor wording change

Tags

tags is an optional list of labels for grouping and filtering topics in Agent Studio. Tags don’t change how the agent behaves.
  • poly pull writes tags only for topics that have tags.
  • A topic file without a tags key has no tags, so deleting the key clears them when you push.
  • Each tag must be non-empty and unique within the topic. Tags are case-sensitive.

Content

The content field contains factual information only. This is the material that gets retrieved via RAG and made available to the agent when the topic is matched.

Content rules

Actions

The actions field tells the agent how to behave when the topic is matched. This is the only place inside a topic where you should use references and behavior-oriented instructions.

Supported references in actions

Writing good actions

Actions should be:
  • clear
  • scannable
  • structured
  • behavior-oriented
Use markdown headers like ## and ### to break up branches or conditions.

Prefer

  • structured conditional sections
  • plain instructions like “Tell the user that…”
  • clear points where a function should be called

Avoid

  • dense paragraphs mixing facts and behavior
  • "Say: '...'" phrasing
  • putting factual content into actions

Validation

  • The filename must match the cleaned version of name — a mismatch raises a validation error on pull or push.
  • name cannot start with Guardrail - , which is reserved for guardrails.
  • An example query cannot be empty or contain |.

Best practices

  • keep content and actions separate
  • use one topic per subject area
  • split large topics when they become too broad
  • prefer structured ## branches in actions
  • disable topics with enabled: false during development instead of deleting them
Tell, don’t scriptPrefer instructions like “Tell the user that …” over hard-coded dialog such as Say: '...'. This lets the agent vary phrasing naturally, especially across languages.

Functions

Learn how global functions referenced in topic actions are defined.

Flows

See how topics hand off to structured processes using conv.goto_flow.

Variants

See how variant attributes can be referenced from topic actions.

Managed Topics (platform)

How topics are retrieved, ranked, and injected — RAG mechanics, topic types, and retrieval tuning.
Last modified on November 27, 2026