Compliance RAG Skill
Purpose
Search and retrieve regulatory guidance, exculpatory evidence, and compliance documentation using Qdrant vector database.
When to Use
- •Finding payment authorizations and contracts (alibi evidence)
- •Consulting EU AI Act and AML regulations
- •Searching adverse media for entity reputation
- •Retrieving payment grids and approved vendor lists
Available Tools
1. search_alibi
Search for legitimate business explanations in embedded documents.
python
from backend.tools.tools_docs import search_alibi
result = search_alibi.invoke({
"query": "payment authorization for consulting services",
"entity_name": "Shell Company Alpha"
})
# Returns:
# {
# "has_alibi": True,
# "evidence": [
# {"content": "MSA dated 2024-01-15...", "source": "contracts/msa.pdf", "relevance_score": 0.92}
# ],
# "exculpatory_strength": 0.85
# }
2. consult_regulation
Retrieve relevant regulatory guidance for compliance context.
python
from backend.tools.tools_docs import consult_regulation
result = consult_regulation.invoke({
"query": "transparency requirements for high-risk AI systems",
"regulation_type": "eu_ai_act"
})
# Returns:
# {
# "regulation": "EU AI Act",
# "relevant_articles": ["Article 13", "Article 14"],
# "guidance": "High-risk AI systems must provide..."
# }
3. search_payment_justification
Find authorized payment grids, contracts, and invoices.
python
from backend.tools.tools_docs import search_payment_justification
result = search_payment_justification.invoke({
"entity_name": "Muller & Sons KG"
})
# Returns:
# {
# "has_valid_authorization": True,
# "justifications": [
# {"content": "Payment Grid Q1 2026...", "source": "payment_grids/2026.xlsx"}
# ]
# }
4. search_adverse_media
Check for negative news, sanctions, or reputation issues.
python
from backend.tools.tools_docs import search_adverse_media
result = search_adverse_media.invoke({
"entity_name": "Offshore Holdings LLC"
})
# Returns:
# {
# "adverse_media_risk": "high" | "medium" | "low",
# "findings": [
# {"content": "Company linked to Panama Papers...", "source": "news/2024.json"}
# ]
# }
Qdrant Collections
fis_evidence
Primary collection for all document embeddings.
| Field | Type | Description |
|---|---|---|
| content | text | Document chunk content |
| source | keyword | Source file path |
| doc_type | keyword | contracts, regulations, payment_grids, adverse_media |
| entity_refs | keyword[] | Referenced entity names |
| embedding | vector[768] | Gemini text embedding |
Document Types
- •Contracts/MSAs - Master Service Agreements, vendor contracts
- •Payment Grids - Approved payment schedules, amounts, frequencies
- •Regulations - EU AI Act, AML directives, local regulations
- •Annual Reports - Company financials, ownership structures
- •Adverse Media - News articles, sanctions announcements
Embedding Model
Uses Google Gemini text-embedding-004 for semantic search:
python
from langchain_google_genai import GoogleGenerativeAIEmbeddings
embeddings = GoogleGenerativeAIEmbeddings(
model="models/text-embedding-004",
google_api_key=settings.google_api_key
)
Integration with Skeptic Agent
The Skeptic agent uses these tools to build a defense:
python
from backend.agents.skeptic import skeptic_agent # Skeptic will automatically: # 1. Search for payment justifications # 2. Look for alibi evidence # 3. Consult regulations # 4. Check adverse media (to confirm no issues)
Risk Reduction Scoring
| Evidence Found | Risk Reduction |
|---|---|
| Valid payment authorization | -0.3 |
| Alibi evidence (MSA/contract) | -0.2 |
| Within peer group norms | -0.15 |
| No adverse media | -0.1 |
| Complete entity profile | -0.1 |
EU AI Act Article 13 Compliance
The Skeptic cites regulations to ensure transparency:
python
# Example regulatory citation in verdict
{
"eu_ai_act_compliance": {
"article_13_satisfied": True,
"transparency_statement": "Generated by FIS Swarm AI system",
"human_oversight_required": True
}
}
Error Handling
python
result = search_alibi.invoke({"query": "test", "entity_name": "Unknown"})
if not result.get("has_alibi"):
# No exculpatory evidence found - not necessarily an error
pass
if "error" in result:
# Actual Qdrant error
print(f"Search failed: {result['error']}")
Prerequisites
- •Qdrant running on
QDRANT_URL(default: http://localhost:6333) - •
QDRANT_API_KEYfor authentication - •Documents pre-loaded via
backend/loaders/load_vectors.py