AI Briefing
KO

Using the GitHub Copilot SDK for Java

·2026.08.11 04:30

Key point

The GitHub Copilot SDK supports framework- and AI-provider-agnostic agent development in Java.

Details

GitHub Copilot SDK for Java is a client library for creating Copilot agent sessions, registering tools, and programmatically handling prompts and structured responses in Java server applications. It can be used in server environments including Jakarta EE and Spring, offering features familiar to Java developers such as CompletableFuture, annotations, lambdas, and virtual threads.

The SDK is not tied to any specific Java framework and is also provider-agnostic via BYOK (Bring Your Own Key). By passing your own baseUrl and apiKey or bearer token to provider and ProviderConfig, you can directly use OpenAI, Azure, Anthropic, and OpenAI-compatible endpoints without needing a Copilot subscription.

The Maven dependency is com.github:copilot-sdk-java:1.0.7-preview.1, requiring JDK 17 or 25 and Maven 3.9 or higher. Running the sample application also requires Copilot CLI 1.0.71 or later.

The sample is a real estate lead management agent pipeline based on Jakarta EE 11. When a customer inputs a 3-bedroom house in London and a budget, the server runs an independent Copilot agent session on a virtual thread to validate the inquiry, search for properties, and generate a report.

Key components include:

  • Runtime: Open Liberty 26.0.0.5
  • Platform: Jakarta EE 11 (Faces 4.1, CDI 4.1, WebSocket 2.2, Data 1.0, Persistence 3.2)
  • UI: PrimeFaces 15.0.16
  • AI Orchestration: Copilot SDK for Java 1.0.7-preview.1
  • Database: H2 in-memory database with 10 property listings

Jakarta WebSocket streams the agent's progress and tool calls to the browser in real time. When multiple inquiries are submitted simultaneously, each request is handled independently in a separate Copilot session and virtual thread.

The @CopilotTool annotation registers a standard Java method as a tool callable by the model, while @CopilotToolParam provides parameter descriptions. The SDK handles JSON Schema generation, argument parsing, and dispatch, so developers only need to write standard Java methods. However, the annotation-based tool API is currently an experimental feature.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.