Skip to content
All projects
Case study · engineering

KBSE: Knowledge Base Search Engine

Legal answers that cite their sources — 94% validated accuracy.

94% Answer Accuracy

Context & Constraints

Corporate tax and legal teams operate on massive, fragmented knowledge bases: legislation, regulatory guidance, internal memos, and technical opinions spread across dozens of documents.

Traditional keyword search fails in this context — it lacks semantic understanding, provides no reasoning trace, and offers poor traceability. The core challenge was retrieving accurate legal-tax answers while preserving explainability and source traceability — not just 'what is the answer,' but where it comes from and why it is valid.

Architecture

KBSE is a web-based multi-agent semantic search engine built with Python and CrewAI. Instead of relying on a single LLM response, the system decomposes reasoning into specialized stages: semantic retrieval from a vector store, cross-document consolidation, validation/auditing of retrieved excerpts, and final answer generation with explicit citations. Every response includes the synthesized answer and the exact legal text used as evidence.

KBSE — multi-agent semantic search with citation validation

My Role

Led the solution architecture and reasoning design. Implemented the multi-agent workflow using CrewAI (retrieval, consolidation, validation, redaction) and designed the RAG pipeline with citation validation logic.

Results & Validation

Multi-agent reasoning decomposition (Retrieval -> Audit)

Vector-based RAG with explicit citation trails

Sequential validation to eliminate hallucinations

Achieved 94% accuracy in validation tests. In regulated sectors, trust is not about magic; it is about traceability. By validating every output against source documents, we turned 'hallucination risks' into an auditable compliance asset.

Stack

PythonCrewAIRAGAzure

Building something where reliability matters?

I design, ship and operate systems like this one.

Let's talk

Building GenAI where reliability matters? Let's talk.

leonardo@leonardosa.pro

Madrid, Spain · from August 2026 · English / French / Portuguese / Spanish

© 2026 Leonardo Costa de Sá