01 / THE SIGNAL

我们发现了什么

GitHub's Copilot SDK for Java: Run AI Agents in Spring Boot Without Spring AI or LangChain4j. Every Java team adding AI to a backend right now faces the same fork in the road.

  • 来源:DEV Community(发现于 2026-08-22)
  • 证据等级:C · 存在定价或订阅线索;有收费设计不等于已有收入。
  • 商业模式:待核验
  • 主题:开发者工具
  • 初筛评分:14.7/100 · 收录 1 次
#开发效率#付费线索#产品发现
02 / SOURCE & EVIDENCE

证据,比故事更重要。

存在定价或订阅线索;有收费设计不等于已有收入。

规则清洗与初筛,未经人工商业核验。原文语境、实际客户和付费情况仍需自行验证。

引用与数字披露

来源类型(原作者自述/第三方测算/媒体转引)需采集端标注,本版尚未落字段。

短句引用
作者
未标注
抓取日期
来源类型
未标注
数字口径
币种
未标注
口径
未标注
披露主体
未标注
披露日期
未标注

中文辅助译文(节选·触顶截断)

目前,每一个在后端集成 AI 的 Java 团队都面临着同样的岔路。如果你在使用 Spring Boot,你会选择 Spring AI。如果不是,你会选择 LangChain4j。这两者都是优秀的库。但它们也都伴随着一个承诺:你必须采用它们的抽象、它们的发布节奏,以及它们对智能体循环(agent loop)的“看法”。而如果你使用的是 Jakarta EE、Micronaut 或 Quarkus,Spring 这条路对你而言就完全不通了。

2026 年 8 月 10 日,GitHub 悄然发布了第三个选项。Edward Burns——这位主导 Java 绑定并担任 Jakarta EE 11 发布协调人的首席工程师——在 GitHub 博客的工程文章中详细介绍了 Copilot SDK for Java。简而言之:为 Copilot CLI 提供支持的同一套智能体运行时,现在变成了一个 Maven 依赖,你可以将其嵌入到任何服务端 Java 应用中,无论是 Spring 还是非 Spring,IDE 还是非 IDE。凭借其 BYOK 模式,它可以使用你自己的 API key 对接 OpenAI、Anthropic、Azure 或任何 OpenAI 兼容端点,无需 Copilot 订阅。

最后那句话才是关乎架构决策的部分。下面我将解释 SDK 究竟是什么、代码长什么样,以及如果你在生产环境运行 Spring Boot 服务,它该如何与 Spring AI 和 LangChain4j 并列。

坦白说:我尚未在生产环境中部署 Copilot SDK。我在自己的小型 AI 智能体基础设施上使用 Spring Boot,以下所有内容均来自 GitHub 的官方文档、SDK README 以及 Burns 的工程文章。请将其视为一份基于真实代码的扎实评估,而非踩坑故事。 SDK 究竟是什么

它不是模型 API 客户端。大多数 Java AI 库只是对供应商 HTTP 端点的一个薄包装:发送消息,获取补全。Copilot SDK 所暴露的东西要大得多。根据仓库 README 所述,它内嵌了“Copilot CLI 背后的同一套引擎:一套经过生产检验、可通过编程方式调用的智能体运行时”。你的代码定义智能体行为和工具;运行时负责规划、工具调用、模型循环,甚至文件编辑。

它使用地道的 Java,而非移植过来的 DSL。API 表层包括 CompletableFuture、注解、lambda 表达式以及虚拟线程(virtual threads)。Burns 的概述突出了五项能力:Java 原生 API、三种工具定义风格(注解、lambda、JSON Schema)、分节级别的系统消息定制、通过 sendAndWait(...) 的一行式智能体循环,以及通过 session.on(...) 的实时事件流。

它是真正与框架无关的(framework-agnostic)。Burns 文章中的示例应用运行于 Jakarta EE 11 之上,搭配 Open Liberty 26,使用 CDI、JPA 和 WebSocket。Spring 集成点被刻意设计得很底层:你向 SDK 提供一个 Executor,它就在你的线程上运行其智能体工作。无需安装 Spring Boot starter,也没有框架插件。同一套库可用于 Jakarta EE、Spring、Quarkus,或一个普通的 main 方法。

