Skip to content

ADR-0002: AI Provider Abstraction and Subscription-First Authentication

  • Status: Accepted
  • Date: 2026-11-27

Context

Documentation generation uses Gemini-backed reasoning, while TangoMovementLabs is operated by an independent developer who prefers using an existing Google AI subscription locally without introducing unnecessary API billing or requiring live AI credentials in CI.

Verified official capabilities (as of 2026-11-27):

  • Google Antigravity Python SDK (google-antigravity): Installed via PyPI (Agent, LocalAgentConfig, CapabilitiesConfig). By default, omitting write CapabilitiesConfig runs agents in read-only mode. Supports Express Mode (api_key) and Vertex ADC (project, location), and leverages the local Antigravity runtime.
  • Google Antigravity CLI (agy v1.5.18): Supports personal Google Account OAuth (with Google AI Pro / Ultra quotas) and non-interactive print mode (agy --print --output-format json --disable-slash-commands [--json-schema ...] [--model ...]). Note: agy requires writable access to ~/.gemini/antigravity-cli, so interactive browser OAuth must be completed outside restricted sandboxes or CI runners.
  • Gemini API (google-genai): Supports structured Pydantic JSON outputs (response_mime_type="application/json", response_schema=...) via GEMINI_API_KEY, billed per token.

Decision

  1. Define an AIProvider Protocol (analyse(prompt, context) -> AnalysisResult and generate(request) -> GenerationResult).
  2. Implement four providers behind a factory:
  3. AntigravitySDKProvider (antigravity-sdk, primary)
  4. AntigravityCLIProvider (antigravity-cli, local fallback using authenticated agy)
  5. GeminiAPIProvider (gemini-api, explicit opt-in only via allow_paid_api=True + GEMINI_API_KEY)
  6. MockAIProvider (mock, deterministic offline provider for tests and CI)
  7. Never silently fall back to a billable API. Attempting gemini-api without explicit opt-in raises PaidAPIOptInError.
  8. Local-first AI generation, CI validation/publishing: AI generation runs locally under the maintainer's authenticated Google account and commits reviewed Markdown/JSON into Documentation, while GitHub Actions runs deterministic validation, MkDocs HTML builds, and publishing using MockAIProvider for tests.

Consequences

  • CI remains 100% free of live AI credentials and API costs.
  • Unattended cloud AI generation can be opted into explicitly in the future without changing the generation pipeline.