Multi-agent knowledge decay auditor — Built for the Elasticsearch Agent Builder Hackathon
Enterprise knowledge bases decay silently. Documentation becomes outdated, contradictory, or concentrated in the hands of a few experts — creating operational risk that's invisible until something breaks.
PassedAI detects four types of knowledge decay automatically:
| Decay Type | What It Catches | Business Impact |
|---|---|---|
| 🕐 Stale Docs | Documents not updated in 6-24+ months | Employees following outdated procedures |
| ⚔️ Contradictions | Two docs giving opposite guidance on the same topic | Confusion, compliance risk |
| ❓ Knowledge Gaps | Repeated employee questions with no matching documentation | Tribal knowledge, onboarding friction |
| 👤 Expert Risk | Single owners of critical documentation | Bus factor = 1, knowledge silos |
flowchart TB
subgraph UI["🖥️ Demo UI (Flask :5050)"]
Dashboard["Real-time Dashboard"]
end
subgraph Orchestrator["🐍 Python Orchestrator"]
RunAudit["run_audit.py"]
A2AClient["a2a_client.py"]
end
subgraph AgentBuilder["⚡ Elastic Agent Builder"]
subgraph Detect["PassedAI-Detect"]
D1["staleness_scorer"]
D2["gap_detector"]
D3["contradiction_finder"]
D4["expert_risk_finder"]
end
subgraph Act["PassedAI-Act"]
A1["notify_owner"]
A2["create_gap_task"]
end
end
subgraph ES["🔍 Elasticsearch Serverless"]
Docs["passed_documents<br/>200 docs + ELSER v2"]
Questions["passed_questions<br/>60 questions + ELSER v2"]
AuditLog["passed_audit_log"]
Notifications["passed_notifications"]
end
Reports["📄 Audit Reports<br/>data/reports/*.md"]
Dashboard -->|REST API| ES
RunAudit -->|A2A| Detect
Detect -->|ESQL| ES
Detect -->|Findings| RunAudit
RunAudit -->|A2A| Act
Act -->|Actions| Notifications
RunAudit --> Reports
sequenceDiagram
participant O as Orchestrator
participant D as Detect Agent
participant A as Act Agent
participant ES as Elasticsearch
O->>D: A2A message/send audit prompt
D->>ES: ESQL staleness_scorer
D->>ES: ESQL gap_detector
D->>ES: ESQL contradiction_finder
D->>ES: ESQL expert_risk_finder
D-->>O: Structured findings STALE/GAP/CONTRADICTION/EXPERT_RISK
O->>A: A2A message/send (findings)
A-->>O: ACTION lines + ACTION_SUMMARY
O->>O: Write markdown report
| Feature | Implementation | Purpose |
|---|---|---|
| ES|QL Tools | 4 custom queries in Agent Builder | Detect stale docs, gaps, contradictions, expert risk |
| A2A Protocol | JSON-RPC 2.0 message/send |
Orchestrator ↔ Agent communication |
| ELSER v2 | semantic_text field type |
Semantic search for contradiction detection |
| Agent Builder | 2 agents with custom system prompts | Detect + Act multi-agent pattern |
| Serverless | Elastic Cloud Serverless | Zero-ops deployment |
Sample audit output from synthetic data:
╭────────────────────────────────────────────╮
│ PassedAI Audit │
│ Run ID: 0ec4c448 Window: 90d Top-N: 10 │
╰────────────────────────────────────────────╯
Detect Results
Category Count
─────────────────────────────────
Stale docs (score ≥ 70) 20
Knowledge gaps 1
Contradiction pairs 2
Expert risk owners 8
Dashboard Screenshot: The Flask UI at localhost:5050 shows real-time stats pulled from Elasticsearch.
PassedAI/
├── config/
│ ├── agent_prompts/ # System prompts for both agents
│ │ ├── detect_agent.md
│ │ └── act_agent.md
│ ├── esql/ # ES|QL tool queries
│ │ ├── staleness_scorer.esql
│ │ ├── gap_detector.esql
│ │ ├── contradiction_finder.esql
│ │ └── expert_risk_finder.esql
│ └── index_mappings/ # Elasticsearch index schemas
├── data/
│ ├── generated/ # Synthetic test data
│ └── reports/ # Audit output (markdown)
├── docs/
│ └── kibana_setup.md # Step-by-step Kibana configuration
├── orchestrator/
│ ├── a2a_client.py # A2A protocol client
│ └── run_audit.py # Main orchestrator script
├── scripts/
│ ├── generate_synthetic_data.py
│ └── ingest.py
├── ui/
│ ├── app.py # Flask dashboard
│ └── templates/index.html
├── .env.example
├── LICENSE (MIT)
├── README.md
└── requirements.txt
- Python 3.11+
- Elastic Cloud Serverless (free trial)
git clone https://github.com/N-45div/PassedAI.git
cd PassedAI
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env| Variable | Source |
|---|---|
ELASTIC_CLOUD_ID |
Elastic Cloud → Project → Manage → Cloud ID |
ELASTIC_API_KEY |
Elastic Cloud → API Keys → Create |
KIBANA_BASE_URL |
Derived from Cloud ID (see docs) |
KIBANA_API_KEY |
Kibana → Stack Management → API Keys |
PASSED_DETECT_AGENT_ID |
After creating agent in Kibana |
PASSED_ACT_AGENT_ID |
After creating agent in Kibana |
python scripts/generate_synthetic_data.py
python scripts/ingest.py --resetFollow docs/kibana_setup.md:
- Verify ELSER v2 is running
- Create 4 ES|QL tools
- Create PassedAI-Detect and PassedAI-Act agents
- Copy agent IDs to
.env
python orchestrator/run_audit.py --audit-window-days 90 --top-n-actions 10python ui/app.py
# Open http://localhost:5050The PassedAI-Detect agent runs 4 ES|QL queries in sequence:
- staleness_scorer — Finds docs with
staleness_score >= 70 - gap_detector — Finds unanswered questions (knowledge gaps)
- contradiction_finder — Semantic search for conflicting docs on same topic
- expert_risk_finder — Aggregates doc ownership to find concentration risk
The PassedAI-Act agent processes findings and outputs structured action logs:
ACTION | notify_owner | doc_id=abc123 | owner=alice@acme.io | issue=stale | score=100
ACTION | notify_owner | topic=data-retention | issue=contradiction | docs=doc1,doc2
The Python orchestrator (run_audit.py):
- Sends audit prompt to Detect agent via A2A
- Parses structured findings
- Sends findings to Act agent via A2A
- Writes markdown report to
data/reports/
-
A2A Protocol Discovery — Elastic Agent Builder uses
message/sendmethod withkind: "text"parts (nottype). Required debugging the JSON-RPC format. -
Serverless ES Restrictions — Index mappings can't include
number_of_shards/number_of_replicassettings. Had to remove these for Serverless compatibility. -
ELSER Inference Timeouts — Bulk ingestion with
semantic_textfields requires longer timeouts (120s) and smaller chunk sizes (10 docs) due to inference processing time.
MIT License — see LICENSE
Built with:
Built for the Elasticsearch Agent Builder Hackathon 🏆