Logo Dual Graph Router

Dual Graph Router

Cộng đồng
AnthonyAlcaraz
dual-graph-router

Route an incoming request to the VERTICAL knowledge graph (what the agent knows — a single relationship/temporal traversal), the HORIZONTAL workflow graph (how the agent acts — a decomposed multi-step process), BOTH (a workflow whose nodes query the knowledge graph and write results back), or UNROUTABLE (neither fits — ask for clarification). Implements the central dual-graph distinction of Agentic GraphRAG Ch2 and the "Where the Two Graphs Meet" bidirectional interaction. Use when an agent receives an on-call request and must decide whether it is a knowledge lookup or a process. NOT for building the workflow DAG itself (that is harness-node-splitter / investigation-dag-planner), NOT for choosing a graph data model (that is graph-model-selector), NOT for requests where the structure is already fixed by a hardcoded pipeline.

Tổng quan

Nhà phát hànhAnthonyAlcaraz
Kho mãagentic-graph-rag-skills
Tên kỹ năngdual-graph-router
Sao
29
Bản fork
9
Tệp đi kèm
3
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được AnthonyAlcaraz công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Dual Graph Router trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/architecture/dual-graph-router
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills.git /tmp/agentic-graph-rag-skills
mkdir -p .claude/skills
cp -r /tmp/agentic-graph-rag-skills/skills/architecture/dual-graph-router .claude/skills/dual-graph-router
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Dual Graph Router trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Dual Graph Router ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Dual Graph Router với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Dual-Graph Router

Overview

The dual-graph architecture is the central framework of the book. An agentic system needs two complementary structures: a representation of what it KNOWS (the vertical knowledge graph — entities, relationships, constraints) and a representation of how it ACTS (the horizontal workflow graph — reasoning, execution, decision, and validation nodes with explicit dependencies). "The vertical graph is the map. The horizontal graph is the route."

This skill routes a request to the right structure before any work begins:

  • vertical — a knowledge question answerable by one traversal. "Which services depend on payments-db and were deployed in the last 24 hours?" is a single MATCH over DEPENDS_ON edges with a temporal filter (Example 2-1), not a workflow.
  • horizontal — a process the agent must carry out. "Classify the alert, plan remediation, decide whether to roll back" decomposes into focused nodes.
  • both — the central case from "Where the Two Graphs Meet." "Diagnose why checkout is slow and correlate the evidence" is a horizontal workflow whose reasoning/retrieval nodes traverse the vertical graph for the dependency chain, then write the result back (a new CAUSED_BY edge). The architecture's value emerges at this intersection.
  • unroutable — no signal for either graph; ask rather than guess (the chapter's ambiguous-situation discipline).

When to Use

  • An agent receives an on-call request and must decide: lookup or process?
  • You are wiring the top of a harness and need a deterministic first-hop router
  • Auditing a set of historical requests to see how the workload splits across the two graphs

Phrases that should invoke this skill: "route this request", "is this a lookup or an action", "vertical or horizontal graph", "which graph handles this", "where the two graphs meet".

When NOT to Use

  • Building the workflow DAG. Once a request routes to horizontal/both, decomposition into constrained nodes is harness-node-splitter; scheduling the nodes into parallel phases is investigation-dag-planner (Ch5).
  • Choosing a graph data model. Property graph vs RDF vs hypergraph is graph-model-selector (Ch3), a different decision.
  • Fixed pipelines. If the request always runs the same hardcoded steps, there is nothing to route.
  • Retrieving the actual facts. This picks the STRUCTURE; it does not run the traversal or execute the workflow.

Process

StepInputActionOutputVerification
1request stringlib.route(request)RouteDecision (target, scores, matched signals, rationale, node_hint)target in {vertical, horizontal, both, unroutable}; scores are non-negative ints
2a both decisionlib.explain_meeting_point(decision)dict of workflow_role / knowledge_role / forward_flow / backward_flownon-empty only when target == both; empty otherwise
3list of requestslib.route_batch(requests)list of RouteDecisionone decision per request; order preserved
4routed target(your harness) builds the vertical traversal, the horizontal DAG, or bothstructure ready to executeboth builds a workflow whose retrieval node queries the vertical graph

Rationalizations

Agent rationalizationDocumented rebuttal
"Everything is a workflow — just always build a horizontal graph."A single relationship/temporal lookup ("which services depend on payments-db") is one traversal. Wrapping it in a workflow adds nodes, latency, and failure surface for a question the vertical graph answers directly (Example 2-1).
"Everything is knowledge — just query the graph.""A knowledge graph alone does not tell the agent how to use that knowledge." A diagnosis is a process: classify, retrieve, correlate, report. That is the horizontal graph's job.
"The both case is just horizontal — the KG query is only a detail."The chapter names the intersection as where the architecture earns its keep. Collapsing both into horizontal loses the bidirectional contract: the workflow drives, the knowledge graph supplies AND receives (the CAUSED_BY write-back). Model it as both.
"If unsure, pick the more powerful option (horizontal)."An unroutable request is ambiguous by construction. Guessing horizontal builds a workflow with no defined goal. The chapter's discipline is to resolve ambiguity by asking, not by defaulting.
"Keyword scoring is too crude for real routing."Correct for production — swap _score for an LLM/intent classifier at the documented seam. The routing CONTRACT (vertical/horizontal/both/unroutable + rationale) is stable; the spike validates the contract, not the classifier.

Red Flags

  • Every request routes to horizontal. The vertical-signal set is not matching real lookups — you are wrapping single traversals in workflows.
  • Every request routes to both. The signal sets overlap too much, or the requests genuinely always mix — verify against a labeled sample before trusting.
  • unroutable on a clearly-actionable request. The horizontal-signal set is too narrow for your domain vocabulary; extend it (or swap to a classifier).
  • A both decision with an empty meeting-point explanation. The explain_meeting_point contract is broken; the bidirectional interaction is the whole point of both.
  • CLI --help exits non-zero. SKILL.md / CLI mismatch; the multi-harness invariant is broken.

Non-Negotiable Verification

  1. Run the benchmark battery.

    python cli.py benchmark

    All labeled sample requests must route to their expected target, and the four invariant checks (mixed→both, both→meeting-point, non-both→no meeting-point, empty→unroutable) must pass.

  2. Inspect a both route visually.

    python cli.py route "diagnose why checkout depends on payments-db and is slow"

    Confirm the target is BOTH and the printed meeting-point names both the forward (workflow→knowledge query) and backward (knowledge←workflow write) flows.

  3. JSON output round-trips.

    python cli.py route "list services that use stripe-python" --json | python -c "import json,sys; json.load(sys.stdin)"

    No exception means the CLI is harness-portable.

  4. Batch the labeled sample.

    python cli.py batch

    Confirm the ok column is all ok — every labeled request matches its route.

Security Posture

  • Prompt injection. The request string is untrusted input. This skill only tokenizes it against a fixed signal vocabulary and returns a routing label; it never executes the request, calls a tool, or interpolates the string into a shell/graph query. A malicious request can at most mis-route itself.
  • Data exfiltration. No network calls, no file writes outside the bundled sample-requests.json (read-only). The --json output goes to stdout; the caller owns downstream piping.
  • Privilege escalation. No shell invocation, no eval, no dynamic import. The route label carries no capability — the harness that consumes it is responsible for authorizing the actual traversal or workflow (see capability-authorization-gate, Ch3).

Source Attribution

Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien), Chapter 2 — Agentic Graph Architecture Foundations:

  • "The Dual-Graph Architecture" — vertical knowledge graph vs horizontal workflow graph; "the vertical graph is the map, the horizontal graph is the route."
  • "The Vertical Knowledge Graph" — nodes/edges/properties, DEPENDS_ON traversal, temporal since metadata (Example 2-1, Example 2-2).
  • "The Horizontal Workflow Graph" — reasoning/execution/decision/validation nodes (Example 2-3).
  • "Where the Two Graphs Meet" — the workflow drives, the knowledge graph supplies and receives; the value emerges at the intersection.

This is the Inversion-pattern router at the top of the dual-graph harness: downstream skills (harness-node-splitter, investigation-dag-planner) build the structures it routes to.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Dual Graph Router làm được gì?

Route an incoming request to the VERTICAL knowledge graph (what the agent knows — a single relationship/temporal traversal), the HORIZONTAL workflow graph (how the agent acts — a decomposed multi-step process), BOTH (a workflow whose nodes query the knowledge graph and write results back), or UNROUTABLE (neither fits — ask for clarification). Implements the central dual-graph distinction of Agentic GraphRAG Ch2 and the "Where the Two Graphs Meet" bidirectional interaction. Use when an agent receives an on-call request and must decide whether it is a knowledge lookup or a process. NOT for bu...

Vì sao nên dùng Dual Graph Router trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Dual Graph Router là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Dual Graph Router trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/AnthonyAlcaraz/agentic-graph-rag-skills/tree/main/skills/architecture/dual-graph-router. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Dual Graph Router?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Dual Graph Router với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Dual Graph Router với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Dual Graph Router có miễn phí không?

Có. Kỹ năng này được AnthonyAlcaraz phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