forked from github/copilot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
52 lines (46 loc) · 1.53 KB
/
Copy pathProgram.cs
File metadata and controls
52 lines (46 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using GitHub.Copilot;
using Microsoft.Extensions.AI;
using var client = new CopilotClient();
await client.StartAsync();
try
{
var analyzeCodebase = AIFunctionFactory.Create(
(string query) => $"Analysis result for: {query}",
new AIFunctionFactoryOptions
{
Name = "analyze-codebase",
Description = "Performs deep analysis of the codebase",
});
await using var session = await client.CreateSessionAsync(new SessionConfig
{
Model = "claude-haiku-4.5",
Tools = [analyzeCodebase],
DefaultAgent = new DefaultAgentConfig
{
ExcludedTools = ["analyze-codebase"],
},
CustomAgents =
[
new CustomAgentConfig
{
Name = "researcher",
DisplayName = "Research Agent",
Description = "A research agent that can only read and search files, not modify them",
Tools = ["grep", "glob", "view", "analyze-codebase"],
Prompt = "You are a research assistant. You can search and read files but cannot modify anything. When asked about your capabilities, list the tools you have access to.",
},
],
});
var response = await session.SendAndWaitAsync(new MessageOptions
{
Prompt = "What custom agents are available? Describe the researcher agent and its capabilities.",
});
if (response != null)
{
Console.WriteLine(response.Data.Content);
}
}
finally
{
await client.StopAsync();
}