Services
Platform APIs
Neural Engine API

🧠 Neural Engine API

Last Updated: March 23, 2026 12:00 UTC

LIVELLO 2 service for domain-agnostic multi-factor ranking, composite scoring, and entity screening.

📍 Location

  • Service: services/api_neural_engine/
  • Pure core: vitruvyan_core/core/neural_engine/

🚪 Base URL / Port

  • Config default: PORT=8003 (services/api_neural_engine/config.py)
  • Docker external port: 9003 (see infrastructure/docker/docker-compose.yml)

🧭 Endpoints (implemented)

Defined in services/api_neural_engine/api/routes.py:

MethodPathDescription
POST/screenmulti-factor entity screening and composite ranking
POST/ranksingle-factor ranking across an entity universe
GET/healthdependency-aware health (Postgres, Redis, embedding)
GET/metricsPrometheus text metrics
GET/profileslist available scoring profiles
GET/service info (version, domain, uptime)

🧾 Request/Response models

Pydantic models live in services/api_neural_engine/schemas/api_models.py.

POST /screen

Request (ScreenRequest):

{
  "profile": "finance_v1",
  "entity_ids": ["AAPL", "MSFT", "GOOGL"],
  "filters": {},
  "top_k": 10,
  "stratification_mode": "global",
  "risk_tolerance": "medium",
  "mode": "discovery"
}

Key fields:

  • profile — scoring profile name (maps to IScoringStrategy implementation)
  • stratification_modeglobal | stratified | composite
  • risk_tolerancelow | medium | high

Response (ScreenResponse): ranked list of entities with composite scores, z-scores per factor, rank, percentile, and explainability audit trail.

POST /rank

Request (RankRequest):

  • feature_name: str — single KPI to rank by
  • entity_ids: List[str]
  • top_k: int
  • higher_is_better: bool (default true)

GET /health

Returns dependency-aware status:

  • Postgres reachability
  • Redis/StreamBus reachability
  • Embedding service reachability
  • Overall: healthy | degraded | critical

⚙️ Env vars (service-level)

Loaded in services/api_neural_engine/config.py:

VariableDefaultDescription
PORT8003HTTP listen port
LOG_LEVELINFOlogging verbosity
DOMAINmockdomain plugin to load (finance, mock, …)
NE_CACHE_TTL_SECONDS30scoring result cache TTL
NE_STRATIFICATION_MODEglobaldefault stratification (global/stratified/composite)
CORS_ORIGINShttp://localhost:3000comma-separated CORS origins

🔗 Integration with Cognitive Modules

The Neural Engine is the scoring step in the Cognitive Pipeline. It integrates with:

ModuleIntegration
Veritas Enginevalidate signal quality before scoring; skip entities where quality_score < threshold or regime = crisis
Horizon EngineNE composite scores can serve as KPI inputs to Horizon's design space (e.g. return = NE_score)
Babel GardensNE consumes normalized entity features published by Babel Gardens via StreamBus

🐳 Docker

docker compose build neural_engine
docker compose up -d neural_engine

🔗 Related