nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
The GitHub Blog·Aug 10, 2026·9 min read·Edward Burns66

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.

AICompilersJava
AI summarygenerated from the source article

You do not need a GitHub Copilot subscription—or an IDE—to run GitHub's new Copilot SDK for Java. 👇

Java developers adding AI agents to enterprise applications usually have to accept framework lock-in. Abstractions like LangChain4j or Spring AI impose their own design choices and complicate running AI sessions natively inside standard enterprise application servers.

GitHub built the Copilot SDK for Java, a framework-agnostic client library that lets server-side Java applications manage agent sessions, register custom tools, and run AI prompts programmatically.

The SDK operates headless by communicating directly with a local Copilot CLI. You start by configuring a `CopilotClient` with a custom thread `Executor`. In application servers like Open Liberty, you pass a container-managed `ManagedThreadFactory` configured for virtual threads. This ensures agent tasks run on non-blocking threads that carry the server's CDI, database, and transaction context.

To give the model actions to perform, you expose regular Java methods as tools. Annotating a method with `@CopilotTool` tells the SDK's annotation processor to generate the JSON Schema and argument parsing logic at compile time. You can also define inline tools on the fly using `ToolDefinition.from()` lambdas.

Before opening a session, you configure security and prompt parameters in a `SessionConfig`. You can restrict tool access using a `ToolSet`, replace prompt sections like `IDENTITY` while preserving safety guardrails, or set custom permission handlers.

To run the agent pipeline, you execute a single line: `session.sendAndWait(...)`. The SDK handles the full agentic loop under the hood → the model reasons, triggers your Java tools, receives the output, and iterates until it completes the request. Every step fires events through `session.on(...)`, allowing you to push real-time updates to web clients over WebSockets.

The result is native AI orchestration that feels like standard Java. Using its Bring Your Own Key (BYOK) mode, you can point the SDK at OpenAI, Azure, or Anthropic endpoints without a Copilot subscription, running concurrent agents cleanly on virtual threads.

Read original on github.blog

Score breakdown

  • Technical depth85
  • Practical value45
  • Originality85
  • Writing quality100
  • Source reputation85
  • Recency42
  • External engagement0
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on github.blog.

More like this

Shopify Engineering

Developer Talks: How the Command Line Can Empower You (Webinar) - Shopify

Nov 20, 2018·4 min read
Engineering at Meta

Sapling: Source control that’s user-friendly and scalable

Nov 15, 2022·14 min read
Engineering at Meta

Retrofitting null-safety onto Java at Meta

Nov 22, 2022·18 min read
Shopify Engineering

YJIT: Building a New JIT Compiler for CRuby - Shopify

Oct 14, 2021·8 min read