Skip to content

About

See what breaks before you change code: a Relate call graph for AI coding agents

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

triage-graph — find the right fix by following connections

An AI support agent stops guessing: it walks a Relate graph of past tickets, symptoms, root causes and fixes, then recommends the exact resolution.

Tests License: MIT

Live demo (no install): https://abdullahsaami.github.io/triage-graph/


Use case

Support teams and AI support agents answer new tickets by searching text. Text search fails when the customer describes the same problem with different words, or when one symptom has several root causes. The answer is not in any one ticket — it is in the connections between tickets, symptoms, causes, fixes and runbooks.

triage-graph stores a support history as a Relate graph and answers:

  1. Triage — given a free-text ticket, which root causes are most likely, with what confidence?
  2. Fix — which fix is verified, current (not superseded), and documented in which runbook?
  3. Similar tickets — which past tickets share a symptom, cause, product or component?
  4. Gaps — which tickets are still unresolved, which symptoms have no verified fix, which fixes are outdated?

Who benefits: support agents, on-call engineers, and AI agents that resolve tickets without access to a live LLM or paid API. No customer data is used — the bundled dataset is entirely fictional.

Example:

$ python -m triage_graph triage "webhook retries and duplicate events"

Query: webhook retries and duplicate events
Matched: webhook retries, duplicate notifications

Cause: idempotency key missing  (6 tickets, confidence 50%)
  Fix: Enable idempotency keys on retries
  Verified: yes  |  successes: 10  |  team: Billing Team

Cause: webhook signature mismatch  (6 tickets, confidence 50%)
  Fix: Reload webhook signing secret
  Verified: yes  |  successes: 12  |  team: Integrations Team

Recommendation: idempotency key missing -> Enable idempotency keys on retries
  Runbook: Payment retry policy (Idempotency)

How it uses Relate

  • Mode: single file (graph/support.rl), committed to this repository.

  • Why this mode: the graph is the product. One .rl file is portable, inspectable by judges with the Relate CLI, safe to open read-only for agents, and needs no server, signup or deployment. Relate is embedded, so the whole tool runs locally.

  • What the graph models:

    Node Meaning
    Ticket one support ticket: title, body, severity, status, tier, channel, created
    Product, Component the product and component the ticket is about
    Symptom normalized symptom, e.g. login loop
    Cause diagnosed root cause, e.g. expired session cookie
    Fix resolution steps, verified flag, effective date, success count
    Doc runbook that documents a fix
    Team team that usually handles a cause
    Edge Meaning
    Ticket -[:REPORTS]-> Symptom reported symptom
    Ticket -[:DIAGNOSED_AS]-> Cause diagnosed cause
    Ticket -[:RESOLVED_BY]-> Fix applied fix
    Ticket -[:ABOUT]-> Product, -[:IN_COMPONENT]-> Component, -[:ROUTED_TO]-> Team routing context
    Ticket -[:DUPLICATE_OF]-> Ticket duplicate tickets
    Symptom -[:INDICATES]-> Cause inferred only when 2+ tickets agree
    Cause -[:HANDLED_BY]-> Team inferred only when 2+ resolved tickets agree
    Fix -[:FIXES]-> Cause, -[:DOCUMENTED_IN]-> Doc resolution knowledge
    Fix -[:SUPERSEDES]-> Fix a newer fix replaces an older one

Relate does the real work: variable-length and multi-hop Cypher walks, uniqueness constraints and MERGE for idempotent rebuilds, read-only opens, and MCP access. Runtime uses only the Python standard library; the documented Relate CLI is driven through subprocess.

Setup and run

Prerequisites: Python 3.10+ and Relate 1.5+. Tested with Python 3.14 and Relate 1.5.0. No API key is needed.

Windows (PowerShell):

irm https://relatedb.ai/install.ps1 | iex        # install Relate once
python -m pip install pytest                      # only for tests
.\scripts\setup.ps1                               # builds graph/support.rl
python -m triage_graph triage "login loop" -d graph/support.rl
.\scripts\demo.ps1                                # opens the web explorer

macOS / Linux:

curl -sSfL https://relatedb.ai/install.sh | bash
python3 -m pip install pytest
sh scripts/setup.sh
python3 -m triage_graph triage "login loop" -d graph/support.rl
sh scripts/demo.sh

Shortcuts:

  • scripts/setup.* — install dependencies and build the committed graph.
  • scripts/demo.* — open the local browser explorer at http://localhost:8765.
  • mcp/test_client.py — smoke-test the named-tool MCP server.

Where the data lives

The persistent store is committed at graph/support.rl (68 tickets, 12 symptoms, 11 causes, 12 fixes, 11 docs, 4 teams). It was built from data/tickets.json by python -m triage_graph build. Inspect it directly:

relate --database graph/support.rl --read-only --mode table \
  "MATCH (t:Ticket)-[:REPORTS]->(s:Symptom) RETURN s.name, count(*) AS n ORDER BY n DESC LIMIT 5"

docs/graph.json is a JSON snapshot exported from the same store for the static demo. Regenerate it with python scripts/export_graph.py.

What to look at (in order)

  1. Static demo — https://abdullahsaami.github.io/triage-graph/ : click a symptom, see the cause → fix → runbook path.
  2. Live explorer — scripts/demo.ps1 / scripts/demo.sh : the same interface querying the .rl store live.
  3. CLI — the six commands below.
  4. MCP — named tools for an agent, plus generic read_cypher via Relate.
  5. Tests — 28 tests: dataset integrity, graph derivation, idempotent loading, query semantics, CLI and MCP.

CLI

python -m triage_graph build   [--dataset FILE] [--db graph/support.rl] [--json]
python -m triage_graph triage  "free text" [--limit N] [--db ...] [--json]
python -m triage_graph similar T-1001 [--limit N] [--db ...] [--json]
python -m triage_graph fix     "cause name" [--limit N] [--db ...] [--json]
python -m triage_graph gaps    [--db ...] [--json]
python -m triage_graph stats   [--db ...] [--json]
python -m triage_graph ticket  T-1001 [--db ...] [--json]

-d is an alias for --db. All query commands open the store read-only.

MCP for agents

python -m mcp.server --db graph/support.rl starts a small stdio JSON-RPC server with named tools: triage_ticket, find_similar, list_fixes, coverage_gaps, graph_stats, get_ticket. Host configs and four copy-paste Cypher recipes are in mcp/README.md. Relate itself can also serve the same store generically:

relate serve --mcp stdio --database graph/support.rl --read-only

Architecture

data/tickets.json      fictional, deterministic support history
scripts/               dataset generator, export graph, setup/demo shortcuts
triage_graph/
  dataset.py           JSON -> graph, with two-ticket rule for inferred links
  model.py             Node / Edge / Graph dataclasses
  load.py              Relate loader: constraints, MERGE, idempotent rebuild
  query.py             triage / similar / fix / gaps / ticket / stats
  relate.py            CLI subprocess wrapper
  __main__.py          CLI
web/                   live browser explorer (stdlib server + vanilla JS)
docs/                  GitHub Pages static demo + graph.json
graph/support.rl       committed persistent Relate store
mcp/                   named-tool MCP server + Cypher recipes + client
tests/                 28 pytest tests

Tests

python -m pip install pytest
python -m pytest -q

Tests needing Relate skip with a clear reason when it is absent; CI installs Relate and runs the full suite on every push.

Relate capabilities used

Relate CLI · single-file .rl store · embedded Cypher engine · variable-length and multi-hop path queries · uniqueness constraints and MERGE · read-only opens · relate serve --mcp (read_cypher, get_schema), plus a thin named-tool MCP server. No LLM, no paid service, no API key.

AI-assisted development disclosure

This project was built with AI coding assistance. All generated code was reviewed, executed and validated by the team; the committed graph and test results come from running the tool itself.

Limitations

The dataset is synthetic, so recommendations demonstrate the graph method, not real-world accuracy. Matching is deterministic token overlap over symptom/cause names — no embeddings or LLM. INDICATES and HANDLED_BY links require two agreeing tickets. SUPERSEDES reflects the dataset's explicit ordering. The tool reads its own dataset; it does not connect to a live helpdesk.

License

MIT — see LICENSE. Relate is Apache-2.0; this project only uses its CLI and documented surfaces.

About

See what breaks before you change code: a Relate call graph for AI coding agents

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages