Domain 1 โ€” Module 15 of 15 100%
15 of 31 overall
Domain 1: Design and develop database solutions Free โฑ ~15 min read

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:

AreaWhat to checkEvidence before release
Client lifetimeReuse the SDK client rather than constructing one per requestConnection use and latency under concurrency
Query parametersKeep user values separate from query textTests with quotes and unexpected input
PartitioningMatch the dominant access pattern without a hot keyPer-partition load and representative query routing
Index policyKeep the indexes needed by actual query shapesQuery metrics, write RU charges and regression tests
RetrievalMatch vector policy to embeddings and combine signals when usefulRelevance, 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:

  1. Compare generated properties and API calls with the current documentation.
  2. Load representative model-generated embeddings.
  3. Check authorized tenant filtering and parameterized queries.
  4. Measure relevance and operational cost on realistic queries.
  5. 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.

Question

Does installing Cosmos DB Agent Kit authorize database changes?

Click or press Enter to reveal answer

Knowledge Check

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?

Official reference

Azure Cosmos DB Agent Kit