Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/site/markdown/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ This guide covers advanced scenarios for extending and customizing your Copilot
- [File Attachments](#File_Attachments)
- [Bring Your Own Key (BYOK)](#Bring_Your_Own_Key_BYOK)
- [Infinite Sessions](#Infinite_Sessions)
- [Manual Compaction](#Manual_Compaction)
- [Compaction Events](#Compaction_Events)
- [MCP Servers](#MCP_Servers)
- [Custom Agents](#Custom_Agents)
- [Programmatic Agent Selection](#Programmatic_Agent_Selection)
- [Skills Configuration](#Skills_Configuration)
- [Loading Skills](#Loading_Skills)
- [Disabling Skills](#Disabling_Skills)
Expand Down Expand Up @@ -317,6 +319,14 @@ var session = client.createSession(
var workspace = session.getWorkspacePath();
```

### Manual Compaction

Trigger compaction immediately when you want to reduce context usage before the automatic threshold is reached:

```java
session.compact().get();
```

### Compaction Events

When compaction occurs, the session emits events that you can listen for:
Expand Down Expand Up @@ -419,6 +429,24 @@ var session = client.createSession(

See [CustomAgentConfig](apidocs/com/github/copilot/sdk/json/CustomAgentConfig.html) Javadoc for full details.

### Programmatic Agent Selection

You can inspect and switch agents at runtime:

```java
var available = session.listAgents().get();

var current = session.getCurrentAgent().get();
if (current != null) {
System.out.println("Current agent: " + current.name());
}

var selected = session.selectAgent("reviewer").get();
System.out.println("Selected: " + selected.name());

session.deselectAgent().get(); // Return to the default agent
```

---

## Skills Configuration
Expand Down
Loading