Edit

Share via


Get started building an app with Windows Copilot Runtime APIs

This guide describes both hardware specifications and the steps required to configure a device and successfully build apps using the Windows Copilot Runtime APIs.

Dependencies

Ensure that your PC supports Windows Copilot Runtime and that all dependencies are installed. You can choose to do this automatically (recommended) or manually.

  1. Download the Windows Copilot Runtime configuration .winget file from the winget-dsc GitHub repo (click ... > Download from the top of the page).

  2. Next, double-click the file to open it with the Windows Package Manager client (or launch Terminal, navigate to the folder where you downloaded configuration.winget, and run the file using winget configure configuration.winget).

    This performs the following tasks:

    • Checks for minimum OS version.
    • Enables Developer Mode.
    • Installs Visual Studio Community Edition with WinUI and other required workloads.
    • Installs the Windows App SDK.

Build a new app

The following steps describe how to build your own app that uses Windows Copilot Runtime APIs (select the tab for your preferred UI framework).

  1. In Visual Studio, create a new WinUI project by selecting the Blank App, Packaged (WinUI 3 in Desktop) template.

    A screenshot of the Visual Studio new Project UI with the WinUI template selected.

  2. In Solution Explorer, right-click the project node, select Properties > Application > General, and ensure that the target framework is set to .NET 8.0, and the target OS is set to 10.0.22621 or later.

    A screenshot of the Visual Studio project properties pane

  3. Edit the Package.appxmanifest file (right click and select View code) and add the following snippets.

    • The systemAIModels capability to the <Capabilities> node:

      <Capabilities>
         <systemai:Capability Name="systemAIModels"/>
      </Capabilities>
      
    • The systemai namespace specifier to the <Package> node:

      xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10"
      
  4. Right-click the project node and select Manage NuGet Packages...

  5. In NuGet Package Manager, check the Include prelease checkbox, and select Windows App SDK version 1.8.250410001-experimental1. Click Install or Update.

    A screenshot of the Visual Studio nuget package manager with Microsoft.WindowsAppSDK 1.8.250410001-experimental1 selected.

  6. Ensure that your build configuration is set to ARM64.

    A screenshot of the Visual Studio build config set to ARM64

  7. Build and run your app.

  8. If the app launches succesfully, then continue to Add your first AI API. Otherwise, see Troubleshooting.

Advanced tutorials and APIs

Now that you've successfully checked for model availability, explore the APIs further in the various Windows Copilot Runtime tutorials.

Troubleshooting

If you encounter any errors, it's typically because of your hardware or lack of model availability.

  • The GetReadyState method checks whether the model required by an AI feature is available on the user's device. You must call this method before any call to the model.
  • If the model isn't available on the user's device, then you can call the method EnsureReadyAsync to install the required model. Model installation runs in the background, and the user can check the install progress on the Windows Settings > Windows Update Settings page.
  • The EnsureReadyAsync method has a status option that can show a loading UI. If the user has unsupported hardware, then EnsureReadyAsync will fail with an error.

See Troubleshooting and FAQ for more assistance.

See also