Skip to main content

Overview

Topics are collections of related views organized by business domain. They help users discover and explore related data concepts together, and provide a way to apply default filters and configurations across multiple views.

Creating Topics

Create a file with the .topic.yml extension in your semantics/topics/ directory:
semantics/topics/sales.topic.yml

Topic Properties

Base View

The base_view property allows you to specify a primary view that serves as the foundation for queries within the topic. This helps optimize query performance and provides better context for AI agents when generating queries.

When to Use Base View

Use a base view when:
  • One view is central: Your topic has a primary fact table that other views join to
  • Query optimization: You want to guide the query engine on which view to start from
  • Agent guidance: You want to provide AI agents with context about the primary entity

Example with Base View

semantics/topics/sales.topic.yml
In this example, orders is the base view because most sales queries start from orders and join to related entities like customers and products.

Benefits

  • Performance: Queries start from the most logical table, reducing unnecessary joins
  • Context: AI agents understand which entity is primary when generating queries
  • Consistency: Ensures queries follow a consistent pattern
The base_view must be included in the views array. If specified, it provides a hint to the query engine but doesn’t restrict which views can be queried.

Default Filters

You can apply default filters to a topic that will be automatically applied to every query. This is useful for:
  • Business rules: Apply standard business logic (e.g., only active records)
  • Time-based filtering: Default to recent data (e.g., last 90 days)
  • Multi-tenancy: Filter to specific tenants or organizations
Default filters use the same syntax as query filters and support all filter operators.

Active Records Only

semantics/topics/active_customers.topic.yml

Recent Data Filter

semantics/topics/recent_sales.topic.yml

Multiple Filter Conditions

semantics/topics/high_value_completed_orders.topic.yml

Multi-Tenancy

semantics/topics/tenant_analytics.topic.yml

Filter Operators

Default filters support all standard operators:
Default filters are applied with AND logic along with any user-provided filters. This means all default filters must be satisfied in addition to any filters specified in the query.

Example Topics

E-commerce Analytics

semantics/topics/ecommerce.topic.yml

Marketing

semantics/topics/marketing.topic.yml

Finance

semantics/topics/finance.topic.yml

Product Analytics

semantics/topics/product.topic.yml

Customer Success

semantics/topics/customer_success.topic.yml

Best Practices

Organization

  • Group related views that are commonly queried together
  • Create topics aligned with business domains or departments
  • Keep topics focused—avoid including unrelated views

Naming

  • Use descriptive names that reflect the business domain
  • Use lowercase with underscores for consistency
  • Consider the end-user perspective when naming

Default Filters

  • Use default filters for consistent business logic
  • Document why default filters are applied
  • Be mindful of performance implications
  • Test queries with default filters enabled

Documentation

  • Provide clear descriptions of the topic’s scope
  • Document which views are included and why
  • Explain any default filters and their purpose

Using Topics

Topics are used in three main ways:

1. In Agents

agents/analytics.agentic.yml

2. In Workflows

workflows/sales_report.workflow.yml

3. In Routing Agents

agents/_routing.agent.yml
See Using the Semantic Model for detailed examples.

Views

Create views for your topics

Usage

Use topics in agents and workflows

Overview

Back to semantic model overview