agentskit.js
ToolsIntegrations

gmail

Gmail API — list messages, send email. For inbox-triage agents + notification flows.

import { gmail } from '@agentskit/tools'

const runtime = createRuntime({
  adapter,
  tools: [...gmail({ accessToken: process.env.GMAIL_ACCESS_TOKEN! })],
})

Sub-tools

NamePurpose
gmailListMessagesQuery inbox (supports q filter syntax)
gmailSendEmailCompose + send a plain-text or HTML email

Bundled: gmail(config).

Config

type GmailConfig = {
  accessToken: string       // OAuth access token (refresh on your side)
  fetch?: typeof fetch
}

Example — inbox triage

const runtime = createRuntime({
  adapter,
  systemPrompt: 'Label, categorize, and draft replies for unread emails. Never send without HITL approval.',
  tools: [
    ...gmail({ accessToken }),
    hitlTool, // require approval before gmailSendEmail
  ],
})

Credentials

  • OAuth 2.0 required — Gmail has no long-lived API keys.
  • Scopes: gmail.readonly + gmail.send.
  • Handle token refresh in your app — this tool accepts short-lived access tokens.

Safety

Always gate gmailSendEmail behind HITL approval. Accidental mass-send is hard to undo.

✎ Edit this page on GitHub·Found a problem? Open an issue →·How to contribute →

On this page