What's New in 4.0
What’s New in 4.0
Section titled “What’s New in 4.0”AI / LLM Platform
Section titled “AI / LLM Platform”@AiEndpoint+ pluggableAiSupportSPI — auto-detects Spring AI, LangChain4j, Google ADK, or Embabel from the classpath. Conversation memory, RAG interceptors, cost/latency routing, and fan-out streaming are built in.@AiToolframework-agnostic tool calling — declare tools once with@AiTool/@Param, portable across all AI backends via automatic bridge adapters (SpringAiToolBridge,LangChain4jToolBridge,AdkToolBridge).- Per-endpoint model override —
@AiEndpoint(model = "gpt-4o")selects a model per endpoint without changing global config. - Multi-backend routing —
@AiEndpoint(fallbackStrategy = FAILOVER)wiresDefaultModelRouterfor failover, round-robin, or content-based routing across multiple AI backends. - AiMetrics SPI —
MetricsCapturingSessionrecords first-streaming-text latency, streaming text usage, and errors via a pluggableAiMetricsinterface (ServiceLoader-discovered). - Auto-detect ConversationPersistence —
conversationMemory = truediscovers Redis or SQLite backends via ServiceLoader; falls back to in-memory. - Broadcast filter auto-registration —
@AiEndpoint(filters = {CostMeteringFilter.class})wires filters without manual Broadcaster config. - Cache replay coalescing — reconnecting clients receive coalesced missed streaming texts in a single batch.
- Streaming text budget management —
StreamingTextBudgetManagerenforces per-session and per-endpoint streaming text limits. - Cost metering UI — per-message cost badges in the chat frontend via
StreamingSessionrequest attribute.
MCP (Model Context Protocol)
Section titled “MCP (Model Context Protocol)”- MCP server — expose tools, resources, and prompt templates to AI agents with
@McpServer/@McpToolannotations over Streamable HTTP, WebSocket, or SSE. - OpenTelemetry tracing —
McpTracingauto-instruments tool/resource/prompt calls with span propagation.
Core Transport
Section titled “Core Transport”- gRPC transport — bidirectional streaming alongside WebSocket/SSE/Long-Polling on the same Broadcaster.
- Virtual threads — enabled by default on JDK 21+.
ReentrantLockreplacessynchronizedto avoid pinning. - Rooms & presence —
RoomManagerwith join/leave, presence events, message history, and AI virtual members.
Cloud & Persistence
Section titled “Cloud & Persistence”- Clustering — Redis and Kafka broadcasters for multi-node deployments.
- Durable sessions — survive restarts with InMemory, SQLite, or Redis-backed session stores.
Integrations
Section titled “Integrations”- Spring Boot 4.0 / Quarkus 3.21 — first-class starters with auto-configuration, native image support, and observability (Micrometer + OpenTelemetry).
- Kotlin DSL — builder API and coroutine extensions for idiomatic Kotlin usage.
Client Libraries
Section titled “Client Libraries”- atmosphere.js 5.0 — TypeScript client with React, Vue, and Svelte hooks for chat, rooms, presence, and AI streaming.
- React Native / Expo —
useAtmosphereReact Native hook with EventSource polyfill, NetInfo injection, and markdown rendering for mobile AI chat. See the expo-client sample. - wAsync 4.0 — Java client rewritten on
java.net.httpwith gRPC support.
Samples — Forked & Augmented
Section titled “Samples — Forked & Augmented”Four official AI framework samples have been forked and augmented with Atmosphere’s real-time streaming, tool calling, cost metering, and content safety:
| Sample | Forked from | Atmosphere features added |
|---|---|---|
| spring-boot-langchain4j-tools | langchain4j-examples/spring-boot-example | Tool calling, PII redaction, cost metering |
| spring-boot-spring-ai-routing | spring-ai-examples/routing-workflow | Prompt routing, content safety, cost metering |
| spring-boot-embabel-horoscope | embabel-agent-examples/horoscope | Step progress streaming, content safety |
| spring-boot-adk-tools | adk-java/city-time-weather | Tool calling, streaming text budgets, response caching |
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.