builtin Go · Two-way · TLS & guard verified

Connect Gmail to Your Local AI Agent With Hard Draft-Only Safety Guards

TagTag’s built-in Go Gmail connector polls new messages incrementally via users.history.list (with automatic HTTP 404 history rebuild) and enforces readonly, draft, or send limits inside Go’s AccessGuardSink—outside the LLM. Even if context compaction drops prompt rules, a draft-only Gmail connector physically cannot hit /users/me/messages/send.

When access is set to "draft", TagTag rewrites normal sends into Gmail drafts (/users/me/drafts) and outright rejects explicit delivery_mode=send requests with ErrDraftOnly—zero outbound emails sent.

Instance configuration

connectors.json
{
  "id": "gmail:work",
  "type": "gmail",
  "enabled": true,
  "bot_id": "chief-of-staff",
  "access": "draft",
  "poll_interval_seconds": 180,
  "default_target": "feishu:default",
  "env_keys": ["GMAIL_ACCESS_TOKEN"],
  "config": {}
}

Daily workflow

Route new work emails to your Bot with default_target pointing to Feishu or Slack. The Bot drafts a reply in your Gmail Drafts folder and pings you in IM with a 2-line summary so you stay in control.

Cursor & dry-run semantics

Uses Gmail historyId stored per connector in local FileKV. Running tagtag connector poll --dry-run inspects candidate historyId without modifying on-disk cursor state.

Credentials: GMAIL_ACCESS_TOKEN or OAuth refresh trio

Local agents
IM platforms