SOLUTION: Agentic AI for Natural-Language Access to Snap4City Data and Services

Making Smart City data accessible through conversational AI

Smart City platforms integrate increasingly large and heterogeneous collections of IoT data, mobility information, environmental observations, geospatial resources, public services, APIs, analytics and decision-support tools. Snap4City provides an open-source ecosystem for collecting, integrating and exploiting these resources across multiple urban domains. However, taking full advantage of such a platform traditionally requires technical knowledge of APIs, data models, service parameters and query languages.

The proposed Agentic AI solution for Snap4City introduces a new interaction model: users can access Smart City data and services simply by expressing their needs in natural language. An LLM-based multi-agent system interprets the request, plans the necessary operations, selects the appropriate Snap4City services, executes them and combines the results into a concise natural-language response.

This approach transforms the Large Language Model from a conventional chatbot into an intelligent orchestration layer between users and the Smart City infrastructure. Instead of generating an answer solely from information learned during model training, the system actively accesses live Snap4City tools and data sources. The result is an AI assistant capable of answering questions that involve current urban data, geographic information, IoT devices, mobility services and routing.

From a user request to a Smart City workflow

A key feature of the solution is its ability to handle complex requests requiring several operations. Rather than asking the LLM to solve everything in a single step, the system decomposes the user's request into a sequence of atomic tasks and assigns each task to the most suitable specialized agent.

The architecture, illustrated in the paper's end-to-end diagram on page 6, is organized around three main stages: Planning, Dispatch and Execution, and Synthesis and Output. The Planner first converts the user's request into an ordered execution plan, explicitly identifying dependencies between individual steps. The Step Router then provides each specialized agent only with the information that it needs from previous operations. Finally, the results are correlated and transformed into the response presented to the user.

This controlled execution model is particularly important in Smart City applications. A request such as finding a public service near a location, retrieving its current data and determining how to reach it may require geocoding the location, searching the Snap4City Knowledge Base, retrieving details about identified entities and computing a multimodal route. The framework can automatically create and execute such a workflow from a single natural-language request.

Specialized AI agents connected to Snap4City

The current implementation organizes Snap4City capabilities into seven specialized agent categories, supported by approximately 65 tools exposed through the Model Context Protocol (MCP). These agents cover:

  • Locator — geocoding, reverse geocoding and administrative boundaries; Services — discovery of services and Points of Interest; IoT — identification of sensors and IoT devices; Get Details — metadata and live or historical observations; Mobility — transport agencies, lines, stops and schedules; Routing — multimodal routes for walking, cars and public transport; and Utility — geographic format conversion and geospatial operations.

The agents do not operate as independent conversational bots. Instead, they exchange information through a shared workflow state. For example, the Locator agent can convert a place name into coordinates, which are subsequently passed to a Service, IoT, Mobility or Routing agent. This makes it possible to construct workflows spanning several urban domains while keeping each individual agent focused on a clearly defined responsibility.

MCP: a standard interface between AI and Smart City services

One of the most significant aspects of the architecture is the adoption of the Model Context Protocol (MCP) as the interface between AI agents and Snap4City services.

Snap4City already exposes a wide range of capabilities through REST APIs, Node-RED microservices, interactive dashboards and other components. These services naturally differ in their parameters, formats and conventions. Directly exposing this heterogeneous environment to an LLM would make reliable automated composition difficult.

The proposed solution therefore transforms the selected Snap4City microservices into typed MCP tools. Their input parameters, allowed values, units, coordinate conventions and error responses are explicitly described in machine-readable form. Agents consequently interact with a uniform interface rather than having to understand the implementation details of every individual API.

This design also makes the platform extensible. New Smart City capabilities can be incorporated by exposing additional MCP tools, assigning them to a semantic category and introducing a corresponding specialist agent when necessary. The existing orchestration architecture does not need to be redesigned.


Reliable execution, recovery and grounded answers

