Aspire Dashboard feat. Copilot
Aspire Dashboard: GitHub Copilot Integration
Starting with Aspire v9.3.0, the Aspire Dashboard now features a chat pane powered by GitHub Copilot. This integration is part of the broader “AI everywhere” trend seen at events like Microsoft Build, bringing contextual AI assistance directly into your development workflow (often useful, sometimes not).
The Aspire Dashboard, it’s worth noting, is a powerful standalone tool for visualizing OpenTelemetry logs, traces, and metrics, even for applications not built with Aspire. It can be executed directly from its nuget package and ingest OpenTelemetry data from any application.
How Aspire Dashboard Connects to GitHub Copilot
You’ll see the Copilot chat pane when you launch your Aspire appHost
from Visual Studio (using F5 or Ctrl-F5) or VS Code. It uses the GitHub Copilot credentials already configured in your IDE.
It’s clear the Aspire Dashboard’s Blazor component doesn’t directly communicate with Azure or OpenAI endpoints. So, how does it work?
The key lies in the AppHost
project. It declares the AspireOrchestration
capability through the Aspire SDK:
<ItemGroup>
<ProjectCapability Include="AspireOrchestration" />
</ItemGroup>
When you launch your project from Visual Studio, this declaration injects three crucial environment variables into the process:
DEBUG_SESSION_PORT
: Contains the address and port of the VS ServiceHub process endpoint.DEBUG_SESSION_TOKEN
: A Bearer token for authenticating with the VS ServiceHub process endpoint.DEBUG_SESSION_SERVER_CERTIFICATE
: The TLS certificate.
Upon launch, the <apphost>.exe
starts the developer control plane
(dcp.exe
), which then starts dcpctrl.exe
. Finally, dcpctrl.exe
executes the dashboard (from its NuGet package) with these environment variables translated into:
DASHBOARD__DEBUGSESSION__PORT
(this containslocalhost:DEBUG_SESSION_PORT
)DASHBOARD__DEBUGSESSION__TOKEN
DASHBOARD__DEBUGSESSION__SERVERCERTIFICATE
Based on these environment variables, the Aspire Dashboard configures its UI and displays the Copilot pane. When you chat with Copilot, the dashboard communicates with a Visual Studio service on localhost:<DEBUG_SESSION_PORT>
, using the DEBUG_SESSION_TOKEN
for authentication. This Visual Studio service then acts as an intermediary, relaying interactions to the Azure (OpenAI) endpoints for Copilot.
The dashboard’s internal code includes Aspire-specific prompts, found in classes like AIAssistant
or AssistantChat
, ensuring the AI assistance is relevant to your Aspire context. Should be possible to craft a non aspire version of this from the code, even though the actual protocol does not seem to be officially documented (a lot of the ServiceHub logic is documented though)
As of its release, the source code for the Aspire Dashboard v9.3.0 NuGet package, specifically for this integration, was not publicly available in the dotnet/aspire
repository.
Internals
A quick look:
- /ghcp_info: returns a list of available models (name, display_name, family, input_tokens)
- /info: returns information about the endpoint:
{"protocols_supported":["2024-04-23","2024-03-03"]}
You can use OpenAI.Chat.ChatClient
to talk to the endpoint:
var innerChatClient = new ChatClient("gpt-4o", new ApiKeyCredential(token), new OpenAIClientOptions {
Endpoint = new Uri($"https://localhost:{DEBUG_SESSION_PORT}/v1"),
Transport = new HttpClientPipelineTransport(_httpClient)
});
Useful Links
Aspire Dashboard for Non-Aspire Applications
Beyond its new Copilot integration, the Aspire Dashboard remains a valuable tool for any non-Aspire .NET application that publishes OpenTelemetry logs, traces, or metrics. Its ability to display all three types of telemetry in one place is particularly useful.
If you’re interested in running the dashboard locally for your non-Aspire apps, you can find a small PowerShell script here that can help you get started.
(I had Gemini tidy up this posting, and though I enjoy the style I believe it loses a bit of the … lighthearted, imperfect, between the lines not-to-be-taken-serious style)