Using the GitHub Copilot SDK for Java
Enterprise Java developers have a new superpower—drive GitHub Copilot from idiomatic Java code with annotations, virtual threads, and more. The post Using the GitHub Copilot SDK for Java appeared first on The GitHub Blog .
Java developers now have a framework-agnostic way to incorporate AI into their enterprise applications using the GitHub Copilot SDK for Java. This SDK allows for the creation of Copilot agent sessions, registration of tools, sending of prompts, and receiving of structured responses, all programmatically. It can be used with any direct model provider such as OpenAI, Azure, or Anthropic, by providing a provider and a configured set of parameters like base URL and API key or bearer token.
No Copilot subscription is required. The SDK is designed for server-side Java code and works seamlessly in Jakarta EE and Spring environments. It supports modern Java features like CompletableFuture, annotations, lambdas, and virtual threads. The provided sample application demonstrates how to use the SDK in a Jakarta EE 11 environment, where a customer inquiry is processed through a pipeline by an isolated Copilot Agent running on a virtual thread.
The application uses Jakarta WebSocket for real-time status updates. To use the SDK, one must have JDK 17 or 25, Maven 3.9 or higher, a GitHub account with an active Copilot subscription, and the Copilot CLI installed. The SDK is currently available as a Maven dependency and is ready to be integrated into existing Java applications.
Written by urgent.news from GitHub Blog's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.