Package com.github.copilot.sdk
package com.github.copilot.sdk
Core classes for the GitHub Copilot SDK for Java.
This package provides the main entry points for interacting with GitHub Copilot programmatically. The SDK enables Java applications to leverage Copilot's agentic capabilities, including multi-turn conversations, tool execution, and AI-powered code generation.
Main Classes
CopilotClient- The main client for connecting to and communicating with the Copilot CLI. Manages the lifecycle of the CLI process and provides methods for creating sessions, querying models, and checking authentication status.CopilotSession- Represents a single conversation session with Copilot. Sessions maintain context across multiple messages and support streaming responses, tool invocations, and event handling.JsonRpcClient- Low-level JSON-RPC client for communication with the Copilot CLI process.
Quick Start
try (var client = new CopilotClient()) {
client.start().get();
var session = client.createSession(new SessionConfig().setModel("gpt-4.1")).get();
session.on(evt -> {
if (evt instanceof AssistantMessageEvent msg) {
System.out.println(msg.getData().getContent());
}
});
session.send(new MessageOptions().setPrompt("Hello, Copilot!")).get();
}
Related Packages
com.github.copilot.sdk.events- Event types emitted during session processingcom.github.copilot.sdk.json- Configuration and data transfer objects
- See Also:
-
ClassDescriptionRepresents the connection state of a
CopilotClient.Provides a client for interacting with the Copilot CLI server.Represents a single conversation session with the Copilot CLI.Provides the SDK protocol version.Specifies how the system message should be applied to a session.