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 writeCapabilitiesConfigruns agents in read-only mode. Supports Express Mode (api_key) and Vertex ADC (project,location), and leverages the local Antigravity runtime. - Google Antigravity CLI (
agyv1.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:agyrequires 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=...) viaGEMINI_API_KEY, billed per token.
Decision¶
- Define an
AIProviderProtocol(analyse(prompt, context) -> AnalysisResultandgenerate(request) -> GenerationResult). - Implement four providers behind a factory:
AntigravitySDKProvider(antigravity-sdk, primary)AntigravityCLIProvider(antigravity-cli, local fallback using authenticatedagy)GeminiAPIProvider(gemini-api, explicit opt-in only viaallow_paid_api=True+GEMINI_API_KEY)MockAIProvider(mock, deterministic offline provider for tests and CI)- Never silently fall back to a billable API. Attempting
gemini-apiwithout explicit opt-in raisesPaidAPIOptInError. - 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 usingMockAIProviderfor 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.