This guide shows how to use the AgentsClientSDK NuGet package in your WinUI 3 (.NET 8) project by downloading it from GitHub Releases and setting it up manually via a local NuGet source.
- Go to the Releases section of this repository.
- Download the
.nupkgfile (e.g.,AgentsClientSDK.1.0.0.nupkg) from the latest release.
- Create a folder on your machine to act as a local NuGet feed, e.g.:
mkdir C:\LocalNuGet-
Move the downloaded
.nupkgfile into that folder. -
Register the folder as a NuGet source:
dotnet nuget add source "C:\LocalNuGet" --name LocalGitHubReleaseℹ️ You only need to do this once per machine.
If you don’t already have a WinUI 3 app, you can create one:
dotnet new winui3 -n MyWinUIApp
cd MyWinUIAppRun this in your project folder:
dotnet add package Microsoft.AgentsClientSDK --version 1.0.0Or use Visual Studio:
- Right-click the project → Manage NuGet Packages
- Select the
LocalGitHubReleasesource - Search for
Microsoft.AgentsClientSDKand install it
Example usage:
using Com.Microsoft.AgentsClientSDK;
using Com.Microsoft.AgentsClientSDK.Config;
using Com.Microsoft.AgentsClientSDK.Services;
public sealed partial class MainWindow : Window
{
private AgentsClientSDK _clientSDK;
public MainWindow()
{
this.InitializeComponent();
InitializeSDK();
}
private async void InitializeSDK()
{
_clientSDK = new AgentsClientSDK();
var properties = new ClientSDKProperties
{
AgentId = "your-agent-id",
DirectLineSecret = "your-directline-secret",
EnableSpeech = true
};
await _clientSDK.StartConversationAsync(properties);
}
}// Speech service integration
var speechService = ClientSDKServiceFactory.GetSpeechService();
await speechService.StartListeningAsync();
// Agent event handling
var eventNotifier = ClientSDKServiceFactory.GetAgentEventNotifierService();
eventNotifier.OnAgentActivity += (sender, activity) => {
Console.WriteLine($"Agent: {activity.Text}");
};
// Logging integration
var logger = Com.Microsoft.AgentsClientSDK.Utils.Logger.Instance;
logger.Information("SDK initialized successfully");- Package Not Found: Check that the
.nupkgfile exists and the local source is registered viadotnet nuget list source - Build Errors: Ensure the project targets
.NET 8and usesMicrosoft.WindowsAppSDK - Runtime Issues: Validate DirectLine and Azure credentials
var config = new ClientSDKProperties
{
LogLevel = LogLevel.Debug,
EnableConsoleLogging = true
};
var isConnected = await _clientSDK.TestConnectionAsync();
if (!isConnected)
{
// Handle connection issues
}