> For the complete documentation index, see [llms.txt](https://public-intelligence.gitbook.io/taina-agente-ia-ogtic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://public-intelligence.gitbook.io/taina-agente-ia-ogtic/operacion-y-monitoreo/monitoreo.md).

# Monitoreo y health checks

Taína proporciona mecanismos para supervisar la salud del agente y los servicios asociados.

## Health Checks del Backend

El agente incluye una herramienta `health_check` en `src/tools.py` que puede invocarse para verificar el estado de todos los componentes:

```bash
docker compose exec taina-backend python3 -c "
import asyncio
from src.tools import health_check

async def check():
    status = await health_check()
    for key, value in status.items():
        print(f'  {key}: {value}')

asyncio.run(check())
"
```

## Supervisión con Docker

```bash
# Ver estado del contenedor
docker compose ps

# Ver logs en tiempo real
docker compose logs -f taina-backend

# Ver consumo de recursos
docker stats taina_backend
```

## Logs operativos

Los logs están disponibles tanto dentro del contenedor como en el host gracias al volumen montado:

```bash
# Desde el host
tail -f backend/logs/application.log
tail -f backend/logs/errors.log

# Desde Docker
docker compose logs --tail=100 taina-backend
```

## Métricas clave

* **Uso de memoria**: Configurable mediante `MAX_MEMORY_MB` y `WARNING_MEMORY_MB` en el `.env`.
* **Estado de ChromaDB**: Tamaño de las colecciones y reporte de salud:

```bash
docker compose exec taina-backend python3 -c "
from src.vectors.chroma_vector import verify_chroma_health
print(verify_chroma_health('storage/chroma', 'servicios'))
print(verify_chroma_health('storage/chroma_qa', 'servicios_qa'))
"
```

* **Cobertura de QA**: Revisar `data/QA/manifest.json`.
* **Servicios externos**: Usa `health_check()` para confirmar STT, TTS y LLM; revisa latencia y tokens restantes en los logs.

## Alertas y recuperación

* Habilita `ENABLE_AUTO_RECOVERY=true` en producción para reinicios controlados cuando fallen STT/LLM/TTS.
* El programa `MAX_RETRY_ATTEMPTS` en el `.env` controla cuántos reintentos se hacen antes de desistir.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://public-intelligence.gitbook.io/taina-agente-ia-ogtic/operacion-y-monitoreo/monitoreo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