它是一个真实的、有版本号的产品。SDK 家族(Python、TypeScript、Go、.NET、Java、Rust)已正式发布(generally available)并遵循语义版本控制(semantic versioning)。截至本文撰写时,Java 工件为 com.github:copilot-sdk-java,版本号为 1.0.12-preview.0,仓库 star 数已超过 10,000。 关于先决条件的坦诚说明

在你兴奋之前,请了解 SDK 的假设。

最低 Java 17,推荐 JDK 25。该 jar 是一个多版本 JAR(multi-release JAR),基于 JDK 25 编译,maven.compiler.release 设为 17。在 JDK 25 或更高版本上运行时,SDK 会自动使用虚拟线程作为其默认内部执行器。在 Java 17 上它仍可工作,只是无法获得虚拟线程默认值。

必须安装 Copilot CLI。Java SDK(与 Go 和 Rust 绑定一样)并不将运行时打包为依赖。你需要在 PATH 上准备好 Copilot CLI 1.0.55-5 或更高版本,或者配置一个自定义的 cliPath。SDK 家族中的每个 SDK 都通过 JSON-RPC 与 CLI 通信,并由客户端管理进程生命周期。这是容器镜像中最容易“咬到”你的部署细节:你的 Dockerfile 必须包含 CLI。

存在一个实验性的“逃生舱”。如果将基于 Node 的 CLI 与 JVM 一起发布让你感到不适,那么有一个实验性的进程内模式(in-process mode)可将 Copilot 运行时作为本地库运行,而不是派生(spawn)一个 CLI 进程。它目前仅限于 linux-x64,并且需要额外的 copilot-sdk-java-runtime 依赖以及 JNA。对于精简容器来说很有意思,但还不能押注于其上以承载生产服务。 约 30 行的第一个智能体

下面是从 Java SDK README 中截取的、经过验证的 Quick Start,略有精简:

这段代码中有三处值得注意,因为它们与 Spring AI 和 LangChain4j 提供给你的有所不同。

sendAndWait 就是完整的智能体循环。一次调用。运行时执行模型调用、决定是否调用工具、执行它们,并循环直到得到最终答案。在 Spring AI 中,你需要自己从 ChatClient、tool callbacks 和 advisor chains 中组合这一切。这里的循环属于运行时的工作,这究竟是减负还是失控,取决于你的脾气。

Token 计量是内建事件,而非附加项。SessionUsageInfoEvent 会在会话运行过程中实时推送当前 token 数、token 限制以及消息计数。任何曾被供应商账单震惊过的人都会欣赏这一点——成本可观测性是一类原生事件,而不是你要用拦截器去外挂的东西。

权限是显式的。PermissionHandler.APPROVE_ALL 是演示设置。真正的 API 允许你编写一个处理器,检查每个权限请求并以编程方式做出决定,或者路由给人工审批。对于一个可以触碰你的文件系统的服务端智能体来说,这就是演示版与安全团队签字放行版本之间的差别。 工具定义:你将真正编写的部分

工具是你的领域逻辑与智能体交汇的地方,SDK 提供三种风格。注解风格是企业的 Java 团队会立即认出的那种:

请注意 ToolInvocation 参数。它作为运行时上下文注入,永远不会出现在模型所见到的工具 schema 中,因此你可以在处理器中免费获得会话身份和工具调用 ID。它可以放在 schema 可见参数之前、中间或之后。

如果希望在会话构造时快速定义内联工具,可以使用 lambda 风格:

带默认值、可选参数、通过 fromAsync 的异步处理器,以及用于完全控制的第三种 JSON Schema 风格,共同构成了完整的工具箱。在生产中,那些流畅的修饰符意义重大:对只读搜索工具设置 .skipPermission(true) 是合理的,而对任何写入操作保留权限则是理智的默认做法。 BYOK:改变决策的那个细节

下面这句话直接引自 Burns 的文章,因为其范围至关重要:“尽管它名为 GitHub Copilot SDK,但你可以通过传入带有自己 baseUrl + apiKey(或 bearer token)的 provider/ProviderConfig,将其与任何直接模型提供商一起使用,例如 OpenAI、Azure、Anthropic 或 OpenAI 兼容端点。无需 Copilot 订阅。”

从采购视角再读一遍。GitHub 在多年 Copilot CLI 使用中打磨出来的智能体运行时——包括编排、工具循环和权限模型——变成了一个可移植的“挂具”,你可以将它指向贵公司已签订合同的任何提供商。如果你的组织标准化使用 Azure OpenAI,你不需要为每个服务采购 Copilot 席位来使用这个 SDK。

它存在一些限制,在设计评审前值得了解。当前 SDK 中的 BYOK 仅支持基于密钥的方式。尚不支持 Entra ID、托管标识(managed identities)或第三方身份提供商。那些安全姿态要求使用工作负载标识(workload identities)而非原始密钥的团队,要么等待该支持,要么改为通过 GitHub OAuth 进行身份验证。 在 Spring Boot 中运行

由于我的日常工作就是 Spring Boot 服务,这是我最为关心的角度,而模式很清晰。SDK 不想拥有你的线程模型。你向它提供一个 Executor,它向你返回 CompletableFutures。

在 Boot 服务中合理的部署形态:

一个客户端,多个会话。将单个 CopilotClient 实例化为单例 bean,在启动时调用一次 start(),然后为每个用户请求或对话创建一个会话。会话很轻量;客户端才持有与运行时之间那条昂贵的 JSON-RPC 连接。

为智能体工作使用虚拟线程。在 JDK 25 上,SDK 的内部执行器默认已使用虚拟线程。在一个 Boot 4 服务中,你还可以传入你自己的执行器,使智能体工作远离处理 HTTP 流量的平台线程。每次 sendAndWait 调用阻塞的是一个虚拟线程,而不是一个 Tomcat worker。

内存按会话划分且显式。SDK 通过 SessionConfig 上的 MemoryConfiguration 支持持久化智能体内存(persistent agent memory),使智能体能够在多轮之间携带上下文。它是按会话可选启用的,包括 resumeSession,这意味着你可以针对每个用例决定智能体是否记住任何东西。对于无状态的请求/响应端点,请关闭它;对于支持助理,请开启它并加以约束。

容器的坑点。除非你使用实验性的进程内模式,否则你的镜像需要在 PATH 上有 Copilot CLI 二进制文件。在多阶段 Docker 构建中用一个最小阶段来安装 CLI,可以让最终镜像保持“诚实”。在演示之前,请将其纳入 CI 流水线的预算。 与 Spring AI 和 LangChain4j 的对比

我不断被问到各种版本的“这个会不会取代 Spring AI”,下面是一个诚实的定位。

Spring AI 2.0 仍然是你们全力投入 Spring Boot 时的合理默认选择。它的注解驱动工具模型、advisor chains、MCP 支持以及 Spring Boot 自动配置,在 Spring 生态内对开发者速度而言无可匹敌。你唯一放弃的是“离开”的能力。

LangChain4j 仍然是你们不在 Spring 上、又希望获得最广泛的提供商和向量存储覆盖时的合理默认选择——20 多个模型和 20 多个存储,并具备 Quarkus 和 Micronaut 集成。

Copilot SDK for Java 占据了一个不同的位置:当你想要一套完整的、经过生产检验的智能体运行时,而非一个用于自行组装的框架时,它就是你的选择。你将获得循环、权限模型、内存、token 遥测以及 BYOK 提供商中立性,且完全不与框架耦合。代价是运行时连同 Copilot CLI 进程模型一同交付,版本仍处于 1.0.x-preview 区间,且围绕它的生态(示例、社区答案、踩过的坑)相比另外两者仍属年轻。

2026 年一个合理的架构是:在 Boot 服务内部使用 Spring AI 处理面向模型的功能,并在需要一个完整的自主智能体挂具——同时非 Spring 团队也能消费——时使用 Copilot SDK。它们并不互斥。 采用前的预飞检查清单

