Video summary

AI Agents with Zapier MCP: One Server, Any Model

Main summary

Key takeaways

Technology

Core problem & use case

  • A working professional is overwhelmed by Slack updates, emails, and meeting notifications.
  • Solution: build an AI agent that pulls from Google Calendar, Gmail, and Slack and generates a ~30-second morning brief filtered to what’s important.

Key architectural idea: “One agent, any model”

  • The agent is written so you can switch the underlying LLM (GPT, Gemini, Claude, Grok, etc.) with one line of code change.
  • The same prompt/agent logic is reused; only the model client changes.

Why this matters (vendor risk / reliability analysis)

Two “horror stories” motivate the design:

  1. A premium model selection (e.g., GPT) was silently routed to a cheaper variant under load, while the dashboard still showed the premium choice.
  2. A provider (Anthropic) degraded a tool/coding harness without clear announcement; issues only surfaced via broken production outputs.

Takeaway: If you’re locked into one vendor, you’re creating dependency. The solution is agility—the ability to switch models/providers quickly if behavior changes.

Alternatives considered (and their drawbacks)

  • LangChain

    • Requires a lot of boilerplate per tool.
    • Example: Google Calendar integration is “manageable,” but 500 tools becomes a huge codebase.
    • Also requires managing many credentials/tokens.
  • Direct model desktop/app connectors (e.g., Claude desktop)

    • Connectors may be incomplete (missing niche internal tools).
    • May lack full APIs, which can block you when features aren’t supported.
  • Zapier as a workflow hub

    • Mature automation ecosystem with 8,000+ apps.
    • Use a single Zapier MCP server as the integration layer to avoid large per-tool code and credential sprawl.

Technology: MCP (Model Context Protocol)

  • Uses MCP (Model Context Protocol), described as:
    • Created by Anthropic, but an open standard.
    • Supported across major providers (GPT/Claude/Gemini support MCP).
  • Architecture:
    • A Zapier MCP server (hosted/integrated in the Zapier dashboard)
    • A custom Python MCP client connecting to that server
    • Swappable LLM clients (OpenAI/Gemini/etc.) via code

Tutorial / build steps (high-level)

  1. Define what “important” means

    • Slack: only messages containing a specific tag/mention (example: tagged with @codebasics.test).
    • Gmail: only emails starting with prefixes like task: or update: (plus time filtering like “last 12 hours unless noted”).
    • Calendar: summarize today’s meetings.
  2. In Zapier

    • Create an MCP server and add tools:
      • Gmail tools (read-oriented; e.g., “find” tools rather than delete/archive)
      • Google Calendar tools
      • Slack tools
    • Generate a token/URL for the MCP server (used by the Python code).
    • Credentials are handled via Zapier connection flow; the agent code only needs the Zapier MCP endpoint/keys.
  3. In Python

    • Install the MCP module (and dependencies) and set up a virtual environment (UV sync mentioned).
    • Run main.py.
    • get_LLM_client(model_string) selects the correct model client.
    • Use a common prompt instructing the model to:
      • Use MCP tools to fetch Slack/email/calendar context (e.g., last 24 hours / “last 12 hours” filtering as specified)
      • Output a morning brief in a consistent format
  4. Agent loop behavior

    • Uses a ReAct-style loop (“reason and act”):
      • The model decides to call a tool → tool runs via MCP → results are appended back to messages → repeat until no tool call.
    • Optionally add a counter to avoid infinite looping / control cost.

Demonstrated results (verification)

  • Switching Gemini → GPT by changing one line produces the same daily brief content format (urgent email, relevant notifications, today’s meetings).
  • Confirms the filtering logic works (e.g., only “tagged” Slack/email items and “today” meetings).

Cost / safety considerations noted

  • Tool-call iteration could raise cost.
  • Suggests adding a counter to limit loops (e.g., stop after N iterations).

Extra: programmatic access via Zapier SDK

  • Mentions Zapier SDK for direct integration/action access from code (in addition to MCP usage).
  • Example: listing available apps, Slack connections, channels, etc., via Node/NPM.

Main speakers/sources

  • Speaker: The video’s primary host/tutorial presenter (unnamed in subtitles).
  • Sponsored by: Zapier (explicitly mentioned).

Original video