Real-time AI assistant with tool calling, streaming text budgets, and response caching — powered by Google ADK and Atmosphere's streaming pipeline.
Ported from the official adk-java/tutorials/city-time-weather, augmented with Atmosphere AI features.
The ADK agent has two tools registered via FunctionTool:
| Tool | Description |
|---|---|
getCurrentTime |
Returns the current time in a specific city |
getWeather |
Returns a weather report for a city |
Atmosphere AI features active:
- Streaming Text Budget Manager — tracks per-user streaming text usage with 10,000 streaming text budget; degrades to
gemini-2.0-flash-liteat 80% usage - Response Caching — completed AI responses are cached for client reconnection replay
- Cost Metering — streaming text counts per session are tracked and logged
# Demo mode (no API key needed — uses simulated ADK events)
cd samples/spring-boot-adk-tools
../../mvnw spring-boot:run
# With real Gemini API
GEMINI_API_KEY=your-key ../../mvnw spring-boot:runOpen http://localhost:8087 in your browser.
What time is it in London?— triggers thegetCurrentTimetoolWhat's the weather in Tokyo?— triggers thegetWeathertoolTell me about streaming text budgets— explains the budget systemHow does caching work?— explains response caching
| File | Purpose |
|---|---|
AdkToolsChat.java |
@AiEndpoint with ADK event bridging |
DemoEventProducer.java |
Simulated ADK event stream with tool calls |
AiConfig.java |
Configures streaming text budgets, cache inspector, cost filter |
Browser ──WebSocket──▶ Atmosphere ──▶ ADK Agent (LlmAgent)
│ │
│ ┌────┴────────┐
│ │ FunctionTool │
│ │ getCurrentTime│
│ │ getWeather │
│ └──────────────┘
│
┌──────┴──────────┐
│ Cost Metering │
│ Streaming Text Budget │
│ Response Cache │
└──────┬──────────┘
│
◀─────┘ streamed ADK events