Skip to content

shaileshdev4/connectorforge

Repository files navigation

ConnectorForge

Paste an API docs URL + one sentence of intent → get a deployed Fivetran connector syncing into BigQuery.

ConnectorForge is an AI agent pipeline built for the Google Cloud Rapid Agent Hackathon (Fivetran track). It reads API documentation, probes the live API, generates a Fivetran Connector SDK package, self-heals with fivetran debug, deploys via fivetran deploy, and verifies rows in BigQuery.

Built with Google ADK, Gemini 2.5 on Vertex AI, and the Fivetran Connector SDK + MCP.


Demo

Quick start preset What it does
Open-Meteo Daily historical weather for a city (date-range parallel arrays)
Frankfurter EUR/USD exchange rates over a date range
USGS Earthquakes GeoJSON earthquake catalog with magnitude filter
REST Countries Country metadata with offset pagination

Live UI: paste docs URL → describe what you want → watch 4 phases stream in real time.


Architecture

Browser (Next.js)
    │  SSE  GET /api/forge/stream
    ▼
FastAPI + ADK SequentialAgent
    │
    ├─ 1. DocInterpreter     docs URL → connector_plan (JSON)
    ├─ 2. SpecResolver       plan + intent → blueprint + configuration
    ├─ 3. CodeGenerator      probe API → schema → Jinja connector.py
    ├─ 4. DebugLoop          fivetran debug → Gemini Pro patches (≤3 tries)
    └─ 5. Deployer           fivetran deploy → sync → BigQuery sample

Fivetran surfaces (by design)

Step Tool
Generate connector code Connector SDK (connector.py)
Test locally fivetran debug CLI
Deploy fivetran deploy CLI
Trigger / poll sync Fivetran MCP (stdio) + REST
Prove data landed BigQuery sample query

MCP does not create connectors — only the SDK CLI deploys them.


Tech stack

  • Agent: Google ADK SequentialAgent, deterministic phase callbacks
  • LLM: Gemini 2.5 Flash (extract/schema) + Pro (debug patches) on Vertex AI
  • Optional: Groq fallback for rate-limit relief (LLM_PROVIDER=groq)
  • Backend: Python 3.11, FastAPI, Uvicorn, Pydantic structured outputs
  • Frontend: Next.js 14, TypeScript, SSE live pipeline UI
  • Infra: Fivetran Connector SDK CLI, uvx fivetran-mcp, BigQuery client

Quick start (local)

Prerequisites

  • Python 3.11+
  • uv (pip install uv)
  • Node.js 18+
  • Fivetran account (API key + secret + BigQuery destination)
  • GCP project with Vertex AI and BigQuery enabled
  • Service account JSON with Vertex AI User + BigQuery Data Viewer

1. Configure

git clone https://github.com/shaileshdev4/connectorforge
cd connectorforge

cp .env.example .env
# Edit .env — see table below

# Place service account at infra/sa-key.json (or set GOOGLE_APPLICATION_CREDENTIALS)
Variable Description
FIVETRAN_API_KEY / FIVETRAN_API_SECRET From Fivetran account settings
FIVETRAN_DESTINATION_ID Your BigQuery destination name in Fivetran
GCP_PROJECT_ID GCP project for Vertex + BigQuery
GOOGLE_APPLICATION_CREDENTIALS Path to service account JSON (default ./infra/sa-key.json)
GCP_LOCATION global recommended (Vertex global endpoint)

2. Backend

make setup          # pip install -e .[dev] + fivetran-connector-sdk
make dev            # http://localhost:8080

Verify: curl http://localhost:8080/healthz{"status":"ok"}

3. Frontend

cd frontend
npm install
npm run dev         # http://localhost:3000

Open http://localhost:3000/forge, pick a preset, click Forge Connector.

4. Tests

.venv/Scripts/python.exe -m pytest tests/ -q    # Windows
# pytest tests/ -q                               # macOS/Linux

Deploy live

Component Platform Config
Backend Railway or Cloud Run Use root Dockerfile; set all .env vars; expose /healthz
Frontend Vercel Root directory: frontend

Vercel env (required):

NEXT_PUBLIC_BACKEND_URL=https://your-railway-app.up.railway.app

The UI opens SSE directly against the backend URL so the forge stream is not buffered by Vercel.

Railway: mount GCP credentials as GCP_SERVICE_ACCOUNT_JSON and write to infra/sa-key.json at container start. Allocate 2 GB+ RAM; forge runs can take 5–15 minutes.


Project layout

agent/
  main.py              FastAPI entrypoint
  orchestrator.py      ADK pipeline
  forge_stream.py      SSE streaming
  pipeline/            V2: negotiate, probe, schema, assemble, debug
  sub_agents/          Phase wrappers
  templates/           Jinja connector templates
  tools/               Fivetran CLI, BigQuery, deploy helpers
frontend/              Next.js UI
tests/                 pytest suite (52 tests)
scripts/               E2E and isolation runners
connector_workspace/   Generated connectors (runtime, gitignored)

How codegen works (summary)

  1. Structured doc extraction — 3 Flash calls with Pydantic schemas, no free-text parsing.
  2. Live API negotiation — HTTP probe with retries; LLM fixes params on 4xx.
  3. Multi-probe — happy / empty / null responses feed schema extraction.
  4. Pattern-based Jinjadate_range, offset, cursor, geojson, single_shot templates.
  5. Known-API normalization — Open-Meteo, Frankfurter, REST Countries, USGS get URL/auth/pagination fixes without per-API hardcoding in templates.
  6. Self-heal — Gemini Pro rewrites full connector.py from stderr + real API response.

Limitations (honest)

  • REST JSON APIs only — no GraphQL/SOAP.
  • No authentication on forge endpoints (demo/hackathon).
  • Arbitrary unknown APIs may fail; demo presets cover the quick-start APIs.
  • Reused Fivetran connection names keep historical BigQuery rows.
  • Forge runs are long (minutes) and need a backend with generous timeouts.

License

MIT — see LICENSE.

About

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors