Cleared for Takeoff: Building an Agentic Air-Traffic Control App with Spring AI & Angular
An exploration playground for AG-UI and A2UI, testing what it takes to build an AI assistant that drives a live Angular + MapLibre app and renders native components inline.
Series Context: Part 01 of Spring Traffic Control
Audience: Full-Stack (Spring + Angular) · Reading Track: Starting point for all tracks
Next: Part 02: Airspace Boundaries
Companion Reference Guides: AG-UI · A2UI · MapLibre + Angular · Mise
Most AI tutorials stop at the same finish line: a text box, a streaming Markdown bubble, and maybe a weather tool call. That works fine for basic Q&A, but it falls short for real enterprise web applications. What happens when an AI assistant has to live inside a dense, interactive UI with live maps, filters, selection state, and a design system you have spent months building?
To explore that properly, I built Spring Traffic Control, a hands-on exploration playground modelled around aviation operations and air-traffic visualisation. To be clear up front, this is not a production air-traffic control system, so please do not route real aircraft with it! It is a realistic, data-rich sandbox built to put two emerging agentic UI protocols (AG-UI and A2UI) through their paces across a Spring Boot 4 / Spring AI 2 backend and an Angular 22 frontend, uncover the real trade-offs and gotchas, and distil production-worthy patterns you can take back to your day job.
Radio Silence in the Tower: Why Text-Only Chatbots Fail Operations UIs
Why build an aviation sandbox instead of another to-do list chatbot? Because operations dashboards immediately expose every shortcut that breaks in production.
Imagine an operator looking at a live radar scope and typing a completely natural request:
Show me KLM1298 on the map and the 3 closest airports.
Now picture what happens if your assistant is just a standard text-streaming chatbot:
- Walls of Markdown instead of spatial context: The model dumps latitude/longitude coordinates and a Markdown table of ICAO codes into a narrow side drawer. The operator still has to manually search the map, pan to the aircraft, and look up each airport one by one.
- Zero situational awareness: On the next turn, the operator clicks another aircraft on the map and asks, "What is the nearest diversion airport to this flight?" A stateless chatbot has no idea what "this flight" means.
- Brittle LLM-generated HTML: Some teams try to escape plain text by asking the LLM to output raw HTML or JSX cards. In practice, that introduces XSS risks, breaks WCAG AA accessibility, drifts away from your design system, and produces dead markup that cannot talk to your Angular router or state stores.
To bridge the gap between an LLM and a real web application without sacrificing type safety or security, Spring Traffic Control pairs two open protocols:
- AG-UI (Agent-User Interaction Protocol): A lightweight, event-driven SSE protocol that connects the Spring AI backend directly to the Angular frontend. It streams run lifecycle events, reasoning, live tool-call visibility, situational UI context, and validated frontend control commands over one stream.
- A2UI (Agent-to-UI): A declarative generative UI pattern carried inside that same stream. Instead of emitting raw HTML, the backend sends a whitelisted component name and structured JSON payload, and Angular dynamically mounts your existing native components safely inside the chat drawer.
Quick Protocol Map: Where MCP, AG-UI, and A2UI Fit Together
If you are already tracking MCP, it helps to see how the three protocols divide responsibilities without overlapping:
| Protocol | Connects | Responsibility |
|---|---|---|
| MCP | Agent ↔ Tools / Data | Gives an agent standardised access to external APIs, databases, and backend tools |
| AG-UI | Agent ↔ Frontend UI | Streams run lifecycle, text/reasoning, live tool calls, UI state, and frontend actions |
| A2UI | Agent → Native UI Components | Declares whitelisted native UI surfaces to render safely inside the conversation |
Live Radar Check: Spring Traffic Control in Action
Before diving into architecture diagrams, here is what a single prompt looks like in the running app. Asking about flight KLM1298 triggers backend tool lookups, streams live tool-call indicators, drives the MapLibre GL radar scope to focus on the aircraft, and mounts a native Angular flight card directly inside the assistant drawer:

