# Observabilidad

> Rastrea cada llamada a LLM con Langfuse y supervisa todo el sistema con Grafana y OpenTelemetry: dos pilas opcionales junto al panel integrado.

Dos stacks opcionales muestran lo que está haciendo PentAGI: Langfuse para las llamadas al modelo, y Grafana con OpenTelemetry para el resto del sistema.

El **Dashboard** propio de PentAGI ya grafica [flows](https://pentagi.com/es/docs/glossary/#flow), [tool calls](https://pentagi.com/es/docs/glossary/#tool-call), tokens y costes a lo largo del tiempo; los siguientes stacks añaden trazas completas y métricas del sistema.

![El dashboard integrado](https://pentagi.com/images/product/dashboard.webp)

## [Langfuse](https://pentagi.com/es/docs/configuration/observability/#langfuse)

Langfuse registra prompts, completados, tokens y costes por [agent](https://pentagi.com/es/docs/glossary/#agent).

```bash
LANGFUSE_BASE_URL=http://langfuse-web:3000
LANGFUSE_PROJECT_ID=same_as_LANGFUSE_INIT_PROJECT_ID
LANGFUSE_PUBLIC_KEY=same_as_LANGFUSE_INIT_PROJECT_PUBLIC_KEY
LANGFUSE_SECRET_KEY=same_as_LANGFUSE_INIT_PROJECT_SECRET_KEY
```

Configura las credenciales de Langfuse en `.env` (`LANGFUSE_POSTGRES_*`, `LANGFUSE_CLICKHOUSE_*`, `LANGFUSE_REDIS_AUTH`, `LANGFUSE_SALT`, `LANGFUSE_ENCRYPTION_KEY`, `LANGFUSE_NEXTAUTH_SECRET`, `LANGFUSE_INIT_USER_*` y las claves del proyecto), luego inicia el stack:

```bash
curl -O https://raw.githubusercontent.com/vxcontrol/pentagi/main/docker-compose-langfuse.yml
docker compose -f docker-compose.yml -f docker-compose-langfuse.yml up -d
```

La interfaz de Langfuse está disponible en `http://localhost:4000`.

## [Grafana y OpenTelemetry](https://pentagi.com/es/docs/configuration/observability/#grafana-and-opentelemetry)

```bash
OTEL_HOST=otelcol:8148
```

```bash
git clone --depth 1 https://github.com/vxcontrol/pentagi.git pentagi-src
cp -r pentagi-src/observability ./observability
rm -rf pentagi-src
curl -O https://raw.githubusercontent.com/vxcontrol/pentagi/main/docker-compose-observability.yml
docker compose -f docker-compose.yml -f docker-compose-observability.yml up -d
```

Grafana está disponible en `http://localhost:3000`, con métricas en VictoriaMetrics, trazas en Jaeger y logs en Loki.

> [!NOTE]
> Para enviar la telemetría de Langfuse al mismo stack, configura `LANGFUSE_OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4318`.

## [Todo junto](https://pentagi.com/es/docs/configuration/observability/#everything-together)

```bash
git clone --depth 1 https://github.com/vxcontrol/pentagi.git pentagi-src
cp -r pentagi-src/examples/graphiti ./graphiti
cp -r pentagi-src/examples/neo4j ./neo4j
rm -rf pentagi-src
curl -O https://raw.githubusercontent.com/vxcontrol/pentagi/main/docker-compose-graphiti.yml
docker compose \
  -f docker-compose.yml \
  -f docker-compose-langfuse.yml \
  -f docker-compose-graphiti.yml \
  -f docker-compose-observability.yml \
  up -d
```