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}"); |
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
| builder.Services.AddSingleton<CopilotClient>(sp => | |
| { | |
| var clientOptions = new CopilotClientOptions(); | |
| clientOptions.AutoStart=true; | |
| var client = new CopilotClient(clientOptions); | |
| return client; | |
| }); |
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 using var session = await client.CreateSessionAsync(new SessionConfig | |
| { | |
| Model = "gpt-4.1", | |
| OnPermissionRequest = PermissionHandler.ApproveAll | |
| }); | |
| var response = await session.SendAndWaitAsync(new MessageOptions { Prompt = "What does this codebase do?" }); |
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
| import asyncio | |
| from copilot import CopilotClient | |
| from copilot.session import PermissionHandler | |
| async def main(): | |
| client = CopilotClient() | |
| await client.start() | |
| session = await client.create_session(on_permission_request=PermissionHandler.approve_all, model="gpt-4.1") | |
| response = await session.send_and_wait("What does this codebase do?") |
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
| // Register the factory, not the workflow | |
| services.AddSingleton<Func<MyWorkflow>>(sp => | |
| () => new MyWorkflow(sp.GetRequiredService<IMyDependency>())); | |
| // At call site | |
| var wf = workflowFactory(); // fresh each time | |
| await env.RunAsync(wf, input, sessionId); |
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
| // Fresh instance per resolution | |
| services.AddKeyedTransient<MyWorkflow>("my-workflow"); | |
| // New object every call | |
| var wf = sp.GetRequiredKeyedService<MyWorkflow>("my-workflow"); | |
| await env.RunAsync(wf, input, sessionId); |
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
| // Registered once, shared forever | |
| services.AddKeyedSingleton<MyWorkflow>("my-workflow"); | |
| // Same instance every call | |
| var wf = sp.GetRequiredKeyedService<MyWorkflow>("my-workflow"); | |
| await env.RunAsync(wf, input, sessionId); |
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
| { | |
| "autoentities": { | |
| "public-read": { | |
| "patterns": { | |
| "include": [ "dbo.%" ], | |
| "exclude": [ "dbo.internal%", "dbo.audit%" ], | |
| "name": "{object}" | |
| }, | |
| "template": { | |
| "rest": { "enabled": true }, |
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
| { | |
| "autoentities": { | |
| "public-api": { | |
| "patterns": { "include": [ "dbo.%" ] }, | |
| "permissions": [ { "role": "anonymous", "actions": [ { "action": "read" } ] } ] | |
| } | |
| }, | |
| "entities": { | |
| "Products": { | |
| "source": "dbo.Products", |
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
| { | |
| "autoentities": { | |
| "public-api": { | |
| "patterns": { | |
| "include": [ "dbo.%" ], | |
| "exclude": [ "dbo.internal%" ], | |
| "name": "{schema}_{object}" | |
| }, | |
| "permissions": [ | |
| { "role": "anonymous", "actions": [ { "action": "read" } ] } |