Edit

Share via


Set up agent mode in VS Code for the Quantum Development Kit

Use agent mode in VS Code, powered by GitHub Copilot, to enhance your builder experience with The Quantum Development Kit (QDK) extension.

Agent mode is an AI-assisted development experience that helps you write and debug code, and complete other development tasks in VS Code. Although you can use agent mode for the QDK without any setup, follow these tips to get the most out of agent mode in your QDK projects:

  1. Add Copilot instructions for Q# and OpenQASM
  2. Activate the QDK tools for agent mode
  3. Try different agent models

Add Copilot instructions for Q# and OpenQASM

The QDK comes with a set of instructions for Copilot that include best practices for building projects with Q#, OpenQASM, and Azure Quantum.

To add the QDK Copilot instructions to your settings, follow these steps:

  1. Press Ctrl+Shift+P to open the command palette.
  2. Enter and choose QDK: Add Copilot instructions file for Q# and OpenQASM.
  3. In the confirmation box that opens, choose Yes.

The QDK instructions are added to your context when you use GitHub Copilot Chat in Q# and OpenQASM files. You can manually configure this setting in chat.instructionsFilesLocations.

Activate the QDK tools for agent mode

The QDK extension includes a set of tools that tailors Copilot Chat to work with Q# and Azure Quantum. For example, you can simulate Q# code, visualize quantum circuit diagrams, and perform resource estimation directly from the Copilot Chat view. You can also do things like connect to your Azure Quantum workspace, submit jobs, and view job status and job results.

To activate the QDK tools for agent mode, follow these steps:

  1. Open Copilot Chat in VS Code.
  2. If the chat is in Ask mode or Edit mode, then select the mode dropdown at the bottom of the chat input box and choose Agent.
  3. Select the Tools icon at the bottom of the chat input box.

A list pops up that contains all your available agent tools. Select all the tools under Azure Quantum Development Kit (QDK) to activate the QDK tools.

Screenshot of the list of available QDK tools for agent mode in VS Code.

Try different agent models

Copilot lets you choose from a set of different language models to use in agent mode. Different models have different strengths, so the best model for you depends on your use case.

To explore different models, select the model dropdown menu at the bottom of the chat input box and choose one of the available models from the list.

Try some prompts

Now that you're set up to leverage AI in your Q# projects, try out some prompts in the Copilot Chat.

To get started, here are a few example prompts:

Simulate this program for 1,000 shots and show me a histogram.

Submit this Q# program to Azure Quantum.

Add tests for this Q# code.

Show me my recent jobs on Azure Quantum.

Hey, I've been meaning to learn a bit about quantum computing but I have no clue where to even start. Can you just help me write a very simple program, understand it, and maybe even run it on a real quantum computer?