Skip to content
Last updated

Creating a Knowledge Base

A Knowledge Base is a tool that gives the reference data to Agent, which is critical capability for agent to generate more accurate and desired output. AI Agent Foundry offers 2 types of Knowledge Base, one is Database and the other is Text. Follow the instruction below to create a new Knowledge Base.

  1. Open Treasure Console.
  2. Navigate to AI Agent Foundry.
  3. Select Knowledge Base and then select Create knowledge base.

Create a Database Knowledge Base

Enter Knowledge Base Details​

  1. Enter a Knowledge Base name specifying how it is used
  2. Select Database type, then select a database.

Database knowledge base configuration form

Select Format Type

When creating a Database knowledge base, you can choose how query results are returned to the AI agent by selecting a Format type:

  • Markdown-KV (Recommended)
  • JSON (Legacy)

Format type selection

Markdown-KV is the recommended format for new knowledge bases. It returns query results in a human-readable format with headings and key-value pairs, making it easier for LLMs to understand. Since agent queries run with the user's own permissions (as of April 2026), access control is enforced at the permission level rather than through table filtering.

Key benefits:

  • Format Type is designed to properly support Max rows and Timeout seconds settings
  • Automatic truncation warnings appear when results exceed the Max rows limit, prompting the agent to refine queries with additional WHERE conditions

Configuration options:

  • Max rows: Set the maximum number of rows returned (1-100, default: 50)
  • Timeout seconds: Set the query timeout (10-300 seconds, default: 60)

JSON (Legacy)

JSON is the legacy format that will be deprecated in the future. Use this format only if you need to restrict the knowledge base to specific tables.

When to use JSON:

  • Your database has many tables and you want to improve query performance
  • Similar table or column names exist and you want to prevent agent confusion
  • You need to limit the knowledge base to a specific set of tables (e.g., only customers and orders). The Table configuration option is available to specify which tables to include.

Limitations:

  • Max rows and Timeout seconds settings may be ignored in some cases
  • No truncation warnings for the agent when results are cut off

Enter Table Information

  1. Click Add table button to define the table information

  2. Complete the form.

FieldDescription
NameEnter a name for your knowledge base.
TypeSelect Database.
TD Database NameEnter the Treasure Data database where queries run.
The database must exist in Plazma DB.
TableDefine the table that the knowledge base supports.
TD QueryProvide the Trino SQL that defines the table using the selected database.
Exclude Columns: list every column you want to keep.
Exclude Records: filter records with a WHERE clause.
NameEnter the table name to reference.
+ Add tableSelect to add more tables to your knowledge base.
  1. Select Save.

After you select Save , the data loading process starts. Before using the knowledge base, wait until it has a status of Success.

Creating Text Knowledge Base

Enter Knowledge Base Details​

  1. Enter a Knowledge Base name specifying how it is used
  2. Select Text type, then complete the form
    Text knowledge base form
FieldDescription
NameEnter a name for your knowledge base.
TypeSelect Text.
Text-inputEnter up to 18,000 characters of reference text.

Creating Parent Segment Knowledge Base

Parent Segment Knowledge Base is automatically created when the "LLM enabled" switch is enabled on the Parent Segment Config. Currently, there is no way to create on the Custom LLM project.

Next Step

Check your Knowledge Base setup through query simulations.