Menu
Cloudflare Blog·August 7, 2026

Building AI-Powered Data Exploration on Cloudflare's Developer Platform

This article details the architectural choices and components used to build Cloudflare Radar Researcher, an AI tool that allows users to explore internet traffic data using natural language. It highlights the use of Cloudflare Workers, Durable Objects, Workers AI, and AI Gateway, demonstrating how these services integrate to create a stateful, scalable, and intelligent data querying system.

Read original on Cloudflare Blog

Architectural Overview of Radar Researcher

Cloudflare Radar Researcher is an AI agent built entirely on Cloudflare's developer platform, showcasing a practical application of serverless functions, stateful objects, and AI inference. The system is designed to democratize access to Cloudflare's vast internet data by allowing users to ask questions in plain language and receive interactive visualizations and explanations.

Core Components and Their Roles

  • Cloudflare Worker with Agents SDK: Acts as the central orchestrator for each conversation, handling user requests and coordinating interactions between other services.
  • Durable Objects: Each conversation is managed by a stateful Durable Object, which maintains chat history, titles, and streaming responses. This ensures conversation persistence even if a user disconnects, as generation continues server-side.
  • Workers AI: Serves as the "brain" for natural language processing, running open models (e.g., Kimi K2.7) in an ordered fallback chain for resilience. This multi-model approach ensures high availability and robustness against single model outages.
  • AI Gateway: All AI inference calls are routed through AI Gateway for essential functionalities like logging, cost tracking, caching, and implementing safety guardrails. This centralizes control and observability for AI interactions.
  • Cloudflare MCP Server with Code Mode: Instead of hard-coding API tools, the agent uses Code Mode to connect to Cloudflare's unified MCP server. It dynamically searches the OpenAPI specification to find relevant API endpoints and generates code snippets to query the Radar API, making the system adaptable to new datasets without code changes.
  • Custom Chart Rendering: To avoid LLM data truncation, the model emits a lightweight chart specification referencing API paths. Cloudflare's frontend then matches these specifications with fetched data to render rich, interactive charts using existing visualization components.
💡

Resilience in AI Systems

The use of an ordered fallback chain for AI models in Workers AI is a critical design decision for resilience. By having multiple model families, the system can transparently cascade requests to the next available model if one is at capacity or experiences an incident, significantly improving system reliability and uptime.

Data Flow and Interaction

When a user asks a question, the Cloudflare Worker receives it and passes it to the Workers AI for interpretation. The AI, equipped with tools for searching and executing against the Radar API's OpenAPI spec, formulates a query. This query is executed via the MCP server, fetching live data. The model then generates a response, including lightweight chart specifications. The frontend Worker then uses these specifications to render interactive charts and presents the complete answer to the user. Contextual information like current date, time, and user's IP location are also passed to the AI to tailor answers.

json
{
  "user_query": "Internet quality in Portugal?",
  "worker_action": "parse_query_and_context",
  "ai_gateway_route": "workers_ai/kimi_k2.7_fallback",
  "ai_tool_call": {
    "tool": "execute",
    "args": {
      "api_endpoint": "/internet_quality",
      "parameters": {"country": "Portugal"}
    }
  },
  "api_response": {"data": "..."},
  "model_output": {
    "text": "... explanation ...",
    "chart_spec": {"dataFrom": "/internet_quality", "type": "time_series"}
  },
  "frontend_render": "interactive_chart_and_text"
}

The entire system leverages Cloudflare's ecosystem, from compute (Workers) to inference (Workers AI) to storage (R2 for conversation history) and data access, demonstrating a vertically integrated architecture for building intelligent applications.

Cloudflare WorkersWorkers AIDurable ObjectsAI GatewayNatural Language ProcessingAPI ManagementSystem ArchitectureServerless

Comments

Loading comments...