Created
May 8, 2026 20:18
-
-
Save wullemsb/abf3059f361e5a348ea4088b4e1e9304 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using GitHub.Copilot.SDK; | |
| await using var client = new CopilotClient(); | |
| await client.StartAsync(); | |
| var session = await client.CreateSessionAsync(new SessionConfig | |
| { | |
| Model = "gpt-4.1", | |
| OnPermissionRequest = PermissionHandler.ApproveAll, | |
| Streaming = true | |
| }); | |
| var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously); | |
| session.On("assistant.message_delta", (evt) => | |
| { | |
| Console.Write(evt.Data.DeltaContent); | |
| }); | |
| session.On("session.idle", (_) => | |
| { | |
| Console.WriteLine(); | |
| }); | |
| await session.SendAndWaitAsync(new MessageOptions | |
| { | |
| Prompt = "Explain how the Copilot SDK execution loop works." | |
| }); | |
| await client.StopAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment