You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/site/markdown/advanced.md
+60Lines changed: 60 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ This guide covers advanced scenarios for extending and customizing your Copilot
15
15
-[Infinite Sessions](#Infinite_Sessions)
16
16
-[Compaction Events](#Compaction_Events)
17
17
-[MCP Servers](#MCP_Servers)
18
+
-[Custom Agents](#Custom_Agents)
18
19
-[Skills Configuration](#Skills_Configuration)
19
20
-[Loading Skills](#Loading_Skills)
20
21
-[Disabling Skills](#Disabling_Skills)
@@ -236,6 +237,65 @@ var session = client.createSession(
236
237
237
238
---
238
239
240
+
## Custom Agents
241
+
242
+
Extend the base Copilot assistant with specialized agents that have their own tools, prompts, and behavior. Users can invoke agents using the `@agent-name` mention syntax in messages.
243
+
244
+
```java
245
+
var reviewer =newCustomAgentConfig()
246
+
.setName("code-reviewer")
247
+
.setDisplayName("Code Reviewer")
248
+
.setDescription("Reviews code for best practices and security")
249
+
.setPrompt("You are a code review expert. Focus on security, performance, and maintainability.")
250
+
.setTools(List.of("read_file", "search_code"));
251
+
252
+
var session = client.createSession(
253
+
newSessionConfig()
254
+
.setCustomAgents(List.of(reviewer))
255
+
).get();
256
+
257
+
// The user can now mention @code-reviewer in messages
See [ConnectionState](apidocs/com/github/copilot/sdk/ConnectionState.html), [GetStatusResponse](apidocs/com/github/copilot/sdk/json/GetStatusResponse.html), and [GetAuthStatusResponse](apidocs/com/github/copilot/sdk/json/GetAuthStatusResponse.html) Javadoc for details.
375
+
376
+
---
377
+
378
+
## Message Delivery Mode
379
+
380
+
Control how messages are delivered to the session:
381
+
382
+
```java
383
+
// Default: message is enqueued for processing
384
+
session.send(newMessageOptions()
385
+
.setPrompt("Analyze this codebase")
386
+
).get();
387
+
388
+
// Immediate: process the message right away
389
+
session.send(newMessageOptions()
390
+
.setPrompt("Quick question")
391
+
.setMode("immediate")
392
+
).get();
393
+
```
394
+
395
+
| Mode | Description |
396
+
|------|-------------|
397
+
|`"enqueue"`| Queue the message for processing (default) |
0 commit comments