What's New in 4.0
What’s New in Atmosphere 4.0
Section titled “What’s New in Atmosphere 4.0”Atmosphere 4.0 is the JDK 21+ rewrite of the framework. The 4.0.0 release shipped the core platform migration (Jakarta EE 10, virtual threads, Jetty 12 / Tomcat 11, native image support, rooms, AI streaming SPI, MCP, TypeScript client). Since then the 4.0.x line has grown into a full multi-agent runtime — unified agent annotations, seven pluggable AI runtimes, orchestration primitives, WebTransport/HTTP3, React Native support, and major compatibility refreshes.
The latest build tracks Spring Boot 4.0.5 (Spring Framework 6.2.8), Quarkus 3.31.3, Jackson 3.1.1, and atmosphere.js 5.0.22, and requires JDK 21 as a minimum.
This page is a highlights reel. For the per-patch history, see the CHANGELOG.
AI, Agents & Orchestration
Section titled “AI, Agents & Orchestration”@Agent + @Command — one annotation, every channel
Section titled “@Agent + @Command — one annotation, every channel”@Agentis the single entry point that wires@AiEndpoint, commands, tools, skill files, conversation memory, and multi-protocol exposure (MCP, A2A, AG-UI) based on classpath detection. Conversation memory is on by default. See @Agent.@Commanddefines slash commands once and routes them across Web (WebSocket), Slack, Telegram, Discord, WhatsApp, and Messenger whenatmosphere-channelsis on the classpath. Confirmation flow for destructive actions and auto-generated/helpare included.skill.mdfiles act as both the LLM system prompt and agent metadata. Sections like## Skills,## Tools,## Channels, and## Guardrailsare parsed into A2A Agent Cards, MCP tool manifests, and channel validation. See Skills.atmosphere-agentis the module hosting the annotation processor,CommandRouter,SkillFileParser, andAgentHandler.
AgentRuntime SPI — the Servlet model for AI agents
Section titled “AgentRuntime SPI — the Servlet model for AI agents”AgentRuntimereplaces the earlierAiSupportSPI. It dispatches the entire agent loop — tool calling, memory, RAG, retries — to whichever AI framework is on the classpath. Write your@Agentonce, run it on any runtime. Switch runtimes by changing a single Maven dependency.- Seven runtimes share a unified capability baseline (tool calling,
structured output, progress events, usage metadata): Built-in,
LangChain4j, Spring AI, Google ADK, Embabel,
JetBrains Koog, and Microsoft Semantic Kernel. The built-in runtime
gained full OpenAI-compatible tool calling (max 5 rounds), so
@AiToolworks with zero framework dependencies. - Auto-detection via
ServiceLoader— the highest-priority()runtime that reportsisAvailable()wins. The AI Console subtitle and/api/console/inforeport the active runtime. - Usage metadata (
ai.tokens.input,ai.tokens.output,ai.tokens.total) is reported by every runtime that exposes it, and flows intoMicrometerAiMetrics. AiCapabilitynegotiation —@AiEndpoint(requires = {TOOL_CALLING})fails fast at startup if the active runtime can’t satisfy required capabilities.
Orchestration primitives for multi-agent systems
Section titled “Orchestration primitives for multi-agent systems”@Coordinator+@Fleet+@AgentRef— declarative multi-agent coordinators. Parallel fan-out, sequential pipelines, optional agents, weighted routing, and circular-dependency detection are built in. See @Coordinator.AgentFleetAPI — injected into@Promptmethods.fleet.parallel(...)fans out concurrently;fleet.pipeline(...)chains sequentially. Results are returned asAgentResultrecords with text, metadata, duration, and success status.- Local + Remote transport — coordinators transparently call local agents via
direct invocation or remote agents via A2A JSON-RPC. The
AgentProxyabstraction hides the transport layer. - Agent handoffs —
session.handoff("billing", message)transfers a conversation with its full history, with a cycle guard and anAiEvent.Handoffemitted for observability. - Approval gates —
@RequiresApprovalparks the virtual thread until a client approves or denies the action via the/__approval/protocol. - Conditional routing —
fleet.route(result, spec)uses first-match evaluation with journal recording. - Long-term memory —
LongTermMemoryInterceptorwith pluggable extraction strategies (on-session-close, per-message, periodic). - Eval assertions —
LlmJudgeexposesmeetsIntent(),isGroundedIn(), andhasQuality()for LLM-as-judge testing.
Streaming, tools, and events
Section titled “Streaming, tools, and events”AiEventsealed interface — 13 structured event types (TextDelta,ToolStart,ToolResult,AgentStep,EntityStart,StructuredField,Handoff, and more) delivered viaStreamingSession.emit(), powering rich real-time UIs.@AiToolframework-agnostic tool calling — declare tools once with@AiTool/@Param, portable across every backend via bridge adapters (SpringAiToolBridge,LangChain4jToolBridge,AdkToolBridge,AtmosphereToolBridgefor Koog).ToolRegistry.execute(name, args, session)auto-emitsToolStart/ToolResultthrough the streaming session.- Per-endpoint model override —
@AiEndpoint(model = "gpt-4o")selects a model per endpoint without touching global config. - Multi-backend routing —
@AiEndpoint(fallbackStrategy = FAILOVER)wiresDefaultModelRouterfor failover, round-robin, or content-based routing. - Auto-detected
ConversationPersistence—conversationMemory = truediscovers Redis or SQLite backends viaServiceLoader; falls back to in-memory. - Memory strategies — pluggable
MemoryStrategySPI withMessageWindowStrategy,TokenWindowStrategy, andSummarizingStrategy. StructuredOutputParserSPI — generate JSON Schema instructions from Java classes, parse LLM output into typed objects.JacksonStructuredOutputParserworks with any model.- Enhanced RAG —
ContextProvider.transformQuery()andrerank()enable query rewriting and result re-ranking without a custom pipeline;InMemoryContextProvidergives a zero-dependency provider for development. - First-class identity fields —
AiRequestcarriesuserId,sessionId,agentId, andconversationIdas explicit fields instead of an untypedhints()map. - AiMetrics SPI —
MetricsCapturingSessionrecords first-streaming-text latency, streaming text usage, and errors via a pluggable, ServiceLoader- discoveredAiMetricsinterface. - Cache replay coalescing — reconnecting clients receive coalesced missed streaming texts in a single batch.
- Streaming text budget management —
StreamingTextBudgetManagerenforces per-session and per-endpoint limits. - Cost metering UI — per-message cost badges in the chat frontend via
StreamingSessionrequest attributes. atmosphere-ai-test—AiTestClient,AiResponse, and fluentAiAssertionsfor testing AI endpoints in JUnit 5. See AI Testing.
Runtime & Transport
Section titled “Runtime & Transport”- WebTransport over HTTP/3 — Atmosphere now ships an HTTP/3 + WebTransport transport, sitting alongside WebSocket, SSE, long-polling, and gRPC on the same Broadcaster. See WebTransport Reference.
- gRPC transport — bidirectional streaming on the same Broadcaster as the classic transports.
- Virtual threads on by default —
ExecutorsFactoryusesExecutors.newVirtualThreadPerTaskExecutor(), andDefaultBroadcasterplus 16 other core classes migrated fromsynchronizedblocks toReentrantLockto avoid pinning. Opt out withApplicationConfig.USE_VIRTUAL_THREADS=false. - Rooms & presence —
RoomManagerwith join/leave, presence events, message history, AI virtual members, and a room protocol backed by sealed records (Join,Leave,Broadcast,Direct). RawMessageAPI — first-class public wrapper for pre-encoded messages that bypass@Messagedecoder/encoder pipelines, used by the room protocol to avoid JSON envelope mangling.ManagedAtmosphereHandler.Managedis deprecated in favor ofRawMessage.- Backpressure —
BackpressureInterceptorprotects against slow clients with a configurable high-water mark (default 1000 pending messages) anddrop-oldest,drop-newest, ordisconnectpolicies.
Cloud, Persistence & Observability
Section titled “Cloud, Persistence & Observability”- Clustering — Redis (Lettuce 6.x, non-blocking pub/sub) and Kafka broadcasters for multi-node deployments.
- Durable sessions — survive restarts with InMemory, SQLite, or Redis-backed
SessionStoreimplementations; room memberships and broadcaster subscriptions are restored on reconnection. - Micrometer metrics (
AtmosphereMetrics) — gauges, counters, and timers for active connections, broadcasters, broadcast latency, room-level gauges, cache hit/miss/eviction, and backpressure drop/disconnect. - OpenTelemetry tracing (
AtmosphereTracing) — per-request spans withatmosphere.resource.uuid,atmosphere.transport,atmosphere.action,atmosphere.broadcaster, andatmosphere.roomattributes. - Health check (
AtmosphereHealth) — framework-level snapshot exposed via the Spring Boot ActuatorAtmosphereHealthIndicator. - MDC interceptor — sets
atmosphere.uuid,atmosphere.transport, andatmosphere.broadcasterin the SLF4J MDC for structured logging.
Integrations
Section titled “Integrations”- Spring Boot 4.0.5 (Spring Framework 6.2.8) — auto-configuration, Actuator
health indicator (
AtmosphereHealthIndicator), and GraalVM AOT runtime hints (AtmosphereRuntimeHints). Spring Boot 4.0 is modularized, so the starter now depends explicitly onspring-boot-servlet,spring-boot-web-server, andspring-boot-healthwhere needed. The starter overrides the parent POM’s old SLF4J 1.x/Logback 1.2.x pins in<dependencies>so upgrades don’t regress. See Spring Boot Reference. - Quarkus 3.31.3 — build-time Jandex annotation scanning, Arc CDI
integration, custom
QuarkusJSR356AsyncSupport, and@BuildStep-driven native image registration viaquarkus.atmosphere.*properties. See Quarkus Reference. - Kotlin DSL —
atmosphere { ... }builder and coroutine extensions (broadcastSuspend,writeSuspend). Requires Kotlin 2.1+. atmosphere-channels— bridges@Agentto Slack, Telegram, Discord, WhatsApp, and Messenger with zero per-channel code.ChannelFilterchain for message processing, plus built-inMessageSplittingFilter(auto-truncates to channel max length) andAuditLoggingFilter.
MCP (Model Context Protocol)
Section titled “MCP (Model Context Protocol)”- MCP server — expose tools, resources, and prompt templates to AI agents
with
@McpTool/@McpResource/@McpPromptannotations on any class marked@Agent(there is no dedicated@McpServerannotation — the MCP module reuses@Agentfromatmosphere-agent). Supports Streamable HTTP (MCP 2025-03-26 spec), WebSocket, or SSE, with a stdio bridge for Claude Desktop and a programmaticMcpRegistryAPI. See MCP Reference. - OpenTelemetry tracing —
McpTracingauto-instruments tool, resource, and prompt calls with span propagation.
Client Libraries
Section titled “Client Libraries”- atmosphere.js 5.0.22 — TypeScript client with no runtime dependencies. ESM + CJS + IIFE bundles, WebSocket with configurable fallback to SSE, HTTP streaming, or long-polling. See atmosphere.js.
- React, Vue, Svelte hooks —
useAtmosphere,useRoom,usePresence,useStreamingviaatmosphere.js/react,/vue, and/svelte. Shared chat components viaatmosphere.js/chat. - React Native / Expo —
useAtmosphereReact Native hook with anEventSourcepolyfill, NetInfo injection, and markdown rendering for mobile AI chat. See React Native. - wAsync 4.0 — the Java client rewritten on
java.net.httpwith gRPC support. See Java Client.
Samples
Section titled “Samples”Atmosphere 4.0 ships with a wide set of runnable samples covering every
major feature area — real-time chat, AI streaming with multiple providers,
tool calling, multi-agent orchestration, MCP, RAG, clustering, durable
sessions, and channel integrations. The full catalogue lives at
samples/ on GitHub.
Highlights:
| Sample | Feature area |
|---|---|
spring-boot-ai-chat | Streaming AI chat via the AgentRuntime SPI (auto-selects provider) |
spring-boot-ai-tools | Portable @AiTool tool calling across all runtimes |
spring-boot-ai-classroom | Multi-room AI with a React Native / Expo client |
spring-boot-rag-chat | Retrieval-augmented generation with ContextProvider |
spring-boot-mcp-server | MCP server exposing tools, resources, and prompts |
spring-boot-a2a-agent | A2A protocol agent-to-agent communication |
spring-boot-agui-chat | AG-UI protocol with progressive UI streaming |
spring-boot-dentist-agent | Dr. Molar emergency dental agent with Slack + Telegram channels |
spring-boot-multi-agent-startup-team | @Coordinator multi-agent workflow |
spring-boot-checkpoint-agent | Durable HITL workflow with CheckpointStore |
spring-boot-orchestration-demo | Support desk with live handoff and @RequiresApproval |
spring-boot-durable-sessions | Session persistence across restarts |
spring-boot-channels-chat | Multi-channel (Slack/Telegram/Discord) chat |
spring-boot-koog-chat | Koog runtime streaming chat |
spring-boot-semantic-kernel-chat | Microsoft Semantic Kernel runtime streaming chat |
spring-boot-otel-chat | OpenTelemetry tracing with Jaeger |
quarkus-chat | Quarkus extension chat |
grpc-chat | Standalone gRPC transport |
Developer Experience
Section titled “Developer Experience”- Architectural validation — CI gate detects NOOP/dead code, placeholder stubs, DI bypass, and fluent builder misuse via TOML-configured patterns.
atmosphere-generator— CLI scaffolding with--toolsflag to generate@AiToolmethods.- 24-chapter tutorial — the full tutorial book at Chapter 1: Introduction walks from “install the CLI” through AI, MCP, clustering, and multi-channel deployment.
Breaking Changes
Section titled “Breaking Changes”Heads up before you upgrade:
- Token → Streaming Text rename (4.0.11). Every AI API, javadoc entry, and
atmosphere.js client surface moved from “token” to “streaming text” to
describe LLM output chunks.
onToken→onStreamingText,totalTokens→totalStreamingTexts, and the wire protocol message type changed from"token"to"streaming-text". This is a breaking change for atmosphere.js consumers and customAiStreamBroadcastFilterimplementations. - Jackson 3.1.1 migration. The runtime now depends on Jackson 3.x, which
moved its packages from
com.fasterxml.jacksontotools.jackson. CustomJacksonEncoder/JacksonDecodersubclasses, any filters that constructObjectMapperdirectly, and any integration code importing fromcom.fasterxml.jackson.*need to be updated. AiSupport→AgentRuntime. Code that implemented the legacyAiSupportSPI should migrate toAgentRuntime. The capability baseline, tool calling, and usage metadata contracts are now unified across all seven runtimes.- WebSocket HTML sanitization (4.0.11). HTML sanitization was disabled for
the WebSocket transport because encoding JSON in WebSocket frames broke the
AI streaming wire protocol. HTTP transports continue to sanitize write
methods, and cookies over HTTPS now default to
Secure. - JDK 21 minimum. No Java 8/11/17, no
javax.servlet, no legacy app servers (GlassFish 3/4, Jetty 6-11, Tomcat 6-10, WebLogic, JBoss AS 7, or Netty/Play/Vert.x integrations). - atmosphere.js package rename. The npm package is
atmosphere.js(no jQuery dependency). Update imports toimport { atmosphere } from 'atmosphere.js'.