Edit

How to use agent mode in VS Code for the QDK

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

Agent mode is an AI-assisted development experience that helps you write and debug code, and complete other development tasks in VS Code. The QDK extension includes a SKILL.md file that GitHub Copilot agent reads to learn Agent Skills for specific tasks related to development in the QDK. The QDK skills help Copilot to perform the following tasks in agent mode:

  • Write, debug, and explain Q# and OpenQASM code
  • Develop with the qdk Python library
  • Explain quantum computing concepts
  • Give you information about your Azure Quantum jobs and workspaces

For more information about Agent Skills for GitHub Copilot in VS Code, see Use Agent Skills in VS Code on the VS Code website.

Prerequisites

Set up Agent Skills from the QDK

To get started with the QDK Agent Skills for agent mode in VS Code, follow these steps:

  1. Open a Q# (.qs) or (.qasm) file in VS Code.

  2. Open the Copilot Chat window in VS Code.

  3. In the chat box, select the Set Agent icon and choose Agent.

    Screenshot that shows the Set Agent icon in the Copilot chat box in Visual Studio Code.

  4. In the chat box, select the Configure Tools icon. The Configure Tools window opens.

    Screenshot that shows the Configure Tools icon in the Copilot chat box in Visual Studio Code.

  5. Select all the tools in the Microsoft Quantum Development Kit (QDK) dropdown section, and then select the OK button.

    Screenshot that shows the all the QDK tools selected in the Configure Tools window in Visual Studio Code.

  6. Enter a prompt for Copilot agent. For example, if your file already contains a program, ask what the code does. Or, if your file is empty, tell Copilot to write a teleportation algorithm.

Copilot reads the Agent Skills from the QDK and responds to your prompts with specialized knowledge about the QDK, Azure Quantum, and quantum computing.

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 Pick Model icon in the Copilot chat box and choose one of the available models from the list.

Screenshot that shows the Pick Model icon in the Copilot chat box in Visual Studio Code.

Try some prompts

Now that you're set up to leverage AI in your QDK 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 program to Azure Quantum.

Add tests for this 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?