Vitruvyan
Docs
System CorePlatform APIs

Vitruvyan Docs

๐Ÿง  Neural Engine API

Last Updated: March 23, 2026 12:00 UTC

๐Ÿ“ 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_mode โ€” global | stratified | composite
  • risk_tolerance โ€” low | 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