cd /news/ai-agents/your-ai-agent-is-guessing-what-a-fai… · home › topics › ai-agents › article
[ARTICLE · art-170750] src=falkordb.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Your AI Agent Is Guessing What a Failure Cuts Off

GridMend, an LLM agent built by Anish Tejwani for FalkorDB's Graph Hacks hackathon, produced 0 unsafe switching plans across 23 simulated power-grid faults, while a language model planning alone produced unsafe plans for 20 of the 23 faults. GridMend uses FalkorDB's built-in Cypher procedures algo.WCC and algo.MSF to compute which grid sections a fault cuts off and whether a reconfiguration would close a loop. The hackathon, held October 15 to 18, 2026, with $20K in prizes, drew 7,899 developers and 1,213 projects, 320 of which named a FalkorDB algo.* procedure.

by read10 min views8 publishedNov 16, 2026
Your AI Agent Is Guessing What a Failure Cuts Off
Image: Falkordb (auto-discovered)

Graph Hacks, FalkorDB's online hackathon (October 15 to 18, 2026, $20K in prizes), drew 7,899 developers and 1,213 projects, and 320 of those projects named a FalkorDB algo.* procedure in their write-up. The strongest result came from a power grid. A language model planning alone made unsafe switching plans for 20 of 23 faults. GridMend, an agent that works through graph algorithms and forked copies of one FalkorDB graph, made 0. This tutorial shows the exact CALL algo.* queries three teams used, the question each answers for an agent, and what it returned.

Key takeaways. An LLM guesses what a failure cuts off or how much a network can carry. Graph algorithms for AI agents compute it. FalkorDB runs algorithms as Cypher procedures, so each agent tool is one query. GridMend uses

algo.WCC and algo.MSF to reach 0 unsafe grid plans. Detour uses algo.maxFlow to show that 17,167 of 18,432 riders an hour can still move toward Manhattan when the L train shuts. Seismo uses algo.pageRank to find breaking news on Wikipedia with no LLM in detection. Want to run these queries yourself? Start free on FalkorDB Cloud, load a small network, and call your first algo.* procedure from the browser.

What are graph algorithms for AI agents? #

Graph algorithms for AI agents are procedures that compute an exact answer over a whole network, like the best route, the most it can carry, what is connected or what matters most, and return that answer to an agent as a tool result.

In FalkorDB they are built in. You write CALL algo.<name>(...) in Cypher, YIELD the results and keep filtering them in the same query. The model picks the question, and the database does the math. It's the same idea as giving enterprise AI agents a context layer they can query.

Which graph algorithm answers which agent question? #

FalkorDB procedure Question it answers for an agent Graph Hacks example
algo.WCC What does a failure cut off? GridMend grid zones, Seismo stories
algo.MSF Would this change close a loop? GridMend loop check on a fork
algo.maxFlow How much can the network still carry? Detour riders an hour after a closure
algo.SPpaths What is the best way around the problem? Detour reroutes stranded trips
algo.pageRank What is at the center of this cluster? Seismo finds a story's epicenter
algo.betweenness What does everything else depend on? IROPS Brain load-bearing flights

And these are the procedures named most often across all 1,213 submissions.

FalkorDB procedure Projects that named it
algo.pageRank 194
algo.SPpaths 117
algo.betweenness 111
algo.WCC 81
algo.maxFlow 47
Any algo.* procedure 320

How did Graph Hacks teams use graph algorithms for AI agents in FalkorDB? #

1. algo.WCC and algo.MSF: what does a grid fault cut off?

GridMend · Anish Tejwani · See the code · Use the app · Blog

When a power line faults, the substation breaker trips and everyone downstream goes dark. Operators must cut out the faulted section with switches and re-feed the rest through backup ties, without closing a loop or over a line. Utilities call this FLISR.

GridMend is an LLM agent that does FLISR on a digital twin of the feeder in one FalkorDB graph. Buses are nodes, unswitched lines are SEG edges and switches are SW edges. The agent never writes Cypher. It calls 13 tools. Its first question is "what is the smallest section I can cut out?" algo.WCC answers it over SEG edges only. Switches are left out, so they act as walls, and every component is a zone the switches can isolate.

CALL algo.WCC({nodeLabels: ['Bus'], relationshipTypes: ['SEG']})
YIELD node, componentId
WITH componentId, collect(node) AS nodes
WHERE none(n IN nodes WHERE n.is_source)
RETURN [n IN nodes | n.id] AS buses

