📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

TiDB for AI



TiDB is a distributed SQL database designed for modern AI applications, offering integrated vector search, full-text search, and hybrid search capabilities. This document provides an overview of the AI features and tools available for building AI-powered applications with TiDB.

Quick start

Get up and running quickly with TiDB's AI capabilities.

DocumentDescription
Get Started with PythonBuild your first AI application with TiDB in minutes using Python.
Get Started with SQLQuick start guide for vector search using SQL.

TiDB Cloud CLI (Preview)

DocumentDescription
TiDB Cloud Command Line Interface OverviewLearn when to use the TiDB Cloud CLI, how it differs from the ticloud CLI and TiDB Cloud console, and which Starter and Filesystem workflows it supports.
Get Started with TiDB Cloud CLIInstall and configure the TiDB Cloud CLI, then complete a first database or Filesystem operation.

Concepts

Understand the foundational concepts behind AI-powered search in TiDB.

DocumentDescription
Vector SearchComprehensive overview of vector search, including concepts, how it works, and use cases.

Guides

Step-by-step guides for building AI applications with TiDB using the pytidb SDK or SQL.

DocumentDescription
Connect to TiDBConnect to TiDB Cloud or TiDB Self-Managed using pytidb.
Working with TablesCreate, query, and manage tables with vector fields.
Vector SearchPerform semantic similarity searches using pytidb.
Full-Text SearchKeyword-based text search with BM25 ranking.
Hybrid SearchCombine vector and full-text search for better results.
Image SearchSearch images using multimodal embeddings.
Auto EmbeddingAutomatically generate embeddings on data insertion.
FilteringFilter search results with metadata conditions.

Examples

Complete code examples and demos showcasing TiDB's AI capabilities.

DocumentDescription
Basic CRUD OperationsFundamental table operations with pytidb.
Vector SearchSemantic similarity search example.
RAG ApplicationBuild a Retrieval-Augmented Generation application.
Image SearchMultimodal image search with Jina AI embeddings.
Conversational MemoryPersistent memory for AI agents and chatbots.
Text-to-SQLConvert natural language to SQL queries.

Integrations

Integrate TiDB with popular AI frameworks, embedding providers, and development tools.

DocumentDescription
Integration OverviewOverview of all available integrations.
Embedding ProvidersUnified interface for OpenAI, Cohere, Jina AI, and more.
LlamaIndexUse TiDB as a vector store with LlamaIndex.
MCP ServerConnect TiDB to Claude Code, Cursor, and other AI-powered IDEs.

Reference

Technical reference documentation for TiDB's AI and vector search features.

DocumentDescription
Vector Data TypesVector column types and usage.
Functions and OperatorsDistance functions and vector operations.
Vector Search IndexCreate and manage vector indexes for performance.
Performance TuningOptimize vector search performance.
LimitationsCurrent limitations and constraints.

TiDB Cloud CLI (Preview)

The command reference follows the two-level ti command tree. Every command has a dedicated page with its syntax and examples. Expand Command Reference in the documentation navigation to browse commands by family.

Command reference

DocumentDescription
TiDB Cloud Command Line Interface OverviewDecide when to use the TiDB Cloud CLI and understand its scope relative to ticloud and the TiDB Cloud console.
TiDB Cloud CLI Command ReferenceCommand tree, global flags, output, queries, dry-run, help, errors, aliases, and links to command pages.
ti configureConfigure a local profile interactively or non-interactively.
ti updateCheck for and install release updates.
ti db create-db-clusterStart with the database command reference.
ti fs create-file-systemStart with the Filesystem command reference.
ti fs import-file-system-tokenRestore local access from an existing FS token.
ti fs-git clone-git-workspaceStart with the Filesystem Git command reference.
ti fs-journal create-journalStart with the Filesystem journal command reference.
ti fs-vault create-secretStart with the Filesystem Vault command reference.
TiDB Cloud CLI Configuration and CredentialsProfiles, precedence, local state, credentials, mount locators, and logs.
TiDB Cloud CLI Regions, Security, and LimitationsPlacement, authentication boundaries, platforms, durability, and preview constraints.
Troubleshoot TiDB Cloud CLIDiagnose authentication, quota, SQL, companion, selection, and mount failures.

Scenarios for users and automation

DocumentDescription
Daily WorkflowManage one Starter cluster and Filesystem in a routine operator flow.
Query SQL with RolesUse explicit read-only, read-write, and admin SQL roles.
Share a Filesystem Across MachinesTransfer an owner token securely and verify cross-machine visibility.
Hand Off CI Artifacts Between JobsPersist build output across isolated jobs without copying a complete TiDB Cloud CLI profile.

Scenarios for AI agents

DocumentDescription
Agent SandboxGive a clean sandbox Filesystem access without TiDB Cloud API keys.
Persistent Agent StatePreserve plans, checkpoints, and results across disposable sandboxes.
Parallel Agent DatasetGive multiple agents read-only access to one shared unstructured dataset.
Git Workspace for AgentsPrepare a mounted Git workspace and isolated linked worktree.
Journal an Agent WorkflowRecord structured events and verify their hash chain.
Delegate Vault SecretsGrant an agent temporary access to one secret field.

Was this page helpful?