Supervision instead of uncontrolled tool calling

Agentic systems must do more than choose tools: they need mechanisms for verifying whether an operation actually produced the information required by the user.

For this reason, every step performed by a specialist agent is checked by an LLM-based Supervisor. The Supervisor can approve the result, request that the agent retries the operation with corrective guidance, or escalate the problem when repeated attempts fail.

If necessary, a Replanner analyses the failed workflow and its diagnostic information and creates a revised request for the Planner. Replanning is bounded to prevent uncontrolled execution. If the complete request still cannot be resolved, the system uses a graceful-failure mechanism: successful partial results are retained and the user is explicitly informed about the parts that could not be completed.

This architecture provides substantially more control than a single LLM that independently decides which APIs to call and how to interpret their responses.

Keeping answers relevant and traceable

After successful execution, a Correlator analyses dependencies between the different steps and determines which retrieved information was actually used to answer the request. Unused intermediate information can be removed, reducing unnecessary content in the final response.

The subsequent Formatter generates the natural-language answer from the correlated results. This mechanism is intended to make responses more transparent and grounded in information actually retrieved from Snap4City rather than relying on unsupported model-generated content.

The framework also addresses the large size of certain Smart City data structures. Geographic responses, for example, may contain long polygons or complex GeoJSON geometries. These values can temporarily be replaced with lightweight references while retaining the original data for subsequent operations, helping to reduce the amount of information that must be stored in the LLM's active context.

Experimental results

The solution was evaluated using both structured and unstructured Smart City queries. The experimental dataset included 30 queries with SPARQL-based ground truth from the Snap4City Knowledge Base and 90 broader natural-language queries evaluated by domain experts.

The results provide evidence that the agentic approach is effective. Agent selection by the Planner achieved an overall F1-score of 90.5%, with 117 of 126 agent dispatches matching expert annotations.

When retrieval was compared with SPARQL ground truth, the system achieved 0.929 precision, confirming that most information returned by the agents corresponded to actual ground-truth results. Recall was lower, at 0.623, mainly because queries returning very large numbers of records can exceed practical tool or LLM context limits. The architecture therefore currently favors precise, verifiable results over exhaustive enumeration.

In the human evaluation of 90 Smart City queries, the solution obtained 0.829 precision, 0.907 recall and an F1-score of 0.866. Many of these requests required approximately four to eight atomic operations, demonstrating the system's ability to address substantially more complex questions than simple single-step information retrieval.

A further G-Eval comparison tested the full agentic architecture against an LLM configuration without access to tools. The agentic system achieved an average correctness score of 0.818 compared with 0.703 for the tool-free baseline, indicating that grounding responses in Snap4City data and services improves answer correctness. This benefit currently has a computational cost: the evaluated agentic requests took approximately 67 seconds on average, compared with 6 seconds for the baseline, with about 12 tool calls per request.

Toward conversational access to the Smart City Digital Twin

The Agentic AI framework provides a new access layer for the Snap4City ecosystem. Instead of requiring users to understand individual APIs, SPARQL queries, geographic formats or service interfaces, the complexity is managed by the AI orchestration framework.

The approach combines natural-language understanding, multi-step planning, specialized agents, standardized MCP tools, supervision, recovery and cross-domain result correlation. In doing so, it enables users to move from a question expressed in everyday language to controlled interactions with live Smart City resources.

The current evaluation covers only a subset of the much larger Snap4City service ecosystem. Snap4City already includes capabilities related to ML/AI, predictions, anomaly detection, optimization, statistics, simulation, visual analytics, business intelligence, interoperability, LLM-RAG and multimodal AI. Extending the Agentic AI framework toward these services creates the basis for increasingly powerful conversational interfaces to the Smart City Digital Twin.

In short, the objective is simple: users should be able to ask the Smart City a question in natural language, while the Agentic AI framework determines which Snap4City data, services and analytical tools are required to produce a grounded answer.