kb-agent-serve (FastMCP server process)
User question
(via MCP tool call)
→
Security Gate
check_confidential() · acknowledge_gate()
🚫 blocked — token required
allowed
Orchestrator
format intent · keyword route · LLM classify
Doc question
Data question
↓
↓
Domain sub-agent × N
parallel asyncio.gather · domain_rules.py
Tiered context path
KB_CONTEXT_STORE (default on) · MANIFEST → INDEX → digests
falls back to README-first → RAG
→
Vector index
(ChromaDB)
Reranker (optional)
cross-encoder · KB_RERANKER_ENABLED
📊
Data Analyst agent
inspector.py · planner.py · engine.py
Schema Inspector
Query Engine
Raw files
.xlsx .csv .json .pdf .docx
.pptx .png .jpg .gif .webp …
↓
↓
Aggregator
aggregate() · merge answers · source citations
Answer + Reasoning
↓
Answer + [Source: …] citations
markdown response returned to MCP client
Long answers compressed via 3-tier pipeline before memory storage:
Tier 1 LLM summarisation (skipped if KB_MEMORY_COMPRESS=false or passthrough) → Tier 2 sentence truncation → Tier 3 hard truncation
↓ ↓ ↓ ↓ (async write-out)
session_memory/
add_turn_sync() — every ask()
show_memory() · resume_session()
list_sessions() · clear_memory()
audit.jsonl
audit.log_turn() — every ask()
read_audit() · audit_summary()
feedback.jsonl
feedback.record() — rate_answer()
writeback.py
update_document() → KB_ROOT files
20 registered MCP tools
Knowledge Base
ask list_domains reindex clear_memory show_memory
Security Gate
check_confidential acknowledge_gate
Data Analyst
analyze_file suggest_questions query_data refine_query compare_data
Session & Feedback
domain_status read_audit audit_summary resume_session list_sessions rate_answer update_document kb_context
Legend
Primary data flow
Security gate path
Async write-out (audit / memory / feedback)
Security Gate — blocks ask() until one-time token is acknowledged
Aggregator — synthesises multi-domain answers + inline [Source: …] citations
* Raw files include images (.png .jpg .gif .webp) — text extracted via OCR when KB_OCR_ENABLED=true
Made with IBM Bob