如果你本月要评估该 SDK,下面这份清单是我会跑的,请保存到你的下一份设计文档中: · 确认运行时方案。你的容器镜像能否随 Copilot CLI 1.0.55-5 或更高版本一同发布?如果不能,实验性的 linux-x64 进程内模式是否在你的风险承受范围内? · 有意识地选择认证模式。GitHub OAuth 适用于订阅 Copilot 的团队;BYOK 适用于提供商中立的部署。如果你需要托管标识,BYOK 现阶段还不能满足你。 · 编写一个真实的 PermissionHandler。APPROVE_ALL 仅用于演示。需针对每种工具类型决定哪些自动放行、哪些升级处理。 · 验证 JDK 情况。Java 17 可用,JDK 25 可获得虚拟线程默认值。如果你仍停留在 21,请在你的线程转储中确认执行器行为。 · 留意版本。当前是 1.0.12-preview.0,承诺遵循 semver,但请固定版本并在升级前阅读 changelog。实验性 API 默认通过 @CopilotExperimental 编译错误加以隔离,这是良好 API 卫生习惯的体现。 · 从第一天起就计量 token。在第一次演示之前——而不是第一次账单之后——将 SessionUsageInfoEvent 接入你的指标管道。 结论

Java AI 技术栈已快速完成整合

……(正文超出本站单页篇幅上限,此处截断;完整表述请见下方原文入口。)

译文由上游机器翻译生成,可能有误;判断请以英文原文为准。

英文原文(来源本站未改写)

Every Java team adding AI to a backend right now faces the same fork in the road. If you are on Spring Boot, you reach for Spring AI. If you are not, you reach for LangChain4j. Both are good libraries. But both also come with a commitment: you adopt their abstractions, their release cadence, and their opinion of what an agent loop looks like. And if you are on Jakarta EE, Micronaut, or Quarkus, the Spring path is simply closed to you.

On August 10, 2026, GitHub quietly published a third option. Edward Burns, the principal engineer who led the Java binding and was the release coordinator for Jakarta EE 11, walked through the Copilot SDK for Java in an engineering post on the GitHub blog. The short version: the same agent runtime that powers Copilot CLI is now a Maven dependency you can embed in any server-side Java application, Spring or not, IDE or not. And with its BYOK mode, it runs against OpenAI, Anthropic, Azure, or any OpenAI-compatible endpoint with your own API key, no Copilot subscription required.

That last sentence is the part that matters for architecture decisions. Let me explain what the SDK actually is, what the code looks like, and where it fits next to Spring AI and LangChain4j if you run Spring Boot services in production.

Full disclosure: I have not shipped the Copilot SDK in production yet. I run my own small AI agent infrastructure on Spring Boot, and everything below comes from GitHub's official documentation, the SDK README, and Burns's engineering post. Treat this as a grounded evaluation with real code, not a war story. What the SDK Actually Is

It is not a model API client. Most Java AI libraries give you a thin wrapper over a provider's HTTP endpoint: send messages, get a completion. The Copilot SDK exposes something bigger. Per the repository README, it embeds "the same engine behind Copilot CLI: a production-tested agent runtime you can invoke programmatically." Your code defines agent behavior and tools; the runtime handles planning, tool invocation, the model loop, and even file edits.

It speaks idiomatic Java, not a ported DSL. The API surface is CompletableFuture, annotations, lambdas, and virtual threads. Burns's summary highlights five capabilities: a Java-native API, three tool-definition styles (annotations, lambdas, JSON Schema), section-level system message customization, a one-line agentic loop via sendAndWait(...), and real-time event streaming via session.on(...).

It is genuinely framework-agnostic. The sample application in Burns's post runs on Jakarta EE 11 with Open Liberty 26, using CDI, JPA, and WebSocket. The Spring integration point is deliberately low-level: you hand the SDK an Executor, and it runs its agent work on your threads. There is no Spring Boot starter to install and no framework plugin. The same library works on Jakarta EE, Spring, Quarkus, or a plain main method.

It is a real, versioned product. The SDK family (Python, TypeScript, Go, .NET, Java, Rust) is generally available and follows semantic versioning. The Java artifact is com.github:copilot-sdk-java, at version 1.0.12-preview.0 at the time of writing, and the repo sits at over 10,000 stars. The Prerequisites, Honestly Stated

Before you get excited, know what the SDK assumes.

Java 17 minimum, JDK 25 recommended. The jar is a multi-release JAR compiled on JDK 25 with maven.compiler.release set to 17. Run it on JDK 25 or later and the SDK automatically uses virtual threads for its default internal executor. On Java 17 it still works, you just do not get the virtual thread default.

The Copilot CLI must be installed. The Java SDK (like the Go and Rust bindings) does not bundle the runtime as a dependency. You need Copilot CLI version 1.0.55-5 or later on your PATH, or you configure a custom cliPath. Every SDK in the family talks to the CLI over JSON-RPC, and the client manages the process lifecycle. This is the deployment detail most likely to bite you in a container image: your Dockerfile needs the CLI present.

There is an experimental escape hatch. If shipping a Node-based CLI alongside your JVM feels wrong, an experimental in-process mode runs the Copilot runtime as a native library instead of spawning a CLI process. It is currently limited to linux-x64 and requires an extra copilot-sdk-java-runtime dependency plus JNA. Interesting for lean containers, not something to bet a production service on yet. Your First Agent in About 30 Lines

Here is the verified Quick Start from the Java SDK README, lightly trimmed:

Three things in this snippet deserve attention, because they differ from what Spring AI and LangChain4j hand you.

sendAndWait is the whole agentic loop. One call. The runtime does the model call, decides whether to invoke tools, executes them, and loops until it has a final answer. In Spring AI you assemble this yourself from ChatClient, tool callbacks, and advisor chains. Here the loop is the runtime's job, which is either a relief or a loss of control depending on your temperament.

Token accounting is a built-in event, not an add-on. SessionUsageInfoEvent streams current tokens, the token limit, and message count as the session runs. Anyone who has been surprised by a provider invoice will appreciate that cost observability is a first-class event rather than something you bolt on with an interceptor.

Permissions are explicit. PermissionHandler.APPROVE_ALL is the demo setting. The real API lets you write a handler that inspects each permission request and decides programmatically, or routes to a human. For a server-side agent that can touch your filesystem, this is the difference between a demo and something your security team signs off on. Defining Tools: The Part You Will Actually Write

Tools are where your domain logic meets the agent, and the SDK offers three styles. The annotation style is the one enterprise Java teams will recognize instantly:

Note the ToolInvocation parameter. It is injected as runtime context and never appears in the tool schema the model sees, so you get session identity and tool call IDs inside your handler for free. It can sit before, between, or after the schema-visible parameters.

For quick inline tools at session construction, there is a lambda style:

Optional parameters with defaults, async handlers via fromAsync, and a third JSON Schema style for full control round out the toolkit. The fluent modifiers matter in production: .skipPermission(true) on a read-only search tool is reasonable, while leaving permissions on for anything that writes is the sane default. BYOK: The Detail That Changes the Decision

Here is the claim from Burns's post, quoted directly because the scope matters: "Even though it's called GitHub Copilot SDK, you can use it with any direct model provider, such as OpenAI, Azure, Anthropic, or OpenAI-compatible endpoints, by passing a provider/ProviderConfig with your own baseUrl + apiKey (or bearer token). No Copilot subscription required."

Read that again from a procurement perspective. The agent runtime GitHub has hardened over years of Copilot CLI usage, the orchestration, the tool loop, the permission model, becomes a portable harness you can point at whichever provider your company already has a contract with. If your organization standardized on Azure OpenAI, you do not need a Copilot seat per service to use this.

There are limits, and they are worth knowing before a design review. BYOK in the current SDK is key-based only. There is no support yet for Entra ID, managed identities, or third-party identity providers. Teams whose security posture requires workload identities rather than raw keys will either wait for that support or authenticate through GitHub OAuth instead. Running It Inside Spring Boot

Since my day job is Spring Boot services, this is the angle I care about most, and the pattern is clean. The SDK does not want to own your threading model. You hand it an Executor and it hands back CompletableFutures.

The deployment shape that makes sense in a Boot service:

One client, many sessions. Instantiate a single CopilotClient as a singleton bean, call start() once at startup, and create a session per user request or conversation. Sessions are cheap; the client owns the expensive JSON-RPC connection to the runtime.

Virtual threads for agent work. On JDK 25, the SDK's internal executor already uses virtual threads by default. In a Boot 4 service you can additionally pass your own executor so agent work stays off the platform threads serving HTTP traffic. Each sendAndWait call blocks a virtual thread, not a Tomcat worker.

Memory is per-session and explicit. The SDK supports persistent agent memory via MemoryConfiguration on SessionConfig, so an agent can carry context across turns. It is opt-in per session, including on resumeSession, which means you decide per use case whether the agent remembers anything. For stateless request/response endpoints, leave it off. For a support assistant, turn it on and bound it.

The container gotcha. Your image needs the Copilot CLI binary on PATH unless you use the experimental in-process mode. A minimal stage in a multi-stage Docker build that installs the CLI keeps the final image honest. Budget for this in your CI pipeline before you demo. How It Stacks Up Against Spring AI and LangChain4j

I keep getting asked some version of "does this replace Spring AI," so here is the honest positioning.

Spring AI 2.0 remains the right default if you are all-in on Spring Boot. Its annotation-driven tool model, advisor chains, MCP support, and Spring Boot auto-configuration are unmatched for developer velocity inside the Spring ecosystem. You give up nothing except the ability to leave.

LangChain4j remains the right default if you are not on Spring and want the broadest provider and vector store coverage, 20-plus models and 20-plus stores, with Quarkus and Micronaut integrations.

The Copilot SDK for Java occupies a different slot: it is the option when you want a complete, production-tested agent runtime rather than a framework for assembling your own. You get the loop, the permission model, the memory, the token telemetry, and BYOK provider neutrality, with no framework coupling at all. The trade is that the runtime ships the Copilot CLI process model with it, the version is still in 1.0.x-preview territory, and the ecosystem around it (examples, community answers, battle scars) is young compared to the other two.

A reasonable 2026 architecture: Spring AI for model-facing features inside your Boot services, and the Copilot SDK where you need a full autonomous agent harness that non-Spring teams can also consume. They are not mutually exclusive. A Pre-Flight Checklist Before You Adopt

If you evaluate this SDK this month, here is the checklist I would run, save it for your next design doc: · Confirm the runtime story.Can your container images ship Copilot CLI 1.0.55-5 or later?If not, is experimental linux-x64 in-process mode acceptable for your risk tolerance?· Pick your auth mode deliberately.GitHub OAuth for Copilot-subscribed teams, BYOK for provider-neutral deployments.If you need managed identities, BYOK is not ready for you yet. · Write a real PermissionHandler.APPROVE_ALL is for demos.Decide per tool kind what auto-approves and what escalates. · Verify the JDK story.Java 17 works, JDK 25 gets you virtual thread defaults.

If you are still on 21, confirm the executor behavior in your thread dumps. · Watch the version. 1.0.12-preview.0 today, semver discipline promised, but pin the version and read the changelog before upgrading.Experimental APIs are gated behind @CopilotExperimental compile errors by default, which is a good sign of API hygiene. · Measure tokens from day one.Wire SessionUsageInfoEvent into your metrics pipeline before the first demo, not after the first invoice.The Takeaway

The Java AI stack consolidated fas

... (truncated at the site's per-page length limit; see the source link below for the full text.)

出处https://dev.to/jamilxt/githubs-copilot-sdk-for-java-run-ai-agents-in-spring-boot-without-spring-ai-or-langchain4j-4mij抓取日期 · 采集源 DEV Community

03 / EVIDENCE GAPS

这条还缺什么证据?

下面每条都由本条已有字段推出(等级、理由、商业模式、来源次数、是否演示), 本站不生成推测性结论;通用验证方法放在方法论页。

  • 可核验的收入或付费证据查官网定价页与付费口径;第三方数据源(如 GetLatka)只作旁证,需标注来源与时点。
  • 商业模式未定确认按席位/按用量/授权还是开源托管版收费;开源项目另查 LICENSE 与是否存在付费版。
  • 只有单一来源找一手站点或其他渠道是否重复出现同一产品;社区热帖数量不等于商业进展。

通用验证清单(谁有这个问题/谁愿意付费/一个人能交付哪一小步)见我们的筛选方法。

04 / SIGNAL HISTORY

发现时间线