{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"redocly_category":"Products","product_name":"AI Agent Foundry","type":"markdown"},"seo":{"title":"Creating a Knowledge Base","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"creating-a-knowledge-base","__idx":0},"children":["Creating a Knowledge Base"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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 ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Database"]}," and the other is ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Text"]},". Follow the instruction below to create a new Knowledge Base."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open Treasure Console."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Navigate to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["AI Agent Foundry"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Knowledge Base"]}," and then select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create knowledge base"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/creating-an-ai-knowledge-base-2025-03-04.4d247864042e3ccc1a8e54da318cc7f77500db176ee71cc75ae1cf6b3981279f.91c26685.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"create-a-database-knowledge-base","__idx":1},"children":["Create a Database Knowledge Base"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"enter-knowledge-base-details","__idx":2},"children":["Enter Knowledge Base Details​"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter a Knowledge Base name specifying how it is used"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Database type, then select a database."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/creating-a-knowledge-base-2025-06-13-11-30-28.1649163d16dbbc239f56459febdc3276d56d11663469e675a74893f24abdc4fc.91c26685.png","alt":"Database knowledge base configuration form"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"select-format-type","__idx":3},"children":["Select Format Type"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When creating a Database knowledge base, you can choose how query results are returned to the AI agent by selecting a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Format type"]},":"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Markdown-KV"]}," (Recommended)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["JSON"]}," (Legacy)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-format-type-selection.e84703b347e916e4ed5498851947563e6335ff6c30a549c8812d000ad8d2d247.91c26685.png","alt":"Format type selection"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"markdown-kv-recommended","__idx":4},"children":["Markdown-KV (Recommended)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Key benefits:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Format Type is designed to properly support Max rows and Timeout seconds settings"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Automatic truncation warnings appear when results exceed the Max rows limit, prompting the agent to refine queries with additional WHERE conditions"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Configuration options:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Max rows"]},": Set the maximum number of rows returned (1-100, default: 50)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Timeout seconds"]},": Set the query timeout (10-300 seconds, default: 60)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"json-legacy","__idx":5},"children":["JSON (Legacy)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["When to use JSON:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Your database has many tables and you want to improve query performance"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Similar table or column names exist and you want to prevent agent confusion"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["You need to limit the knowledge base to a specific set of tables (e.g., only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["customers"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["orders"]},"). The ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Table"]}," configuration option is available to specify which tables to include."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Limitations:"]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Max rows and Timeout seconds settings may be ignored in some cases"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["No truncation warnings for the agent when results are cut off"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"enter-table-information","__idx":6},"children":["Enter Table Information"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Click ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Add table"]}," button to define the table information"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Complete the form."]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enter a name for your knowledge base."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Database"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TD Database Name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enter the Treasure Data database where queries run.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["The database must exist in Plazma DB."]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Table"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Define the table that the knowledge base supports."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TD Query"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Provide the Trino SQL that defines the table using the selected database.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Exclude Columns"]},": list every column you want to keep.",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Exclude Records"]},": filter records with a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WHERE"]}," clause."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enter the table name to reference."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["+ Add table"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Select to add more tables to your knowledge base."]}]}]}]}]},{"$$mdtype":"Tag","name":"ol","attributes":{"start":3},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save"]},"."]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After you select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Save"]}," , the data loading process starts. Before using the knowledge base, wait until it has a status of ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Success"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"creating-text-knowledge-base","__idx":7},"children":["Creating Text Knowledge Base"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"enter-knowledge-base-details-1","__idx":8},"children":["Enter Knowledge Base Details​"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Enter a Knowledge Base name specifying how it is used"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select Text type, then complete the form",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/creating-a-knowledge-base-2025-06-13-11-37-11.285526b225e8d44ab56b1aacd3e7e0f4a47dc71196bdf0ed6b8d0465659525cc.91c26685.png","alt":"Text knowledge base form"},"children":[]}]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enter a name for your knowledge base."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Select ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Text"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Text-input"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enter up to 18,000 characters of reference text."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"creating-parent-segment-knowledge-base","__idx":9},"children":["Creating Parent Segment Knowledge Base"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Next Step"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check your Knowledge Base setup through ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/ai-agent-foundry/knowledgebase/querying-a-knowledge-base"},"children":["query simulations"]},"."]}]},"headings":[{"value":"Creating a Knowledge Base","id":"creating-a-knowledge-base","depth":1},{"value":"Create a Database Knowledge Base","id":"create-a-database-knowledge-base","depth":2},{"value":"Enter Knowledge Base Details​","id":"enter-knowledge-base-details","depth":3},{"value":"Select Format Type","id":"select-format-type","depth":3},{"value":"Markdown-KV (Recommended)","id":"markdown-kv-recommended","depth":4},{"value":"JSON (Legacy)","id":"json-legacy","depth":4},{"value":"Enter Table Information","id":"enter-table-information","depth":3},{"value":"Creating Text Knowledge Base","id":"creating-text-knowledge-base","depth":2},{"value":"Enter Knowledge Base Details​","id":"enter-knowledge-base-details-1","depth":3},{"value":"Creating Parent Segment Knowledge Base","id":"creating-parent-segment-knowledge-base","depth":2}],"frontmatter":{"seo":{"title":"Creating a Knowledge Base"}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/products/customer-data-platform/ai-agent-foundry/knowledgebase/creating-a-knowledge-base","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}