# Using the GitHub Copilot SDK for Java

[Github](https://yomu.fyi/company/github) · Edward Burns · Aug 10, 2026

**Type:** Tutorial

## Summary

The GitHub Copilot SDK for Java offers a framework-agnostic client library to orchestrate AI agent sessions and tool execution directly from server-side Java code. Unlike framework-dependent alternatives, the SDK supports direct model providers such as OpenAI, Azure, and Anthropic through custom endpoint configurations without requiring a Copilot subscription. Developers can register tools declaratively using the experimental @CopilotTool annotation processor or dynamically through inline lambda definitions with ToolDefinition.from. When integrated into a Jakarta EE 11 application on Open Liberty, agent workflows run on container-managed virtual threads that propagate CDI and transaction contexts during blocking calls like sendAndWait. Real-time event subscriptions capture model execution steps and tool invocations to stream updates over WebSockets without exhausting platform threads.

## Context

Java developers previously relied on framework-specific tools such as Spring AI or framework-dependent libraries like Langchain4j to drive AI interactions within enterprise applications.

## Approach / What changed

Integrating the GitHub Copilot SDK for Java into enterprise applications using Jakarta EE 11, Open Liberty, @CopilotTool annotation processing, and container-managed virtual thread executors.

## Takeaways

- The GitHub Copilot SDK for Java supports direct model endpoints from providers like OpenAI, Azure, and Anthropic via custom base URLs and API keys without requiring a Copilot subscription.
- Using @CopilotTool annotations requires configuring -Acopilot.experimental.allowed=true and adding the SDK to annotationProcessorPaths in Maven to generate tool metadata at compile time.
- Supplying an executor backed by Jakarta Concurrency's ManagedThreadFactory enables virtual-thread-based agent loops that automatically propagate container context and lifecycle tracking.

**Tags:** [Developer Experience](https://yomu.fyi/topic/developer-experience), [Java](https://yomu.fyi/topic/java), [LLMs](https://yomu.fyi/topic/llm)

[Read original post](https://github.blog/engineering/using-the-github-copilot-sdk-for-java)
