Instructions
The user wants to move their Chroma collections to TopK. Follow the steps below in order. You run every command yourself; the user only logs in to TopK in the browser, gives you Chroma credentials if you can’t find them, and approves the plan in step 4. Rules:- Never write to, modify or delete anything in Chroma. Every Chroma call in this guide is a read.
- Never print, log or commit the Chroma API key. Pass credentials to commands as environment variables on the same command line.
- Don’t import anything into TopK until the user approves the plan in step 4.
- Use the
topkCLI for TopK. Don’t ask the user for a TopK API key:topk loginis enough. - Pass
--region <REGION>to every data command (topk import,topk sql), and use the same region throughout. Account commands such astopk loginandtopk project listdon’t take it. - If
TOPK_API_KEYorTOPK_PROJECT_IDis set in the environment, runtopkcommands with them unset (env -u TOPK_API_KEY -u TOPK_PROJECT_ID topk …). - Never run a command that waits for keyboard input: pass
--yestotopk import. - Chroma Cloud stops accepting writes on November 22, 2026 and stops serving reads on December 22, 2026. If today is after December 22, 2026 and the data is on Chroma Cloud, stop and tell the user the data can no longer be exported from Chroma Cloud.
1. Set up TopK
Follow steps 1 to 4 of the Agent quickstart: install the CLI, log in, select a project and pick a region. Then come back here.2. Find the Chroma credentials
Look for them in this order, and stop at the first that works:- Environment variables
CHROMA_TENANT,CHROMA_DATABASEandCHROMA_API_KEY. - The user’s project: search the code and
.envfiles forchromadb.CloudClient,CloudClient(orCHROMA_. Note which collections the code uses. - Ask the user for their Chroma Cloud tenant ID, database name and API key. They’re in the Chroma Cloud dashboard.
chromadb.HttpClient(host=..., port=...) everywhere this guide uses chromadb.CloudClient(...).
3. Prepare a Python environment
Work in a new directory so the export files don’t mix with the user’s code:4. Inventory and plan
List every non-empty collection with its size, dimension, distance function and embedding function. Empty collections are left out, because the export skips them too:Table does not exist means the name is free. A count means a TopK collection with that name already exists. (SHOW TABLES isn’t supported yet, so check each name.)
Show the user a plan as a table: each Chroma collection, its record count, dimension, distance function, the TopK collection it becomes (same name) and its TopK metric (l2 → euclidean, cosine → cosine, ip → dot_product). Flag any name that already exists in TopK. If a collection’s embedding function isn’t none (for example DefaultEmbeddingFunction, or a hosted one whose name contains ChromaCloud), the user’s application probably queries with query_texts, and Chroma embeds those queries for them. Tell the user, and recommend a semantic index on the document so TopK embeds both documents and queries; otherwise their code has to embed queries with the same model. Tell the user that the export pages through each collection, so records their application writes while it runs can be skipped or exported twice: they should pause writes to Chroma during the export, or run the export and import again just before switching writes to TopK. Ask the user to approve the plan and to say whether TopK should also embed the document text (a semantic index). Wait for their answer.
5. Export
Write the export script from step 1 of Migrate from Chroma tochroma_to_topk.py, unchanged. If the user approved only some collections, add a check at the top of the loop that skips the others. Run it:
<collection>.jsonl and <collection>.toml for each collection, and prints one line per collection. If the user wants TopK to embed the text too, change index = "keyword" to index = "semantic" on the document line of each .toml file.
Read each .toml file and tell the user about two kinds of field the script changes, because their filters will need the new names or types:
- Fields starting with
meta_were renamed: TopK field names can’t start with_, andid,documentandembeddingare taken by the script. - Fields declared
type = "text"that hold numbers or booleans in Chroma had mixed types, so every value is now a string.
6. Import
Preview one spec first and check the plan it prints:to continue:, adding --yes. It resumes the run from its last checkpoint.
7. Verify
For each collection, compare record counts. Chroma’s count is in the step 4 output; TopK’s is:topk without TOPK_API_KEY and TOPK_PROJECT_ID, so your login and selected project apply. Set COLLECTION and REGION first.
8. Wrap up
Show the user a table per collection: Chroma count, TopK count and the average number of shared results. Then:- Point out where their code calls Chroma (from step 2), and offer to switch those queries to the TopK SDK, following step 4 of Migrate from Chroma. Before writing that code, install the TopK skill:
npx skills add topk-io/topk --skill topk. - The TopK SDKs need an API key: the user creates one at console.topk.io/api-key.
- Remind them of the Chroma Cloud dates if they apply: writes stop on November 22, 2026, so their application has to write to TopK before then.
- Tell them the export files in
chroma-to-topk/contain their data, and can be deleted once they’re satisfied.
Troubleshooting
Anything else: show the user the exact command and error message, and point them to support.