Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sdarionicolas-boop/AgroIA-RAG/llms.txt

Use this file to discover all available pages before exploring further.

The /health endpoint provides a lightweight liveness check for the AgroIA API server. It returns the current configuration values for the database and embedding model, along with a fixed API version string. No authentication is required, making it suitable for Docker health checks, load balancer probes, monitoring dashboards, and CI/CD pipelines.

GET /health

Returns the server status and key configuration fields read from src/utils/config.py at startup.

Response

status
string
Always "ok" when the server is running and accepting requests.
db
string
The configured PostgreSQL database name, sourced from the DB_NAME environment variable (default: agri_db).
embedding_model
string
The Ollama embedding model in use, sourced from EMBEDDING_MODEL (default: nomic-embed-text).
version
string
The API version. Always "2.0" for the current release.

Example

curl http://localhost:8000/health
Response
{
  "status": "ok",
  "db": "agri_db",
  "embedding_model": "nomic-embed-text",
  "version": "2.0"
}

Use cases

Docker health check

Add a HEALTHCHECK instruction to your Dockerfile or docker-compose.yml to have Docker restart the container if the API becomes unresponsive:
docker-compose.yml
services:
  agroia-api:
    image: agroia-api:latest
    ports:
      - "8000:8000"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

CI/CD pipeline readiness check

Wait for the API to become available before running integration tests:
shell
until curl -sf http://localhost:8000/health; do
  echo "Waiting for AgroIA API..."
  sleep 2
done
echo "API is ready."

Monitoring and alerting

Use the version and embedding_model fields to detect unexpected configuration drift in a running deployment:
Python
import requests

data = requests.get("http://localhost:8000/health").json()
assert data["version"] == "2.0", f"Unexpected API version: {data['version']}"
assert data["embedding_model"] == "nomic-embed-text", "Wrong embedding model configured"
Pair the /health endpoint with GET /lotes to build a fuller readiness probe — a healthy API that can also query the database confirms both the server and PostgreSQL connection are operational.

Build docs developers (and LLMs) love