Skip to main content

6 posts tagged with "Cloudflare D1"

Cloudflare's serverless SQLite database (D1) as the data plane for agentic apps, analytics, and NL-to-SQL.

View All Tags

Closing the Loop: Evaluation, Debate, and Discovery

· 14 min read
Vadim Nicolai
Senior Software Engineer

The most stubborn bottleneck in autonomous knowledge graphs is not retrieval accuracy or latency — it is evaluation. Every edge inserted, every relationship inferred, every hypothesis proposed can be wrong, and the only way to know is to verify. But verification is itself becoming an agentic problem, and the 2026 literature is blunt about it: the evaluator must be as sophisticated as the generator. The question is no longer whether to close the loop but how — and the answer is a layered design that combines a deterministic rule engine, an agent-as-judge, multi-agent debate for contested edges, and autonomous discovery, all gated by a hard abstain-under-uncertainty rule.

This is article #5, the final guardrail in the Autonomous Knowledge Graphs series. It closes the loop over the graph that #1 builds, #2 reasons over, #3 repairs, and #4 remembers. Every design in the series obeys the same engineering constraints: a control plane built on LlamaIndex — DeepSeek as the LLM client, its PropertyGraphIndex for retrieval — with the autonomous loop itself written in plain Python rather than run by a workflow or graph-orchestration engine, over a Cloudflare D1 concept-graph data plane (concepts, concept_edges, lesson_concepts), with a thin TypeScript layer applying every write; DeepSeek-only model egress through one Cloudflare AI Gateway; a grounding-first record on every write — {confidence, reason, source, evidence} with bi-temporal valid_at/recorded_at stamps; and invalidate-not-delete at every irreversible step. The worked example throughout is the AI-engineer curriculum concept graph — concepts linked by prerequisite, builds_on, contrasts_with, part_of, related, and applies_to. Here the loop runs with a ≥ 0.80 commit bar on every edge and grounding-first provenance throughout.

The Graph as Agent Memory

· 15 min read
Vadim Nicolai
Senior Software Engineer

The graph as agent memory rejects the notebook metaphor. A notebook remembers what you wrote, but not when you believed it, nor when the fact itself was true. Flat vector stores and long-context transformers collapse time into a single present, and an agent that cannot distinguish "I knew this yesterday" from "this is still true today" is not reasoning — it is repeating. A bi-temporal knowledge graph — one that records both valid_at (when the fact held in the world) and recorded_at (when the agent ingested it) — turns memory from a static log into a navigable, revision-conscious archive where nothing is deleted and facts are superseded by stamping invalid_at.

This is article #4 in the Autonomous Knowledge Graphs series. The AI-engineer curriculum concept graph from #1 doubles as the agent's long-term, revision-conscious memory of the curriculum as it evolves across months of sessions, under the same engineering constraints: a control plane built on LlamaIndex — DeepSeek as the LLM client, its PropertyGraphIndex for retrieval — with the autonomous loop itself written in plain Python rather than run by a workflow or graph-orchestration engine, over a Cloudflare D1 concept-graph data plane (concepts, concept_edges, lesson_concepts), with a thin TypeScript layer applying every write; DeepSeek-only model egress through one Cloudflare AI Gateway; a grounding-first record on every write — {confidence, reason, source, evidence} with bi-temporal valid_at/recorded_at stamps; and invalidate-not-delete at every irreversible step.

Self-Healing Knowledge Graphs: Graphs That Fix Themselves

· 15 min read
Vadim Nicolai
Senior Software Engineer

Provenance is not truth. A triple can be perfectly traced to a published source and still be wrong — contradicted by a later signal, inconsistent with the schema, or hallucinated by the model that extracted it. The industry has spent years building better provenance; the harder problem is what to do when provenance says the fact is sourced but the fact is still garbage. The sharpest 2026 statement of this is TGComplete, which finds that most gold-correct edges have no supporting passage even under exhaustive retrieval — so textual verification measures provenance, not correctness (Kang et al., 2026, arXiv:2606.15833).

This is article #3 in the Autonomous Knowledge Graphs series, and it is a guardrail. Where #1 builds the curriculum concept graph and #2 reasons over it, this article keeps it accurate over time. Every design in the series obeys the same engineering constraints: a control plane built on LlamaIndex — DeepSeek as the LLM client, its PropertyGraphIndex for retrieval — with the autonomous loop itself written in plain Python rather than run by a workflow or graph-orchestration engine, over a Cloudflare D1 concept-graph data plane (concepts, concept_edges, lesson_concepts), with a thin TypeScript layer applying every write; DeepSeek-only model egress through one Cloudflare AI Gateway; a grounding-first record on every write — {confidence, reason, source, evidence} with bi-temporal valid_at/recorded_at stamps; and invalidate-not-delete at every irreversible step. This guardrail runs as a background repair sweep over the stored concept graph.

Reasoning Over the Graph: From GraphRAG to Planning Agents

· 14 min read
Vadim Nicolai
Senior Software Engineer