One prompt, one SSE stream: live tool progress, a native Angular A2UI card, and real-time MapLibre camera control happening together.
What Happens Behind a Single Turn
Because AG-UI streams typed events as they happen instead of waiting for the final LLM token, the UI reacts while the model is still finishing its prose summary. Here is the end-to-end flow across the browser and Spring Boot:
In a single turn:
- Grounded request: Angular's
@ag-ui/clientposts aRunAgentInputpayload toPOST /api/agui, attaching a leanuiStatesnapshot (current route, map projection, selected flight, highlighted airports) and the frontendappVersion. - Live tool execution: Spring AI invokes
@Toolmethods on the backend. AStreamAdvisoremitsTOOL_CALL_*events immediately so the UI can show live progress pills. - Dual-channel side effects: Inside the
@Toolmethod, the backend emits aCUSTOMevent (webapp:action) to pan or zoom the map, or anACTIVITY_SNAPSHOTevent (a2ui-surface) to mount a native card, while returning a short, token-efficient confirmation string back to the LLM. - Reactive frontend updates: Angular queues incoming UI actions in a Signal, validates parameters with Zod inside an
effect(), and dispatches them through the exact same NgRx SignalStores that handle normal user clicks.
The Control Tower & Flight Deck Stack
To make that single turn feel effortless, here is the stack running behind the scenes. Spring Traffic Control is organised as a polyglot monorepo split into three clear areas: the Control Tower (backend), the Flight Deck (frontend), and the Ground Crew (local dev tooling).
Control Tower (Backend)
The backend runs entirely on the JVM, with no Python or Node.js AI sidecar required:
- Spring Boot 4, Spring AI 2, Kotlin, and Java 25: Hosts the LLM agent,
@Toolmethods, and streaming endpoints. - Spring Modulith: Enforces clean domain module boundaries with strict internal encapsulation so agent code cannot bypass domain rules.
com.ag-ui.community:java-core(ag-ui-java-core): Integrated directly with Spring WebMVC'sSseEmitterand Jackson 3 (see the AG-UI Guide for why I bypassed the older community starter on Spring Boot 4).- DuckDB & Redis: Runs embedded analytical queries over airport, airline, and schedule datasets in DuckDB, paired with optional Redis caching for OpenSky live flight telemetry.
- OpenTelemetry: Provides full distributed tracing across HTTP, tool calls, and GenAI spans so the agent is never a black box.
Flight Deck (Frontend)
The frontend treats AI commands as just another reactive input to the application's state:
- Angular 22 & NgRx SignalStore: Uses standalone components, fine-grained Signals, and zero-MapLibre-import stores to keep UI state testable and predictable.
- MapLibre GL JS: Powers GPU-accelerated vector tiles, 3D globe/Mercator toggling, and modular GeoJSON layers wired through
MapLayerAdapterservices (covered in depth in the MapLibre + Angular Guide). - Tailwind CSS & Zod: Handles utility-first styling, CSS Container Queries for responsive cards, and runtime schema validation for every incoming agent payload.
@ag-ui/client& A2UI Surface Host: Consumes the SSE stream and mounts whitelisted Angular components dynamically viaNgComponentOutlet(see the A2UI Guide).
Ground Crew (DevEx & Tooling)
Polyglot monorepos fall apart quickly if onboarding takes a 12-step README. Using mise-en-place (see the Mise Guide), Java 25, Kotlin, Node, pnpm, and monorepo tasks are pinned in one configuration. That means the entire stack, including local inference via Docker Model Runner, pre-seeded offline aviation data via DEMO_MODE, and optional Docker Compose services for Redis and Grafana LGTM, boots with a single command:
mise dev
Pre-Flight Handshake: Runtime Capability Sync & Live Context
One of the first production headaches you hit when building an agent that controls your UI is contract drift.
If you hardcode frontend action names and JSON schemas inside a backend Spring prompt, they will inevitably go stale the moment a frontend developer renames a route or adds a map layer. On the other hand, sending every action's full JSON Schema on every chat turn bloats per-turn payloads.
Spring Traffic Control solves this with a pre-flight handshake:
- Single source of truth on the frontend: Every UI action and A2UI surface is declared once using Zod schemas. The same schema both generates standard JSON Schema for the LLM and validates incoming agent payloads at runtime before any store is mutated.
- One-time startup sync (
POST /api/agui/sync): When Angular boots, it posts itsappVersion, action schemas, and supported A2UI surface descriptors to the backend once. - Versioned backend cache: Spring caches the manifest keyed by
appVersion. On every chat turn, Angular only sendsappVersionplus a tinyuiStatesnapshot. Per-turn requests stay lean, and prompts stay aligned with the UI contract.
Here is a quick preview of the contract pattern we will unpack fully in Part 05:
// Frontend capability manifest (simplified)
export const AGUI_CAPABILITIES = {
appVersion: '0.1.0',
actions: [
{
name: 'selectFlightOnMap',
description: 'Focus the MapLibre radar scope on a specific flight callsign.',
parametersSchema: toJsonSchema(SelectFlightOnMapSchema),
},
{
name: 'showClosestAirportsOnMap',
description: 'Highlight the nearest airports to the active flight on the map.',
parametersSchema: toJsonSchema(ShowClosestAirportsSchema),
},
],
surfaces: ['FlightCard', 'StationCard', 'NearestAirportsCard'],
};
// Backend capability sync endpoint (simplified)
@RestController
@RequestMapping("/api/agui")
class AguiSyncController(private val capabilityRegistry: CapabilityRegistry) {
@PostMapping("/sync")
fun syncCapabilities(@RequestBody manifest: CapabilityManifest): ResponseEntity<Void> {
capabilityRegistry.sync(manifest)
return ResponseEntity.noContent().build()
}
}
Want the full walkthrough of versioned caching, Redis multi-instance gotchas, and how Angular Signals drain incoming actions safely with effect() and untracked()? Jump straight into the companion AG-UI Guide.
Choose Your Flight Path: How to Read This Series
Spring Traffic Control covers a lot of ground, from Spring Modulith and DuckDB to MapLibre GL, Signals, AG-UI, A2UI, and OpenTelemetry. Rather than forcing every reader through the same linear path, the series follows a converging arc: stack-focused deep dives for Spring and Angular engineers that converge on agentic UI control and generative components.
Pick the flight path that matches your stack:
| Track | Recommended Reading Order | Best For |
|---|---|---|
| Full-Stack / Complete Series | 01 → 02 → 03 → 04 → 05 → 06 → 07 (+ 08) | Following the entire monorepo end to end |
| Spring Developer Track | 01 → 02 → 03 → 05 → 07 | Spring Boot 4, Spring Modulith, DuckDB, Spring AI 2, AG-UI server & OTel |
| Angular Developer Track | 01 → 04 → 05 → 06 | Angular 22, NgRx SignalStore, MapLibre GL, @ag-ui/client & A2UI |
| Agentic UI / AI Track | 01 → 03 → 05 → 06 | Focusing directly on AG-UI streaming, capability sync, and A2UI surfaces |
Chapters in the Series
- Part 02: Airspace Boundaries: Structuring an Aviation Backend with Spring Modulith, Kotlin, and DuckDB (Spring)
- Part 03: Live Radio Channel: Streaming AG-UI Events and Tool Calls from Spring AI 2 (Spring)
- Part 04: Building the Radar Scope: Modular MapLibre GL Layers Driven by NgRx SignalStore in Angular 22 (Angular)
- Part 05: Handing Over the Controls: AG-UI Capability Sync, Live Context & Action Execution (Full-Stack)
- Part 06: Flight Strips Inside Chat: Zero-Duplication Generative UI with A2UI and Angular (Full-Stack)
- Part 07: Ground Crew & Black Box: One-Command AI Demos and Tracing with Mise & OpenTelemetry (Full-Stack / DevEx)
- Part 08: Cleared to Speak: Voice-Activated Web App Control Over AG-UI (Full-Stack)
If you want standalone technical references before the upcoming chapters land, all four companion guides (AG-UI, A2UI, MapLibre + Angular, and Mise) have already landed.
Next up in Part 02: Airspace Boundaries, we head into the Control Tower to see how Spring Modulith, Kotlin, and embedded DuckDB keep an aviation domain clean, fast, and AI-friendly.