Before any switch moves, every plan runs on its own GRAPH.COPY of the live FalkorDB graph. There, algo.MSF builds a spanning forest over the conducting edges. Any edge the forest can't use closes a loop, and the query names it.

CALL algo.MSF({nodeLabels: ['Bus'], relationshipTypes: ['SEG', 'SW'],
               weightAttribute: 'tree_weight'})
YIELD nodes, edges
WITH nodes, [e IN edges | e.id] AS tree
OPTIONAL MATCH (a:Bus)-[r:SEG|SW]->(:Bus)
WHERE a IN nodes AND NOT r.id IN tree
RETURN size(nodes) AS energized_buses, collect(r.id) AS loop_edges

The result: across all 23 single faults on the IEEE 33-bus test feeder, the agent made 0 unsafe plans and restored 85.5% of the best possible load. A language model with a text description of the feeder and no tools made unsafe plans for 20 of 23 faults.

In the builder's words."Algorithms inside Cypher: WCC, MSF and maxFlow are callable directly, which replaced most of the custom graph code I expected to write." Anish Tejwani, GridMend

Try it. Model the thing that can fail as one relationship type, and run algo.WCC without it to see what gets cut off. Start free on FalkorDB Cloud.

2. algo.maxFlow and algo.SPpaths: can the subway absorb a shutdown?

Detour · Harsh Mishra, Saud Satopay and Parva Panchal · See the code · Use the app · Blog

When a subway line breaks at rush hour, a control center must answer fast. Who is stuck, where will they go, and can the rest of the network carry them? A trip planner routes one rider. This is a flow problem.

Detour loads the New York City subway from MTA open data into FalkorDB, with 1,459 segments that carry capacity and 30,205 origin-destination flows. A dispatcher describes a closure in plain words, and agents pick from 13 fixed tools. For "can the network carry them?", the agent runs algo.maxFlow over spare capacity on a forked FalkorDB graph without the closed segments. The returned edge flows show which corridors are full.

MATCH (src:Hub {id: $src}), (snk:Hub {id: $snk})
CALL algo.maxFlow({sourceNodes: [src], targetNodes: [snk],
                   relationshipTypes: ['FLOW'], capacityProperty: 'spare'})
YIELD maxFlow, edges, edgeFlows
RETURN maxFlow,
       [e IN edges | [e.kind, startNode(e).id, endNode(e).id]] AS es,
       edgeFlows AS flows

For "where will they go?", one query sends every displaced trip through algo.SPpaths, weighted by minutes, so waits and transfers have a price.

UNWIND $pairs AS p
MATCH (a:Station {id: p.o}), (b:Station {id: p.d})
CALL algo.SPpaths({sourceNode: a, targetNode: b,
                   relTypes: ['BOARD', 'RIDE', 'ALIGHT', 'WALK', 'BUS'], weightProp: 'minutes'})
YIELD path, pathWeight
RETURN p.o AS o, p.d AS d, pathWeight AS minutes,
       [r IN relationships(path) WHERE type(r) = 'RIDE' | r.eid] AS eids

The result for closing the L between Bedford Av and 8 Av at 8 a.m.: 23,445 riders an hour are hit. On their fastest paths, the G runs at up to 244% of capacity and 4,689 riders have no path. Max flow says 17,167 of 18,432 riders an hour toward Manhattan can still get through, and the min cut points to 1 Av. A shuttle tested on a fork cuts riders with no path to 623. An independent NetworkX program matches FalkorDB's max flow for all three closures the team tested.

In the builder's words."Graph algorithms are Cypher procedures, so each agent tool is a query and nothing leaves the database." The Detour team

Try it. Put a capacity on every edge of a network you care about, and run algo.maxFlow between two points. Start free on FalkorDB Cloud.

3. algo.WCC and algo.pageRank: is this a breaking story?

Seismo · Divyansh Khurana · See the code · Use the app · Blog

News doesn't get written on Wikipedia. It gets edited. When something happens, strangers converge on the same few articles within minutes, and that shape shows up before any headline.

Seismo streams every human edit on every Wikipedia, about two a second, into one FalkorDB graph of pages, editors and edits. Every 45 seconds, Cypher gives a temporary :Hot label to pages that three or more people edited in the last 20 minutes, then links hot pages that share an editor. Look at the second line of the query below. Editors who touch more than four hot pages are skipped, because on the first run one vandalism patroller glued unrelated pages into a fake story.

MATCH (u:Editor)-[:MADE]->(e:Edit)-[:ON]->(h:Hot) WHERE e.ts > $since
WITH u, count(DISTINCT h) AS deg WHERE deg >= 2 AND deg <= $max_deg
MATCH (a:Hot)<-[:ON]-(ea:Edit)<-[:MADE]-(u)-[:MADE]->(eb:Edit)-[:ON]->(b:Hot)
WHERE ea.ts > $since AND eb.ts > $since AND id(a) < id(b)
WITH a, b, count(DISTINCT u) AS shared
CREATE (a)-[:CO_EDITED {shared: shared}]->(b)

Now "which pages are one story, and where did it start?" is two calls. algo.WCC groups hot pages into stories, with SAME_AS edges joining languages, and algo.pageRank picks each epicenter.

CALL algo.WCC({nodeLabels: ['Hot'], relationshipTypes: ['CO_EDITED', 'SAME_AS']})
YIELD node, componentId
RETURN node.key, componentId

CALL algo.pageRank('Hot', 'CO_EDITED') YIELD node, score
RETURN node.key, score

No LLM is involved in detection. Only after FalkorDB finds a story do Claude agents claim it and write a brief, with a CITES edge to every revision they read. In the first live run, the crew filed a brief on an explosion at a military base in Alberta.

Try it. Give the nodes you care about a temporary label, then run algo.WCC and algo.pageRank on just that label. Start free on FalkorDB Cloud.

Two more projects using graph algorithms for AI agents #

Six algorithms in one airline recovery agent. IROPS Brain, by Pugar Huda Mantoro, replays the December 2022 Southwest meltdown from US DOT data in FalkorDB. algo.betweenness finds load-bearing flights, A* finds the nearest reserve crew, and algo.maxFlow over free seats says how many stranded passengers the network can still carry. Watch the demo.

One FalkorDB graph per football match. GraphScout, by Parv Mittal, Aniket Chawardol and Avnish Jaltare, stores each of 51 Euro 2024 matches as its own FalkorDB graph. algo.pageRank and algo.betweenness show which players a team depends on, and each marking plan is tested on a GRAPH.COPY of the match. Watch the demo.

Building agents that also need to remember what they learn? Read 5 agent memory patterns from 647 Graph Hacks projects.

More algorithms at work: algo.maxFlow picks the cheapest way to cut off a poisoned agent in how Graph Hacks teams secured AI agents, and five FalkorDB algorithms run a live conference graph in what 647 developers built at Patch the Conference.

Frequently asked questions #

What graph algorithms for AI agents does FalkorDB support?

FalkorDB has built-in procedures for BFS, shortest paths (algo.SPpaths and algo.SSpaths), A*, minimum spanning forest ( algo.MSF), PageRank, betweenness and harmonic centrality, weakly connected components (algo.WCC), community detection with label propagation, and max flow (algo.maxFlow). Start free on FalkorDB Cloud to try every option.

How do you call a graph algorithm from Cypher in FalkorDB?

Use CALL algo.<name> with a config map, then YIELD the fields you need. For example, CALL algo.WCC({nodeLabels: ['Bus'], relationshipTypes: ['SEG']}) YIELD node, componentId returns every node with its component. PageRank takes a label and a relationship type as two arguments instead: CALL algo.pageRank('Hot', 'CO_EDITED') YIELD node, score.

Why should an AI agent call a graph algorithm instead of reasoning on its own?

A language model can only estimate what a failure cuts off or how much a network can carry. A graph algorithm computes the exact answer. In the GridMend test on 23 power-grid faults, a language model planning alone made 20 unsafe plans, while the agent working through FalkorDB graph algorithms made 0.

How do you run a graph algorithm on only part of a graph?

Pass nodeLabels and relationshipTypes in the config map. Graph Hacks teams used two more patterns on FalkorDB. Seismo adds a temporary label, runs the algorithm on it, then removes it. GridMend and Detour run algorithms on a GRAPH.COPY of the graph, so the live data never changes.

Let the database do the math #

Every algorithm in this post runs on the same FalkorDB you can start with one Docker command, docker run -p 6379:6379 -p 3000:3000 -it --rm falkordb/falkordb:latest, or a free cloud instance. Load a network your agent already reasons about, and replace one guess with one CALL algo.* query.

Start free on FalkorDB Cloud

Not ready to build yet? Join the FalkorDB Discord to get help from our engineers, share what you build, and hear about the next Graph Hacks first.

── more in #ai-agents 4 stories · sorted by recency
── more on @falkordb 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/your-ai-agent-is-gue…] indexed:0 read:10min 2026-11-16 · —