How Avanti is built

Six AI-engineering patterns in one deployable Next.js 15 app, running on Groq's open-weight reasoning models on a zero-cost stack. This page separates what is verified live from what is only unit-tested or deferred. No inflated claims.

Proactive goals and next steps

Set a goal and the planner proposes concrete next steps; nothing executes until you approve it, and every run streams a full plan-act-reflect step log. Three honestly labeled mechanisms: model-proposed steps, rule-based follow-up nudges, and a scheduled cron brief.

Open goals

Plan - act - reflect agent

Typed tool registry (zod schemas), a planner emitting validated JSON steps, replayable step logs, a max-step budget and recovery from malformed planner output. The URL-fetch tool is disabled in this preview - see security notes below.

Run the agent

Hybrid RAG with citations

BM25 fused with a local hashing-vector index via reciprocal rank fusion. Every generated claim must cite a source chunk inline, or the answer says it does not know.

Query the docs

Guardrailed text-to-SQL

The model proposes SQL; a strict parser-level allowlist decides what runs: single read-only SELECT, allowlisted tables, columns, functions and operators, enforced LIMIT. Rebuilt after review found the first guard bypassable.

Ask the sample DB

Self-evaluation

A built-in dataset with deterministic scorers. Runs persist in managed Postgres, so a model change that hurts the average gets flagged as a regression.

See eval runs

Proactive daily brief

A Vercel Cron job (07:00 UTC) generates a morning brief from workspace state: what matters, three next actions, one risk. Each brief is stamped with its true origin and generation time.

Read the brief

Verification status (27 October 2026)

  • Verified live on this deployment: hybrid RAG end-to-end over the persisted demo doc, the SQL guard (blocks non-SELECT and subqueries with 422, answers a real SELECT), chat on openai/gpt-oss-120b with a semantic-cache hit on a repeat prompt, the agent loop (calculator: 125 x 48 = 6000), the eval suite (6/6 passing, avg 1.0 on gpt-oss-20b), and daily-brief generation written to Postgres and read back across requests and a redeploy.
  • Cron verified organically: the 07:00 UTC job fired at 07:32 UTC on 27 Oct 2026 via Vercel's scheduler (vercel-cron/1.0, HTTP 200), writing an origin: "cron" brief row.
  • Workspace persistence: docs, eval runs, briefs and per-session goals live in a managed Postgres (Neon free tier) through a least-privilege role scoped to the avanti_* tables, verified via the grants matrix. The app fails closed when the scoped credential is missing, and preview deployments cannot touch production rows.
  • Unit-tested: 89 automated tests across SQL guard, SSRF guard, guardrails, cache, retrieval, evals, agent loop, rate limiting and goal validation.
  • Deferred with reasons: LoRA fine-tuning (a complete pipeline script and a small-model CPU proof notebook are included but never executed - hosted runtimes on the owner's account consume paid compute units, which is an owner decision) and Mistral models (retired from Groq in 2025; gpt-oss is the replacement line).

Public demo boundaries

  • No sign-up and no access code. Anyone can chat, run the agent, set goals, query the sample docs and SQL data, and read briefs and eval results.
  • Generation is bounded: per-visitor daily quotas per feature plus a global daily request cap, backed by a durable Postgres counter table (the app fails closed with 503 if the counter store is unreachable). The global cap counts requests, not individual model calls - one agent run can make up to ~6 model calls internally. The Groq free tier is the hard stop behind it - no billing is attached, so no spend is possible. Quotas reset at midnight UTC.
  • Workspace writes (document ingestion/deletion, eval execution, on-demand brief regeneration, cache clearing) are disabled in the public demo and return 403 for everyone - there is no privileged owner path. All stored content is fabricated demo data - no private user data is ingested.
  • The agent's fetch_url tool is disabled: its egress guard validates DNS before fetch while the connection re-resolves it - a DNS-rebinding race that needs validated-IP pinning to close. The guard code and its tests are kept; the tool stays off rather than claimed safe.
  • Input guardrails are heuristic pattern checks that pass the built-in attack test cases; they are not general LLM protection.

Engineering notes

  • Reasoning runs on Groq: openai/gpt-oss-120b (default) and openai/gpt-oss-20b (fast planner) - current production model IDs per Groq's docs.
  • Embeddings are a local deterministic hashing vectoriser, not a hosted embedding API - a deliberate zero-cost choice with a documented swap point in src/lib/vector.ts.
  • The semantic cache is keyed on session + model + full conversation context; approximate matching only runs for standalone single-turn questions, so answers never cross conversations.
  • Animations are pure CSS and disabled entirely under prefers-reduced-motion.