AI-Assisted Cosmos DB Development with Agent Kit
Install Cosmos DB Agent Kit, review generated modelling and SDK code, and validate recommendations against real query and write workloads.
A knowledgeable reviewer, not a database operator
Think of Agent Kit as the Cosmos DB handbook your coding assistant can consult while reviewing your work. It helps the assistant spot an unsuitable partition key or an expensive query. It does not become the person approving production changes.
The October 2026 DP-420 objectives explicitly include Agent Kit. Dedicated server-side JavaScript programming is no longer a named objective group. Stored procedures still exist, but studying them is not a substitute for this new development workflow.
Install the published skill
Use an assistant that supports Agent Skills and a development environment with Node.js:
npx skills add AzureCosmosDB/cosmosdb-agent-kit
The kit supplies rules for data models, partition keys, SDK usage, queries, indexing, throughput and AI retrieval. It loads relevant guidance when the assistant encounters a matching task.
Installing guidance does not require granting the assistant an account key. It also does not provision a database or automatically run a proposed query against production.
Review a generated application
Suppose a team receives code that creates a new CosmosClient for every HTTP request, concatenates user text into a query and fetches every field of every matching document.
Ask a precise question:
Review this Cosmos DB service for client-lifetime, parameterization,
partition-routing and response-size problems. Explain each proposed change.
Evaluate the recommendation in context:
| Area | What to check | Evidence before release |
|---|---|---|
| Client lifetime | Reuse the SDK client rather than constructing one per request | Connection use and latency under concurrency |
| Query parameters | Keep user values separate from query text | Tests with quotes and unexpected input |
| Partitioning | Match the dominant access pattern without a hot key | Per-partition load and representative query routing |
| Index policy | Keep the indexes needed by actual query shapes | Query metrics, write RU charges and regression tests |
| Retrieval | Match vector policy to embeddings and combine signals when useful | Relevance, recall, latency and RU cost |
These are not unconditional instructions to remove fields, change every key or turn on every index. A recommendation that helps one query can increase write costs or harm a different query.
Accelerate an AI application safely
Use the kit to review a proposed vector container, tenant-scoped retrieval query and SDK access layer. Have it explain the relationship between the embedding policy and vector index before accepting generated configuration.
Then validate:
- Compare generated properties and API calls with the current documentation.
- Load representative model-generated embeddings.
- Check authorized tenant filtering and parameterized queries.
- Measure relevance and operational cost on realistic queries.
- Test ordinary application reads and writes as well as retrieval.
The kit gives the assistant better reference material. It cannot prove a particular application meets its service objective.
Try it
In an isolated development project, request a review of a deliberately small data model with a low-cardinality partition key. Record the original design, suggested alternative and an access pattern where each would perform poorly. Do not deploy the proposal merely because the assistant sounds confident.
Agent Kit-assisted code review proposes removing an index to reduce write cost. The container also serves several production query shapes. What should the developer do?