Created
May 8, 2026 19:56
-
-
Save wullemsb/6e3a4782fe03c39aeca9d4f82e878431 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
| var session = await client.CreateSessionAsync(new SessionConfig | |
| { | |
| Model = "gpt-4.1", | |
| OnPermissionRequest = async (request, invocation) => | |
| { | |
| // Approve read operations automatically, prompt for anything else | |
| if (request.Kind == "read") | |
| return new PermissionRequestResult() {Kind=PermissionRequestResultKind.Approved }; | |
| Console.WriteLine("Agent wants to perform: {request.Kind} — {request.Description}"); | |
| Console.Write("Approve? (y/n): "); | |
| var answer = Console.ReadLine(); | |
| return answer?.ToLower() == "y" | |
| ? new PermissionRequestResult() {Kind=PermissionRequestResultKind.Approved } | |
| : new PermissionRequestResult() {Kind=PermissionRequestResultKind.UserNotAvailable }; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment