java-quarkus¶
Quarkus 3.40 on Java 25: the copilot-quarkus extension turns an @CopilotAgent interface into a CDI bean that talks to the Copilot CLI sidecar of the Pod, and Brewlet runs the fast-jar on the plain, framework-agnostic java-25 runtime.
What is in the artifact¶
| Layer | Mapped to | Content | Compressed |
|---|---|---|---|
deps |
/app/lib |
boot/ and main/: Quarkus, Vert.x, Jackson, the Copilot SDK and the extension (27 MiB unpacked) |
23.3 MiB |
code |
/app |
app/concierge.jar (20 KiB), quarkus/ (generated bytecode), quarkus-run.jar, quarkus-app-dependencies.txt |
558 KiB |
Total 23.8 MiB. The Pod runs /usr/jdk/bin/java -XX:MaxRAMPercentage=70 -XX:+ExitOnOutOfMemoryError -jar /app/quarkus-run.jar (launch.json); the JDK comes from the runtime image, never from /app. Deliberately not in the artifact: a JDK, the Copilot CLI (that is the sidecar) and brotli4j's native library. The only file over 3 MiB is the Copilot SDK jar (8 MiB).
How the integration is used¶
The agent is an interface, its system prompt a classpath resource (src/main/resources/prompts/concierge.md), and its only tool a CDI bean referenced by bean name:
@CopilotAgent(name = "concierge", instructionsResource = "classpath:/prompts/concierge.md", toolRefs = "runtimeFacts")
public interface ConciergeAgent {
CompletableFuture<String> ask(@ConversationId String conversationId, @UserMessage String question);
}
@ApplicationScoped @Named("runtimeFacts")
public class RuntimeFacts {
@CopilotTool(name = "runtime_facts", value = "Verified facts about the environment this agent runs in ...")
public String runtimeFacts(@CopilotToolParam("Which part to return: all, language, agent, copilot or deployment") String topic) { ... }
}
ConciergeResource (JAX-RS: Quarkus REST + Jackson) implements the contract. /healthz is @NonBlocking and never touches the sidecar; /readyz, /runtime and /ask block on the sidecar, so they run on virtual threads (@RunOnVirtualThread). The extension keeps one SDK session per @ConversationId: follow-up questions in the same conversation see the earlier ones. /runtime and the tool both answer from RuntimeFacts.describe(); the Quarkus version is read from META-INF/maven/io.quarkus/quarkus-core/pom.properties.
Configuration (application.properties; every value can be overridden by an environment variable):
quarkus.copilot.cli-url=${COPILOT_CLI_URL}
quarkus.copilot.tcp-connection-token=${COPILOT_CONNECTION_TOKEN}
quarkus.copilot.agents.concierge.available-tools=custom:*
quarkus.copilot.agents.concierge.response-timeout=2m
quarkus.copilot.agents.concierge.permissions.allow-agent-tools=true
quarkus.http.port=${PORT:8080}
quarkus.shutdown.timeout=15s
The first two have no defaults on purpose: the Pod must provide both or the process refuses to start.
Build notes¶
build.sh runs scripts/mvn.sh -f pom.xml clean package (Quarkus fast-jar, --release 25 like the runtime's JDK) and stages target/quarkus-app/lib as the deps layer and everything else as the code layer (layers: deps:/app/lib, then code:/app). quarkus-run.jar finds its libraries through a manifest Class-Path relative to itself, so nothing needs repackaging, and a code-only change rebuilds a 558 KiB layer.
All dependencies are plain Java, so the jars are the same for linux/arm64 and linux/amd64; brotli4j was the one exception (see Gotchas) and build.sh fails if a jar for the build host's OS ever reaches the artifact. The platform BOM, 3.40.1, is the Quarkus release the extension is built and tested against. The SDK's CopilotToolProcessor generates the @CopilotTool metadata and is named in maven-compiler-plugin, as the extension's README asks. A from-scratch make agent takes about 27 s end to end (Maven 7 s; the rest is publish, rollout and the smoke test). The build is reproducible: the same sources give the same bytes, so a rebuild yields the same artifact digest and a code-only change pushes only the 558 KiB code layer.
Run it¶
make agent AGENT=java-quarkus
make ask AGENT=java-quarkus Q="Which language runtime are you on and where is it installed?"
# You're on Java, version 25.0.5.1+2-LTS from Microsoft. It's installed at `/usr/jdk`.
kubectl -n agents port-forward deploy/java-quarkus 18101:8080 &
curl -s localhost:18101/ask -H 'content-type: application/json' -d '{"question":"Which JDK are you on?","conversationId":"demo"}'
Measured on the local kind cluster (arm64): startup 0.6 s (started in 0.622s). Agent working set: 98 MB idle, 134 MB after the first answer, 141 MB after 20 parallel conversations (cgroup peak 186 MiB, of which about 50 MiB is reclaimable page cache). Copilot CLI sidecar: 17 MB idle, 39 MB after the first answer, about 190 MB with 20 conversations (roughly 7 MB each). Resources in deployment.yaml: request 100m CPU and 160Mi, limit 320Mi (the heap may use 70% of it); the burst caused no OOM kill and no restart.
Gotchas¶
built-in-tools=falsedoes not lock the model down. It only deniesbuiltin:*: the Copilot CLI's own GitHub MCP tools (github-mcp-server-*, which can read the user's repositories with the sidecar's token) andweb_searchstay listed and callable (observed live with the Java agents). Use an allow-list over every tool source instead,quarkus.copilot.agents.concierge.available-tools=custom:*; the extension refuses to combine it withbuilt-in-tools=falseorexcluded-tools, so those are not set. Verified live:make ask AGENT=java-quarkus Q="List the exact names of every tool you are able to call right now, one per line. Do not call any of them. Do not explain."prints onlyruntime_facts.cli-urlandtcp-connection-tokenareOptionalin the extension, so an unset variable would not fail at startup, only later as a failed connection.SidecarProbeinjects both as plainStrings with@ConfigProperty, which makes Quarkus fail fast whenCOPILOT_CLI_URLorCOPILOT_CONNECTION_TOKENis missing or empty. The token is never kept, logged or reported.- brotli4j picks a native jar by the build host.
quarkus-rest-jacksonpulls brotli4j, whose POM activatesnative-<os>-<arch>by the machine running Maven: a macOS build putbrotli4j-native-osx-aarch64into a Linux artifact. It is only needed forquarkus.http.compressors=br, so the POM excludes it, andbuild.shrejects any*osx*,*macos*,*darwin*or*windows*file indeps. - Bodies that are not a JSON object. Quarkus REST answers malformed or wrongly typed JSON with a 400 and an empty body. Two
@ServerExceptionMappermethods inConciergeResourceturn that into the contract's{"error":"bad_request",...}; a missing or wrongContent-Typestays Quarkus' own 415. - Timeouts.
/askwaits 2 minutes and then cancels the future, which makes the extension abort the turn still running in the sidecar. The extension's ownresponse-timeoutarrives as aTimeoutExceptioninside anExecutionException, so the cause chain is checked to answer504 timeoutinstead of502. - Virtual threads are not listed in Quarkus' "Installed features" (
[cdi, copilot, rest, rest-jackson, smallrye-context-propagation, vertx]), althoughquarkus-virtual-threadsis on the classpath; request threads are namedquarkus-virtual-thread-Nand/healthzruns on the event loop. - No SmallRye Health.
/q/healthis intentionally 404;/healthzand/readyzare ordinary resources, as the contract defines them. - Harmless noise. javac prints
Supported source version 'RELEASE_17' from annotation processor CopilotToolProcessor less than -source '25'. The Quarkus BOM overrides Jackson to 2.21.7, which the Copilot SDK 2.0.1 accepts. - Shutdown.
quarkus.shutdown.timeout=15sfits the Pod's 20 s grace period, and the Pod terminates in about 1.5 s. Against a sidecar that accepts the TCP connection but never answers (not what the Pod does), closing the SDK client waits for its 30 s connect timeout and shutdown takes about 24 s.
This page is rendered from agents/java-quarkus/README.md.