You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/tutorial/10-ai-tools.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -503,7 +503,7 @@ The canonical tool-calling sample is:
503
503
504
504
-**[`samples/spring-boot-ai-tools/`](https://github.com/Atmosphere/atmosphere/tree/main/samples/spring-boot-ai-tools)** — uses the built-in LLM client with `@AiTool` methods (`AssistantTools`), conversation memory, and the `CostMeteringInterceptor`. Run with: `./mvnw spring-boot:run -pl samples/spring-boot-ai-tools`
505
505
506
-
Because `@AiTool` definitions are framework-agnostic, the same `AssistantTools` class works with any of the six runtimes (built-in, Spring AI, LangChain4j, ADK, Embabel, Koog) by swapping the adapter dependency.
506
+
Because `@AiTool` definitions are framework-agnostic, the same `AssistantTools` class works with any of the seven runtimes (built-in, Spring AI, LangChain4j, ADK, Embabel, Koog, Semantic Kernel) by swapping the adapter dependency.
// Your provider's per-model input/output dollar-per-token rates.
349
+
return (usage, model) ->switch (model) {
350
+
case"gpt-4o"-> usage.inputTokens() *0.0000025
351
+
+ usage.outputTokens() *0.00001;
352
+
default->0.0;
353
+
};
354
+
}
355
+
```
356
+
357
+
Spring Boot auto-wires the `CostAccountingSession` decorator when
358
+
both beans are present: every `@Prompt` session's `TokenUsage` event
359
+
flows into `addCost(tenantId, dollars)` keyed by the same
360
+
`business.tenant.id` MDC tag the drift guardrail uses. Reset
361
+
counters on a monthly boundary via `resetTenant(...)` /
362
+
`resetAll()`.
363
+
364
+
Request-side blocks surface on the session as a `SecurityException`
365
+
with the reason string `cost ceiling reached for tenant X (spent Y
366
+
of budget Z)`, so the client sees a terminal error envelope rather
367
+
than an infinite hang.
368
+
369
+
### Together
370
+
371
+
Register all three in a production deployment — PII for compliance
372
+
(blocks the leak), drift for incident detection (flags a model
373
+
behaving badly), cost ceiling for spend enforcement (halts a runaway
374
+
tenant before the next invoice). None is on by default: the
375
+
framework's position is that a guardrail that fires unexpectedly is
376
+
worse than no guardrail at all, so you opt in explicitly.
377
+
248
378
## Model routing
249
379
250
380
The `ModelRouter` interface (in `org.atmosphere.ai`) mirrors Atmosphere's transport failover pattern (WebSocket -> SSE -> long-polling) applied to the AI layer (GPT-4 -> Claude -> Gemini).
Copy file name to clipboardExpand all lines: docs/src/content/docs/tutorial/14-spring-boot.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,27 @@ Spring Boot's embedded containers do not process `@HandlesTypes` from `ServletCo
48
48
49
49
The starter also performs a second pass to discover custom annotation types registered via `@AtmosphereAnnotation` processors (e.g., the AI module's `@AiEndpoint` processor), and re-scans user packages for classes annotated with those custom annotations.
50
50
51
+
### Admin control plane
52
+
53
+
When `atmosphere-admin` is on the classpath, the starter also registers
54
+
`AtmosphereAdminEndpoint` under `/api/admin/*` (read endpoints open by
55
+
default, write endpoints triple-gated: feature flag → Principal →
56
+
`ControlAuthorizer`), plus `AtmosphereFaviconAutoConfiguration` which
57
+
serves `/favicon.ico` and `/favicon.png` with the framework logo so
58
+
browsers stop logging a 404 on the admin dashboard and every sample.
59
+
60
+
Two opt-in flags you'll want to know about:
61
+
62
+
| Property | Default | Effect |
63
+
|----------|---------|--------|
64
+
|`atmosphere.admin.http-write-enabled`|`false`| Enables `POST` / `DELETE` on `/api/admin/*`; still requires a Principal + `ControlAuthorizer` grant. |
65
+
|`atmosphere.admin.http-read-auth-required`|`false`| Requires the same principal chain (minus `ControlAuthorizer`) for `GET` / `HEAD` / `OPTIONS`. Flip for multi-tenant deployments exposing `/api/admin/*` on a routable network. |
66
+
|`atmosphere.favicon.enabled`|`true`| Set to `false` if the application ships its own `/favicon.ico`. |
67
+
68
+
See [Chapter 29 — Agent-to-Agent Flow Viewer](./29-admin-flow-viewer/)
69
+
and [`modules/admin/README.md`](https://github.com/Atmosphere/atmosphere/blob/main/modules/admin/README.md)
70
+
for the full admin surface and principal-chain wiring.
71
+
51
72
## Application class
52
73
53
74
The application class is a standard Spring Boot entry point:
Copy file name to clipboardExpand all lines: docs/src/content/docs/tutorial/17-durable-sessions.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -234,6 +234,35 @@ Two implementations are provided:
234
234
235
235
These share the same backend connections as the corresponding `SessionStore` implementations. The `PersistentConversationMemory` class handles serialization and sliding-window logic on top of the persistence SPI.
236
236
237
+
## Companion: mid-stream reattach for `@Prompt` runs
238
+
239
+
Durable sessions restore room + broadcaster memberships after a
240
+
disconnect — the client sees the same presence and subscriptions it
241
+
had before. But an `@Prompt` that was *actively streaming* when the
242
+
client dropped needs a parallel mechanism: the buffered events the
243
+
client didn't finish receiving.
244
+
245
+
That's what `RunRegistry` + `X-Atmosphere-Run-Id` do. On every
246
+
`@Prompt` dispatch `AiEndpointHandler` registers a run with an
0 commit comments