Agentic GraphRAG treats the knowledge graph not as a static index to retrieve from once, but as a state space to reason over one node at a time. GraphRAG proved that structured knowledge could be retrieved at generation time — but a one-shot subgraph either drowns the LLM in irrelevant triples or misses the one critical edge. A question like "what must a learner master before agent orchestration, and which of those concepts does RAG build on?" is a sequence of decisions: which edge to follow, which concept to expand, when to backtrack. That is a planning problem, and the 2026 research corpus has converged on agentic traversal to solve it.

This is article #2 in the Autonomous Knowledge Graphs series. It reasons over the curriculum concept graph that article #1 builds, and obeys the same engineering constraints: a control plane built on LlamaIndex — DeepSeek as the LLM client, its PropertyGraphIndex for retrieval — with the autonomous loop itself written in plain Python rather than run by a workflow or graph-orchestration engine, over a Cloudflare D1 concept-graph data plane (concepts, concept_edges, lesson_concepts), with a thin TypeScript layer applying every write; DeepSeek-only model egress through one Cloudflare AI Gateway; a grounding-first record on every write — {confidence, reason, source, evidence} with bi-temporal valid_at/recorded_at stamps; and invalidate-not-delete at every irreversible step. The worked example is an explainable answer over the curriculum graph: the agent returns not just an answer but the supporting concept sub-graph as evidence.

Autonomous Knowledge Graph Construction: Graphs That Build Themselves

· 17 min read
Vadim Nicolai
Senior Software Engineer

Autonomous knowledge graph construction is the pattern where one agent loop owns the entire lifecycle of a graph — read a source, search what is already known, verify a candidate fact, then write it — instead of running a one-shot batch extraction and hoping a later merge step cleans up the mess. The cleanest 2026 formulation is RAGA, which gives an LLM agent a CRUD toolset over the graph and constrains it with a Read-Search-Verify-Construct loop (Han & Cheng, 2026, arXiv:2605.17072).

This is the first article in a new series, Autonomous Knowledge Graphs, a connected five-part arc — from human-curated graphs up to graphs that build, reason, repair, remember, and evaluate themselves. Every design in the series obeys the same engineering constraints: a control plane built on LlamaIndex — DeepSeek as the LLM client, its PropertyGraphIndex for retrieval — with the autonomous loop itself written in plain Python rather than run by a workflow or graph-orchestration engine, over a Cloudflare D1 concept-graph data plane (concepts, concept_edges, lesson_concepts), with a thin TypeScript layer applying every write; DeepSeek-only model egress through one Cloudflare AI Gateway; a grounding-first record on every write — {confidence, reason, source, evidence} with bi-temporal valid_at/recorded_at stamps; and invalidate-not-delete at every irreversible step. The worked example throughout is the AI-engineer curriculum concept graph — concepts linked by prerequisite, builds_on, contrasts_with, part_of, related, and applies_to.

NL-to-SQL CRM Analytics on Cloudflare D1 + Self-Healing

· 22 min read
Vadim Nicolai
Senior Software Engineer

A sales operator types "how many fintech contacts replied last week?" and gets an answer. No one writes SQL. This is NL-to-SQL CRM analytics on Cloudflare D1: the text_to_sql graph translates the question, runs it on D1, and — when the query fails — heals itself from the database's own error message. That last move is the load-bearing idea behind the self-healing loop: the database is not a passive recipient of your SQL. It is the most honest verifier you have.

That inversion drives Evaluating Open-Source LLM Agents for SQL Generation and Structured Analytics on Relational Databases, by Borovčak, Bagić Babac, and Mornar in Computers, Materials & Continua (2026). You do not demand a perfect one-shot translation. You let the query run, read the error, and regenerate against that diagnostic. The error text is the repair signal. Execution accuracy, not string overlap, is the metric that counts. The 7 numbered findings below are the evidence, and they map onto a 7-node production graph.

This is article #5 of a 10-part series, "The Autonomous Sales Fleet" — one production LangGraph + DeepSeek + Cloudflare-D1 + LangSmith system. Each part realizes one 2026 paper as one real graph. This one is the text_to_sql graph in backend/graphs/text_to_sql_graph.py, one of 39 registered in the fleet. It answers questions over the 4 CRM tables in the Cloudflare D1 database lead-gen-jobs. It generates a SELECT, validates it against a hard read-only gate, runs it, and repairs its own failures up to 2 times. No write path is ever reachable.

On the fleet's autonomy ladder this capability sits medium. It fully automates the plan→act span for a read-only analytics question. The graph translates intent to SQL, runs it, and heals its own failures with no human writing a query. The database's SELECT-only gate is what lets it act unattended. The operator reading the 1-to-2 sentence summary is the verify step. It earns that autonomy because the action space is structurally incapable of mutating data. A write-capable version would drop back down the ladder, behind human approval.

Two siblings frame this one. Article #1, Reason→Decompose→Act→Verify — an Autonomous CRM Orchestrator on LangGraph, reasons over signals and dispatches worker graphs. This graph answers the operator's question about the pipeline itself. Article #9, Evidence-Driven Release Gates for LLM Sales Agents, is the eval harness. It holds every prompt path here to the fleet's ≥0.80 bar before a change ships.