MySQL Vector (mysqlvec) Storage
For common Agent integration, extraction modes, and tool configuration, see Usage and Configuration.
Use case: Production, vector similarity search with MySQL + native VECTOR type
MySQL Vector stores memories in MySQL with embedding vectors for semantic similarity
search. It detects native VECTOR support at runtime and otherwise falls back
to BLOB storage with Go-side cosine similarity. Use a currently supported
MySQL 9.x release for native-vector production deployments.
Configuration options:
WithMySQLClientDSN(dsn): MySQL DSN connection string (recommended, requiresparseTime=true)WithMySQLInstance(name): Use pre-registered MySQL instanceWithEmbedder(embedder): Text embedder for vector generation (required)WithSoftDelete(enabled): Enable soft delete (default false)WithTableName(name): Custom table name (default "memories")WithIndexDimension(dim): Vector dimension (default 1536)WithMaxResults(limit): Max search results (default 15)WithMemoryLimit(limit): Memory limit per userWithCustomTool(toolName, creator): Register custom toolWithToolEnabled(toolName, enabled): Enable/disable toolWithExtraOptions(...options): Extra options passed to MySQL clientWithSkipDBInit(skip): Skip table initialization (for users without DDL permissions)
WithMySQLClientDSN takes priority over WithMySQLInstance when both are set.
With WithSkipDBInit(true), provision the table before startup. The service
still probes native VECTOR support, so the embedding column must be
VECTOR(<configured dimension>) when that probe succeeds and BLOB otherwise.
Use
memory/mysqlvec/init.go
as the authoritative native and fallback DDL.
Note: Requires MySQL 5.7.8+ for the JSON column type. The service probes
native VECTOR support and falls back to BLOB + Go-side cosine similarity when
the probe fails. No additional vector library is required.
Default table schema (auto-created when native VECTOR is available):
WithTableName replaces memories, and WithIndexDimension replaces 1536.
On the fallback path, embedding VECTOR(1536) NOT NULL becomes
embedding BLOB NOT NULL; the remaining schema is the same.
Resource cleanup: Call Close() method to release database connection: