By the end of this guide you will have a fully configured local environment for Innova AI Engine: all Python dependencies installed in an isolated virtual environment, environment variables validated byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vruizz22/innova-ai-engine/llms.txt
Use this file to discover all available pages before exploring further.
pydantic-settings, the shared infrastructure running via Docker, lint and type checks passing cleanly, the test suite green, and a local invocation of the nightly BKT calibration worker confirming the whole stack is wired correctly.
Prerequisites
Before you begin, make sure the following are available on your machine:- Python 3.11 — the version is pinned in
.python-version; other versions are not supported. - uv — the project’s package manager. Install it with:
- Docker — needed to run the shared backend infrastructure (Postgres, MongoDB, LocalStack) via
docker compose. - API keys — an Anthropic API key and a Google AI Studio (Gemini) key are required for any feature that calls a model. Workers that do not call external providers (e.g. the BKT/IRT cron jobs when the database is seeded) can be exercised without them.
Setup steps
Install dependencies
From the repository root, run:
uv reads pyproject.toml and uv.lock, creates a .venv directory automatically, and installs all runtime and development dependencies (including ruff, pyright, pytest, hypothesis, and moto). No separate pip install or virtualenv command is needed.Configure environment variables
Copy the example file and fill in your credentials:Open
Additional variables (SQS ARNs, S3 buckets, MongoDB URI, alert thresholds, SSM parameters) are documented in
.env in your editor. The three variables you must set to run any worker are:| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Claude API key — required for LLM classifier, solution generator, grader, exercise generator. |
GEMINI_API_KEY | Google AI Studio key — required for OCR worker and guide ingest. |
DATABASE_URL | Postgres connection string. For local dev, the backend’s docker compose exposes Postgres on port 5433: postgresql://postgres:innova_secret@localhost:5433/innova_dev_db |
.env.example with inline comments. They are all optional for local testing — workers that need them will fail fast with a clear pydantic-settings validation error if they are missing.In production,
DATABASE_URL must point to the Supabase session pooler on port :5432. The transaction pooler is incompatible with asyncpg’s prepared statements and will cause runtime errors.Start shared infrastructure
The engine shares a Postgres database and MongoDB instance with the backend. Start them from the backend repository:This brings up:
- Postgres on
localhost:5433— the primary database for all workers. - MongoDB on
localhost:27017— used for telemetry and audit logs. - LocalStack — a local AWS emulator for SQS and S3, useful when running integration tests with
motofixtures.
DATABASE_URL in your .env file will be reachable.Run lint
The project enforces zero
ruff issues on all source and test code:ruff is configured in pyproject.toml with rule sets E, F, I, N, UP, B, RUF, and T201 at a line length of 100. All issues must be resolved before opening a pull request — CI enforces this gate.Run type checks
The engine runs The
pyright in strict mode with zero errors required:pyright configuration in pyproject.toml targets src/ only (tests are excluded), uses typeCheckingMode = "strict", and requires Python 3.11. If you see type errors after adding a new adapter or domain function, resolve them before proceeding — the CI deploy workflow blocks on a non-zero pyright exit code.Run tests
smoke marker, so no live API keys are needed. The suite covers:- BKT/IRT math correctness (property tests with
hypothesisand parameter-recovery regression tests). - LLM classifier and graders (providers mocked; assertions on
cache_controlheaders and forcedtool_choice). - SQS/S3 integration flows (
motofixtures interceptingboto3calls). - Guide pipeline end-to-end (mocked Gemini and Claude adapters).
SQS and S3 workers can also be exercised with
moto fixtures directly without Docker. See the tests/ directory for examples of how @mock_sqs and @mock_s3 decorators are used to intercept boto3 calls in-process.Invoke a worker locally
Lambda handlers are plain Python callables — invoke them directly without SAM or a deployed function:The nightly BKT job reads all topics from Postgres, runs grid-search calibration over their attempt history, and writes updated For SQS-triggered workers, construct a minimal SQS event payload matching the shape the backend enqueues and pass it as the first argument. The
p_l0, p_transit, p_slip, and p_guess parameters back to the database. Because it is a cron-triggered handler, it accepts an empty event dict {} and a None context object — the same signature AWS Lambda uses when invoking it from an EventBridge schedule.You can invoke any other cron-based handler the same way:tests/ directory contains fixture examples for each worker.Verifying production health
Once deployed, thehealth Lambda exposes a liveness endpoint:
200 OK response confirms the container image is running and the handler is reachable.
Next steps
- Read the Architecture page to understand the full SQS event flow and the Clean Architecture layer breakdown.
- Browse the
src/pipeline/directory to see how each Lambda handler wires domain logic to adapters. - Check the deploy runbook at
../docs/DEPLOY_RUNBOOK.mdfor production deployment instructions, required GitHub Actions secrets, and the backend-first deploy constraint.