Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ SupplyShield

Multi-agent supply chain disruption detection and automated recovery
Built on Elastic Agent Builder Β· Hackathon 2026

Elastic Python MCP License GitHub


🚨 The Problem

Supply chain disruptions are accelerating in both frequency and cost:

Metric Data Source
Annual global cost $184 billion J.S. Held Global Risk Report, 2025
Orgs disrupted in past year 80% (↑ from 73%) BCI Supply Chain Resilience Report, 2024
SC leaders facing resilience challenges 90% McKinsey Global SC Survey, 2024
Orgs adequately prepared only 29% Gartner Future of Supply Chain, 2025
Supply chains that can't respond in 24h 83% Kinaxis, 2024 (n=1,800)
Average manual response time 5 days Kinaxis, 2024

The core failure is speed. Shipment data lives in one system, order books in another, supplier records in a third. Coordinating across them manually takes days that supply chains don't have.

SupplyShield cuts 5 days to under 3 minutes.


πŸ’‘ The Solution

A multi-agent system on Elastic Agent Builder with two coordinated agents:

Agent Role
πŸ€– SupplyShield Orchestrator Detects anomalies, assesses revenue impact, ranks alternatives, executes recovery
πŸ”­ News Scout Specialist sub-agent for external intelligence via MCP β€” classifies disruption signal as CONFIRMED / UNCERTAIN / UNCONFIRMED

The key principle: internal signals (shipment data) and external signals (news) are independently verified by separate agents before a recovery decision is made.


πŸ—οΈ Architecture

SupplyShield Orchestrator  (Kibana Agent Builder)
  β”œβ”€β”€ detect_shipment_anomalies      [ES|QL + LOOKUP JOINs]
  β”œβ”€β”€ assess_revenue_impact          [ES|QL + LOOKUP JOINs]
  β”œβ”€β”€ find_alternative_suppliers     [ES|QL + weighted scoring]
  └── news_scout_query [MCP] ───────► News Scout MCP Server
                                          └── query_disruption_news
                                              └── sc_news  [hybrid: kNN + BM25]

⚑ Tech Stack

