ARCHITECTURE // TOOLING_BLUEPRINT

Antigravity Tooling & Architecture

Practical blueprints for pairing OpenCLI and Scrapfly with Google Antigravity autonomous coding agents.

Tool Selection Decision Flow
  1. Personal / Authenticated Action: (Twitter/X, Reddit, Xiaohongshu, Bilibili, Jira, Notion) → opencli <site>
  2. Interactive DOM / Local Staging: (Form filling, local dev server localhost:3000, Cursor IDE) → opencli browser
  3. Hostile / Protected URL: (Cloudflare Turnstile, DataDome, Akamai) → scrapfly (asp=true)
  4. Mass Multi-Agent Batch Crawl: (10+ URLs deep research) → scrapfly cloud proxies
1. Hybrid MCP Configuration

Register both in ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "opencli": {
      "command": "opencli",
      "args": ["mcp", "serve"],
      "env": {
        "OPENCLI_WINDOW": "background"
      }
    },
    "scrapfly": {
      "command": "npx",
      "args": ["-y", "@scrapfly/mcp-server"],
      "env": {
        "SCRAPFLY_API_KEY": "YOUR_SCRAPFLY_KEY"
      }
    }
  }
}
2. Agent Routing Directives

Place in AGENTS.md or project instructions:

# Web Tool Routing Strategy

- Use `opencli` for authenticated actions,
  social posting, and local UI interaction.
  Always format outputs with `-f json` or `-f md`.

- Use `scrapfly` when scraping public sites
  protected by anti-bot systems (Cloudflare,
  DataDome, Akamai) or batch URL crawls.
  Always pass `format: "markdown"`.

3. Latency & Token Efficiency Benchmarks

Integration Mode Latency / Turn Token Footprint Target Use Case
OpenCLI Adapters 100ms – 500ms ~200 – 800 Instant structured data from 100+ platforms
OpenCLI Browser State 1.0s – 3.0s ~500 – 1,500 Multi-turn interactive UI navigation
Scrapfly ASP + Markdown 2.0s – 5.0s ~1,000 – 3,000 One-shot bypass of hostile web pages
Raw HTML (Anti-Pattern) Variable 50k – 200k ❌ Causes reasoning degradation & truncation