--- id: ET-LTI-001 title: "Arquitectura de Integracion LLM-Trading" type: "Specification" status: "Backlog" rf_parent: "RF-LTI-001" epic: OQI-010 version: "1.0" created_date: "2026-02-06" --- # ET-LTI-001: Arquitectura de Integracion LLM-Trading ## Diagrama ``` LLM Agent (OQI-007) | +-- Tool Registry (OQI-010) | +-- Market Tools -> data-service (port 3084) | +-- ML Tools -> ml-engine (port 3083) | +-- Trading Tools -> backend/trading (port 3081) | +-- Portfolio Tools -> backend/portfolio (port 3081) | +-- Prompt Engine (OQI-010) | +-- Template Selector | +-- Context Injector | +-- Safety Filter | +-- Guardrails (OQI-010) +-- Confirmation Handler +-- Risk Validator +-- Audit Logger ``` ## Flujo de Ejecucion 1. Usuario envia mensaje al LLM 2. LLM selecciona template apropiado basado en intent 3. LLM invoca tools necesarios 4. Safety guardrails validan cada tool call 5. Resultados formateados y retornados al usuario 6. Si es operacion de trading: confirmacion antes de ejecutar ## Tecnologias - Tool framework: function calling del LLM (Ollama/Claude) - Backend: Express.js endpoints existentes - Comunicacion: HTTP entre servicios