| Layer | Technology | | -------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------- | | Agent Platform | Elastic | | Search & Storage | Elasticsearch | | Query Language | ![ES | QL](https://img.shields.io/badge/ES | QL-LOOKUP_JOINs-FEB600?logo=elastic&logoColor=black) | | A2A Protocol | MCP | | MCP Framework | FastMCP | | Workflow Engine | Elastic Workflows | | Language | Python | | Tunnel | ngrok |


🎬 Demo Flow

Based on synthetic data (14 pre-planted Shenzhen delays, seed=42):

User: "Shenzhen port congestion β€” any affected shipments?"
  β”‚
  β”œβ”€ [Tool 1] detect_shipment_anomalies
  β”‚     └─► 14 delayed shipments, avg 143h delay, 3 suppliers
  β”‚
  β”œβ”€ [MCP]   news_scout_query β†’ News Scout β†’ sc_news hybrid search
  β”‚     └─► CONFIRMED: 3 high-severity articles, sentiment βˆ’0.77
  β”‚
  β”œβ”€ [Tool 2] assess_revenue_impact (Shenzhen Microtech)
  β”‚     └─► $4.2M at risk, 31 orders, 8 customers, due in 8 days
  β”‚
  β”œβ”€ [Tool 3] find_alternative_suppliers (microcontrollers, excl. East Asia)
  β”‚     └─► #1 Viet Components Vietnam: score 84.2, 18d lead, +10% cost
  β”‚
  └─ [Workflow] supply_chain_recovery (after explicit user confirmation)
        └─► PO-2026-0042 created + immutable audit log entry

Total: < 3 minutes vs. 5-day industry average


πŸ“Š Data Model

Index Purpose Mode Docs
sc_shipments Shipments with delay tracking + geo standard 214
sc_suppliers Supplier catalog with scoring lookup 33
sc_news News articles with 384-dim embeddings standard 18
sc_orders Customer orders standard 300
sc_products Product catalog lookup 10
sc_actions_log Agent action audit trail standard β€”
sc_purchase_orders Recovery POs standard β€”

⚠️ lookup mode on sc_suppliers and sc_products is required for ES|QL LOOKUP JOIN. Without it, joins silently return no results.


πŸš€ Quick Start

# 1. Set credentials
export ES_ENDPOINT="https://your-deployment.es.us-east-1.aws.elastic.cloud"
export ES_API_KEY="your-api-key"
export KIBANA_URL="https://your-deployment.kb.us-east-1.aws.elastic.cloud"
export NGROK_AUTH_TOKEN="your-ngrok-token"   # required for live MCP wiring

# 2. Install dependencies
pip install elasticsearch faker mcp flask pyngrok

# 3. Set up data and agents
python scripts/setup_indices.py       # Create 7 indices with mappings
python data/generate_data.py          # Synthetic supply chain data
python data/load_data.py              # Load 575 docs into Elasticsearch
python scripts/create_tools.py        # Create 4 Agent Builder tools
python scripts/create_agent.py        # Create SupplyShield Orchestrator
python scripts/create_news_scout.py   # Create News Scout sub-agent

# 4. Start MCP server + wire A2A connector (one command)
python scripts/start_mcp_with_ngrok.py

See docs/setup_guide.md for manual Kibana setup.


πŸ“ Project Structure

supplyshield/
β”œβ”€β”€ agents/
β”‚   β”œβ”€β”€ supplyshield_agent.md       # Orchestrator system prompt + config
β”‚   └── news_scout_agent.md         # News Scout config + MCP wiring docs
β”œβ”€β”€ tools/
β”‚   β”œβ”€β”€ detect_shipment_anomalies.md
β”‚   β”œβ”€β”€ assess_revenue_impact.md
β”‚   β”œβ”€β”€ find_alternative_suppliers.md
β”‚   └── search_disruption_news.md
β”œβ”€β”€ workflows/
β”‚   └── supply_chain_recovery.md    # Elastic Workflow definition
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ generate_data.py            # Synthetic data (Faker, seed=42)
β”‚   β”œβ”€β”€ load_data.py                # Bulk load via elasticsearch-py
β”‚   └── sample_data/                # Generated JSON
β”œβ”€β”€ mappings/
β”‚   └── index_mappings.md           # All 7 index mappings documented
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ setup_indices.py
β”‚   β”œβ”€β”€ create_tools.py
β”‚   β”œβ”€β”€ create_agent.py
β”‚   β”œβ”€β”€ create_news_scout.py
β”‚   β”œβ”€β”€ news_scout_mcp_server.py    # FastMCP server (query_disruption_news)
β”‚   β”œβ”€β”€ start_mcp_with_ngrok.py     # One-command: server + tunnel + wire Kibana
β”‚   └── wire_mcp_connector.py
└── docs/
    β”œβ”€β”€ architecture.md
    β”œβ”€β”€ setup_guide.md
    β”œβ”€β”€ submission_description.md
    β”œβ”€β”€ architecture_main.mermaid
    β”œβ”€β”€ architecture_sequence.mermaid
    β”œβ”€β”€ architecture_dataflow.mermaid
    └── architecture_usecase.mermaid

πŸ”‘ Key Design Decisions

ES|QL Parameterized Queries as LLM Guardrails

The LLM fills values ("SUP-SZ-001", 24) but never query structure. Using ?param syntax keeps tool behavior fixed and auditable β€” the agent cannot alter what a query does, only what it queries for.

Separation of Read and Write

All reads go through tools. All writes go through a deterministic Elastic Workflow requiring explicit user confirmation. The agent cannot modify data through a malformed query argument, and every action has an immutable log entry.

Hybrid Search on News

sc_news combines 384-dimension dense vector embeddings (cosine similarity) with BM25 keyword matching, following Elastic's recommended hybrid search pattern for balancing semantic and lexical relevance.

MCP for Agent-to-Agent Delegation

The Orchestrator calls the News Scout via the Model Context Protocol β€” an open standard for agent communication. This keeps the agents independently deployable and testable, with a clean interface boundary.


πŸ“š References


πŸ“„ License

Apache 2.0 β€” see LICENSE.


Built for the Elastic Agent Builder Hackathon Β· January–February 2026

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages