Use the Azure Cosmos DB Agent Kit

Use the Azure Cosmos DB Agent Kit to get task-specific guidance from your AI coding assistant. Provide the code, data model, or workload information needed for the task, and validate the assistant's recommendations before applying them.

Prerequisites

Don't share credentials, access tokens, connection strings, or sensitive document values. Replace sensitive values while preserving the structure needed for the review.

Review a partition key

Provide your proposed partition key, representative document shapes, common query filters, estimated write rates, expected data growth, and any tenant-size differences.

Ask your assistant:

Use the Azure Cosmos DB Agent Kit to review my proposed partition key.
Evaluate it against my query patterns, write distribution, cardinality,
and expected data growth. Identify hot-partition and storage risks.
Ask for missing workload information before recommending a key.
Explain the trade-offs between suitable alternatives.

Expect recommendations tied to the workload you supplied, with assumptions and missing information called out. Validate the recommendation against representative data and traffic. Don't treat a proposed key as a measured scalability result.

Optimize a query

Provide the query, partition-key definition, indexing policy, representative document shapes, required result fields, and available request unit (RU) charges and query diagnostics.

Ask your assistant:

Use the Azure Cosmos DB Agent Kit to review this query and indexing policy.
Preserve the required results. Explain possible cross-partition work,
unnecessary projections, and relevant indexing changes.
Separate recommendations supported by the supplied diagnostics from hypotheses.
Describe how I should compare RU charge and latency before and after a change.

Expect an explanation of each proposed change and its effect on query behavior. Test the original and revised queries against the same representative dataset and indexing state. Confirm equivalent results, and measure RU charge and latency across representative requests before claiming an improvement.

Review SDK code

Provide the SDK language and package version, client initialization, relevant database operations, authentication approach, and sanitized error diagnostics.

Ask your assistant:

Use the Azure Cosmos DB Agent Kit to review this SDK code.
Check client reuse, asynchronous operations, parameterized queries,
pagination, authentication, retry behavior, and diagnostic logging.
Respect the SDK's existing retry behavior.
Explain each proposed change and provide tests or checks to validate it.
Prefer Microsoft Entra ID authentication where the deployment supports it.

Expect recommendations that match your SDK and deployment environment. Run the relevant build and tests, check error and throttling behavior, and validate access permissions in a nonproduction environment before deploying changes.

Best use cases

Use the kit when you want help with:

  • Designing data models and choosing partition keys.
  • Reducing RU consumption and improving query performance.
  • Writing safer SDK code, including client reuse, retries, and error handling.
  • Choosing authentication, access, and security patterns.
  • Planning indexing strategies for common and vector workloads.
  • Setting throughput, autoscale, and scaling options.
  • Choosing consistency and global distribution settings.
  • Reviewing monitoring, diagnostics, and operational logging.
  • Applying design patterns for agentic workflows, change feed, and materialized views.
  • Configuring vector search, full-text search, and hybrid search.
  • Catching platform-specific gotchas before they reach production.

Understand the assistant's limits

Skill activation depends on your host's discovery and context-loading behavior. See Agent Kit compatibility if the relevant guidance doesn't load.

Installing skills doesn't, by itself, connect your assistant to a database. Unless you configure separate tools and permissions, the assistant works from the information you provide. Generated recommendations don't prove that a query was executed or that RU consumption improved.

For current official documentation, you can also connect your assistant to Microsoft Learn. Documentation retrieval is separate from database access.

AI tools

Connect your coding agent to Microsoft Learn or use these task recipes in your assistant.

For a compact index of the guides and their Markdown versions, use the Agent Kit documentation index (llms.txt). This index is a discovery aid, not a crawler policy or a guarantee that an assistant retrieves the articles.

Connect your AI agent
Set up Microsoft Learn MCP in Visual Studio Code.

Read as Markdown
Open a text version to copy into your assistant.

Ask ChatGPT
Choose a task recipe and identify the context it needs.

Ask Claude
Choose a task recipe and identify the context it needs.

The external links send only a public article URL and a generic prompt. You might need to sign in. If the assistant can't retrieve the article, copy the relevant Markdown text instead. Don't add secrets or sensitive data to prompts.

Next step