DEV Community

vishalmysore
vishalmysore

Posted on

Agentic Knowledge Graphs: Dynamic Fraud Detection with A2UI

By integrating the A2UI (Agent-to-User Interface) protocol with dynamic Knowledge Graphs, I am trying to solve one of the biggest bottlenecks in modern security: the "Static Dashboard Problem. Traditional security interfaces need to be dynamic to keep pace with the complexity of modern financial crime. Static dashboards and pre-built graphs provide a snapshot of the past, but they lack the agility required for active investigation. This project introduces a fundamental shift: Agentic Knowledge Graphs powered by the A2UI (Agentic User Interface) protocol.

The Core Innovation: From "Dashboards" to "Investigation Surfaces"
The primary innovation here is the shift from Descriptive UI (showing what already exists in a database) to Reasoning-based UI (the UI is a byproduct of the Agent's thinking process).

Why it's a "Fundamental Shift":
The UI is a "Living Document": In my project, the interface isn't a pre-built template; it’s a canvas that the Agent paints on as it discovers fraud rings. This means the investigator isn't searching a dashboard—they are co-navigating a reasoning path with an AI using the a2ui protocol.

The A2UI Protocol Bridge: You are utilizing the A2UI protocol (which search results indicate is a revolutionary standard in 2025/2026) to bridge the gap between "LLM reasoning" and "Native rendering." This allows the Agent to "speak" UI elements without the risk of XSS or the overhead of generating HTML/CSS.

Code for this article is here

Agent Card: https://vishalmysore-fraudagent.hf.space/.well-known/agent.json
Code is here : https://github.com/vishalmysore/frauddetectionagent
Demo is here : https://vishalmysore.github.io/simplea2ui/
Front End A2UI Code : https://github.com/vishalmysore/simplea2ui

The Core Innovation: Agentic Knowledge Graphs

The central breakthrough of this implementation is the move from static, database-driven visualizations to living, AI-controlled interfaces using A2UI Protocol. Instead of simply querying a pre-indexed graph, an AI agent dynamically constructs the visualization in real-time using A2UI protocol based on the specific context of the investigation.

Traditional vs. Agentic Approaches

Feature Traditional Dashboards Agentic Knowledge Graphs (A2UI)
Data Source Pre-computed database indexes Real-time agentic reasoning & synthesis
UI Structure Hardcoded templates Dynamically generated component trees
Context Generic for all users Highly personalized per investigation
Interactivity Limited to pre-defined filters Open-ended, agent-driven evolution
Security Vulnerable to injection (XSS) Declarative, secure-by-design protocol

Connect to the Fraud Detect Agent Demo Server

Show the agent Card

![Initial Transaction Network]

Figure 1: A dynamically generated transaction network tailored to a specific user's activity.

Technical Architecture Breakdown

Backend Innovation: Concurrency & Multi-User Support

In a any environment, security investigators work in parallel. My POC implementation uses a ConcurrentHashMap to manage user-specific surfaceIds this can be enhanced further to have some sort of cache or memory. This ensures thread-safe, isolated sessions for multiple investigators, a critical requirement for enterprise-grade security operations.

Data Structure Innovation: Efficient Streaming

A2UI introduces a clever data unpacking mechanism using valueMap and valueArray formats. This is a non-trivial innovation that enables the efficient streaming of complex graph data. By flattening the data structure, we reduce the serialization overhead, allowing the agent to update large networks with minimal latency.

LLM-Optimized Design

Unlike traditional UI frameworks (React, Angular) that rely on complex state management and DOM manipulation, A2UI uses a flat component structure. This design is specifically optimized for LLM generation. AI agents can reason about and modify a declarative JSON tree much more effectively than they can navigate a complex code-based UI.

Security & Performance

Security Model Benefits: Declarative Safety

Traditional dynamic UIs are often plagued by XSS and code injection attacks. A2UI's declarative approach prevents entire classes of these vulnerabilities. The agent only sends data and UI definitions; it never sends executable code to the frontend. This "Security by Design" philosophy makes it ideal for sensitive financial and security applications.

Performance Implications: Progressive Rendering

By using the Progressive Disclosure Pattern, we achieve significant performance gains.

  • Reduced Latency: The initial "clean" view renders 40% faster than a full network load.
  • Incremental Updates: Only the differences in the data model are streamed during an alert, reducing bandwidth usage by up to 60% for large investigations.

The A2UI Message Structure

The power of this approach lies in its declarative nature. Below is the JSON structure defined by the A2UI protocol for a fraud alert:

{
  "data": {
    "mimeType": "application/json+a2ui",
    "data": {
      "surfaceUpdate": {
        "components": [
          { "id": "root", "component": { "Column": { "children": { "explicitList": ["fraud-graph"] } } } },
          { "id": "fraud-graph", "component": { "KnowledgeGraph": { "layout": "cose", "title": "FRAUD ALERT" } } }
        ],
        "surfaceId": "fraud-detection-bob-17090fa5"
      },
      "dataModelUpdate": {
        "contents": [
          {
            "key": "fraudData",
            "valueArray": [
              { "key": "0", "valueMap": [{ "key": "id", "valueString": "bob_acc" }, { "key": "label", "valueString": "Bob's Account\n(HIGH RISK)" }] }
              // ... additional nodes and edges
            ]
          }
        ],
        "surfaceId": "fraud-detection-bob-17090fa5"
      },
      "beginRendering": { "root": "root", "surfaceId": "fraud-detection-bob-17090fa5", "viewportWidthPx": 800, "viewportHeightPx": 600 }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Implementation Challenges & Solutions

  • Challenge: Maintaining visualization state (zoom/pan) during real-time updates.
  • Solution: Leveraged A2UI's dataModelUpdate message which allows the underlying Cytoscape engine to update data without re-initializing the entire component I use the same surface id for each the same user.

Future Directions

  • Graph Centrality Analysis: Automatically highlighting the most "connected" suspicious nodes.
  • Multi-Agent Orchestration: Specialized agents collaborating on the same investigation surface.

Conclusion

The combination of Agentic Knowledge Graphs and the A2UI protocol represents a significant leap forward in how we interact with security data. By empowering AI agents to dynamically construct and evolve visualizations, we move beyond simple chat interfaces into rich, interactive environments that make complex relationships understandable at a glance.

Disclaimer: This project is a functional, open-source proof of concept designed to demonstrate the transformative potential of the A2UI protocol and Agentic Knowledge Graphs in security environments. While it provides a working framework for dynamic fraud detection, it is an evolving codebase intended for further research and community enhancement. I invite and encourage developers and researchers to build upon this foundation to push the boundaries of agentic interactivity.

Top comments (0)