E-01 Data Classification
Brick E: Data, RAG, context, memory. French version: E-01-data-classification
1. Role and responsibilities
Assigns a classification level (public, internal, confidential, restricted, secret) to texts and media using Presidio and business rules.
- Entity detection (PII, financial, health)
- Per tenant business rules (regex, dictionaries)
- Return the maximum classification and findings
2. Position in the architecture and interactions
- Callers: DLP Gateway, RAG ingestion, Media (F), Context Manager.
- Execution path: Synchronous.
- Every interaction goes through the Control Plane API v1 (
/v1) behind the API Gateway (D-14).
3. Open source component and developed part
- Open source: Microsoft Presidio
- Developed: Rule engine and level mapping.
- External integration through an adapter
eai/integrations/<system>.pywith an in-process fallback when the URL is not configured.
4. Data model
Tables (schema eai, tenant_id RLS):
eai.dlp_rules
Common columns: id uuid, tenant_id uuid NOT NULL, created_at, updated_at; RLS policy current_setting('app.tenant_id', true)::uuid.
5. Contract
- Applied contract: context-contract
- JSON Schema:
contracts/v1/context-contract.schema.json - Key fields:
classification_max, segments[].classification - Validation:
POST /v1/contracts/{name}/validate; manifest apply:POST /v1/manifests/apply.
6. API endpoints
POST /v1/privacy/classify
Request POST /v1/privacy/classify:
{
"text": "Client Jean Dupont, IBAN FR76 3000 6000 0112 3456 7890 189"
}
Response:
{
"classification": "confidential",
"findings": [
{
"type": "PERSON",
"start": 7,
"end": 18,
"score": 0.85
},
{
"type": "IBAN_CODE",
"start": 25,
"end": 58,
"score": 1.0
}
]
}
7. SDK examples
Python:
from enterprise_ai import EnterpriseAI
client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_xxx_secret")
res = client.privacy.classify(text="...")
TypeScript:
import { EnterpriseAI } from "@enterprise-ai/sdk";
const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY });
const res = await client.privacy.classify({ text: "..." });
Java:
EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.build();
JsonNode res = client.privacy().classify(Map.of("text", "Contact jane.doe@example.com", "language", "en"));
Go:
c, _ := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")))
res, _ := c.Privacy.Classify(ctx, map[string]any{"text": "..."})
8. Configuration
- Environment variables:
EAI_PRESIDIO_URL,EAI_DATABASE_URL - Helm values keys:
controlPlane.config.EAI_PRESIDIO_URL
9. Security controls
- Analysed text is not logged
- Every request carries the tenant resolved from the credential; PostgreSQL RLS
- Every mutation and policy decision writes a hash-chained audit event
10. Observability
- Prometheus metrics:
eai_classify_total{level},eai_classify_latency_seconds - Traces: OpenTelemetry spans with GenAI semantic conventions (
gen_ai.operation.name,gen_ai.agent.id,gen_ai.tool.name), attributeseai.tenant_id,eai.run_id,traceparentpropagation. - Audit actions:
11. FinOps units
- Analysis calls, processed characters.
- Emitted as Usage Event (
POST /v1/finops/usage) with tenant, project, agent and run.
12. Failure modes and resilience
- Presidio down: built-in regex fallback, level at least confidential
- Normalized errors (error envelope, message_i18n en/fr)
13. Standalone adoption (client of a client)
- enterprise_ai.privacy + Control Plane (+ Presidio).
- SDK:
enterprise_ai.privacy / dlp / knowledge_bases / memory / retention / lineage - Minimal deployment: Helm chart with
controlPlane.enabled=trueand PostgreSQL; disabled external components use their in-process fallback.
14. Acceptance tests
- IBAN detected -> confidential
- Neutral text -> public or internal
- Cross-tenant access refused
- Error returned in fr with Accept-Language: fr
Governed RAG (kit L4)
restricted and secret chunks are sealed at rest (Tink envelope) and only opened when the context is built, after the ACL and clearance filters.