|
| 1 | += AI-Driven Supply Chain Insights with Knowledge Graphs |
| 2 | +include::_graphacademy_llm.adoc[] |
| 3 | +:slug: supplier-graph |
| 4 | +:author: Pramod Borkar |
| 5 | +:category: demos |
| 6 | +:tags: |
| 7 | +:neo4j-versions: 5.x |
| 8 | +:page-pagination: |
| 9 | +:page-product: supplier-graph |
| 10 | + |
| 11 | +== Why This Matters for Analysts |
| 12 | + |
| 13 | +Modern supply chains are dynamic, global, and deeply interconnected. Traditional analytics often require manual data wrangling or deep technical skills—and struggle to keep pace with business questions. |
| 14 | + |
| 15 | +Generative AI agents transform this by enabling *natural language queries* that return *real-time, contextual answers* — even across highly complex graph data. |
| 16 | + |
| 17 | +=== Key Benefits |
| 18 | + |
| 19 | +* *Faster Decision-Making*: Get answers in seconds, not days. |
| 20 | +* *Natural Language Queries*: No need to write Cypher or SQL—just ask your question. |
| 21 | +* *Deeper Insights*: Uncover hidden relationships and risks in your supply chain graph. |
| 22 | +* *Scalable & Secure*: The toolset runs as a secure, scalable service (on Google Cloud Run), accessible from anywhere. |
| 23 | + |
| 24 | + |
| 25 | +[NOTE] |
| 26 | +==== |
| 27 | +*Knowledge graphs* naturally represent real-world supply chain relationships — making it easy to trace product flows, analyze risks, and identify vulnerabilities. |
| 28 | +
|
| 29 | +When combined with *AI agents*, they enable *question-to-query translation*, so analysts can simply ask questions — and receive *precise answers without writing any code*. |
| 30 | +==== |
| 31 | + |
| 32 | +== Solution Overview |
| 33 | + |
| 34 | +This solution combines: |
| 35 | + |
| 36 | +* A Generative AI Agent (e.g., Google Gemini or OpenAI) |
| 37 | +* A Remote Toolset Service (powered by the Model Context Protocol, or MCP) |
| 38 | +* A Neo4j Graph Database (containing your supply chain data) |
| 39 | + |
| 40 | +The AI agent interprets questions, discovers the relevant remote tool, and routes the query to the appropriate service. |
| 41 | + Each tool encapsulates a specific Cypher query(s), returning clean, business-friendly insights — without needing a data engineer. |
| 42 | + |
| 43 | +=== Query Flow: Architecture |
| 44 | + |
| 45 | + |
| 46 | +image::mcptoolset-neo4j.png[align="center", width=800] |
| 47 | + |
| 48 | + |
| 49 | +=== How It Works |
| 50 | + |
| 51 | +. *Tool Discovery*: |
| 52 | + The agent queries the `/tools` endpoint to discover available supply chain analysis tools (e.g., trace product flow, find top suppliers). |
| 53 | + |
| 54 | +. *Natural Language Query*: |
| 55 | + The analyst asks a question in plain English (e.g., "Check for cyclic movements in the shipping of Nabitegrpultide?"). |
| 56 | + |
| 57 | +. *Tool Invocation*: |
| 58 | + The agent selects the right tool, calls the remote API, and passes any required parameters. |
| 59 | + |
| 60 | +. *Insight Delivery*: |
| 61 | + The agent returns a clear, actionable answer—no technical expertise required. |
| 62 | + |
| 63 | + |
| 64 | +==== Example Use Cases |
| 65 | + |
| 66 | +* *Trace full product lineage* — From supplier to distributor, track how a raw material flows through multiple manufacturing and packaging stages. |
| 67 | +* *Identify single points of failure* — Detect raw materials or APIs that rely on only one supplier, increasing operational risk. |
| 68 | +* *Rank supplier criticality* — Find which suppliers support the widest range of products, making them most critical to business continuity. |
| 69 | +* *Simulate disruption scenarios* — Explore the downstream impact if a specific supplier, location, or material becomes unavailable. |
| 70 | +* *Analyze regional risk exposure* — Understand how supplier or distributor concentration varies by country or market. |
| 71 | +* *Detect circular logistics* — Spot unintended cycles or inefficiencies in your supply chain graph. |
| 72 | + |
| 73 | + |
| 74 | +== Getting Started: Build and Deploy Your Own AI Toolset |
| 75 | + |
| 76 | +=== 1. Prerequisites |
| 77 | + |
| 78 | +* Python 3.8+ |
| 79 | +* Access to a Neo4j database with supply chain data |
| 80 | +* Cloud account (or any container platform, e.g., Google Cloud Run) for deployment |
| 81 | +* Generative AI API key (e.g., Google Gemini or OpenAI) |
| 82 | + |
| 83 | +=== 2. Clone the Repository |
| 84 | + |
| 85 | +[source, bash] |
| 86 | +---- |
| 87 | +git clone https://github.com/neo4j-product-examples/demo-supply_chain.git |
| 88 | +cd demo-supply_chain |
| 89 | +---- |
| 90 | + |
| 91 | +Set environment variables for Neo4j connection in Cloud Run. |
| 92 | + |
| 93 | +=== 3. Explore the Notebook |
| 94 | + |
| 95 | +[source, bash] |
| 96 | +---- |
| 97 | +cd walkthrough |
| 98 | +# Open the notebooks in Jupyter or Colab |
| 99 | +---- |
| 100 | + |
| 101 | +link:https://github.com/neo4j-product-examples/demo-supply_chain/blob/main/walkthrough/02_Walkthrough_with_AI_Agent.ipynb[02_Walkthrough_with_AI_Agent.ipynb] — Interact with the AI agent and watch it translate natural questions into graph queries. |
| 102 | + |
| 103 | +=== 4. Customize and deploy your own Toolset Service |
| 104 | + |
| 105 | +* Add new tools to `supply_chain_toolset.py` for custom queries. |
| 106 | +* Update the agent prompt or tool descriptions to match your business language. |
| 107 | + |
| 108 | + |
| 109 | +[source, bash] |
| 110 | +---- |
| 111 | +cd supply_chain_toolset |
| 112 | +# Build and push the container (edit push.sh for your GCP project) |
| 113 | +./push.sh |
| 114 | +---- |
| 115 | + |
| 116 | + |
| 117 | +== Resources |
| 118 | + |
| 119 | +Here are some helpful resources and ideas to guide your next steps: |
| 120 | + |
| 121 | +* link:https://neo4j.com/blog/developer/model-context-protocol/[About the Model Context Protocol (MCP)] |
| 122 | +* link:https://neo4j.com/blog/developer/knowledge-graphs-claude-neo4j-mcp[Building Knowledge Graphs With Claude and Neo4j] |
0 commit comments