Your AI model can be secretly swapped
60sExposes unsettling real cases of GPT and Claude being silently downgraded, making vendor lock-in feel dangerous and urgent.
▶ Play Clip"Delivers a working multi-model MCP agent with real code and clear reasoning — the title holds up."
The video demonstrates how to build an AI agent that summarizes a user's day from Gmail, Slack, and Google Calendar, with the ability to switch between GPT, Gemini, and Claude by changing a single line of code. The creator emphasizes avoiding vendor lock-in by building on open protocols like MCP and using Zapier's MCP server for integration. A full Python code walkthrough is provided, including setup, custom client logic, and model switching.
The creator built an AI agent that pulls calendar, email, and Slack data to give a 30-second morning brief. With one line of code, the model can be switched between GPT, Gemini, and Claude.
Story 1: GPT-5 users discovered requests were routed to a cheaper variant under load. Story 2: Anthropic silently degraded the Claude coding harness without announcement. Lesson: tools can stop working overnight without notice.
If you are locked into a single model provider, you have a dependency, not a business. Agility and the ability to switch providers are essential.
LangChain requires excessive code to integrate one tool (e.g., Google Calendar) and managing credentials/tokens becomes a nightmare. With 500 tools, this approach is impractical.
Claude desktop connectors are new and immature: missing niche connectors, and some connectors lack full API capabilities.
Zapier provides a single MCP server with 8,000+ integrations. It acts as a single point of contact, eliminating token refresh and credential management headaches.
The solution: build a custom MCP client in Python that connects to Zapier's MCP server, allowing easy switching between GPT, Gemini, Claude, and more with a one-line change. MCP is an open standard created by Anthropic.
The prompt focuses on Slack messages where the user is mentioned (@codebasics.test), emails with 'task:' or 'update:' prefixes, and today's calendar meetings. This cuts through the clutter.
Main.py contains a get_llm function that creates clients for Grok, GPT, Gemini, etc. The model is selected by commenting/uncommenting a single line.
The custom client runs a while loop that mimics the ReAct pattern: call tools, observe output, call next tool. A counter can limit tool calls to avoid excessive bills.
Copy .env.example to .env, add the Zapier MCP server URL and your API keys. Use UV to install dependencies with 'uv sync' and activate the virtual environment.
The agent ran with Gemini first, producing the morning brief. Switching to GPT required only one line change, and the same brief was generated, proving the flexibility.
Zapier SDK (Node module) allows listing apps and running actions (e.g., get Slack connection, list channels) programmatically via NPM.
The video proves that building AI agents on open protocols like MCP, with a single integration hub like Zapier, provides model-agnostic flexibility and protects against vendor lock-in. This architectural mindset is essential for AI engineers in 2026.
What is MCP and who created it?
Model Context Protocol, created by Anthropic as an open standard.
06:21
What problem does Zapier's MCP server solve?
It connects to 8,000+ tools as a single point of contact, eliminating token refresh and credential management.
04:34
Name the two horror stories mentioned about model providers.
GPT-5 requests were silently routed to a cheaper variant; Anthropic degraded Claude's coding harness without announcement.
01:14
What is the ReAct loop in an agent?
Reason and act: the agent calls a tool, observes the output, then calls another tool, repeating the cycle.
12:39
How do you switch between models in main.py?
By commenting/uncommenting a single line that selects the model in the get_llm function.
11:11
What Slack messages does the agent filter for?
Messages where the user (@codebasics.test) is mentioned, from the last 24 hours.
11:57
What email prefixes are considered important by the agent?
Emails starting with 'task:', 'update:', or 'important:'.
12:20
What is the Zapier SDK and how is it installed?
A Node module for programmatic access to Zapier integrations, installed via NPM.
21:10
Why should AI engineers avoid vendor lock-in?
Tools can stop working overnight without notice, so you need agility to switch models or vendors quickly.
02:00
What command installs Python dependencies in the project?
uv sync
10:57
Model Providers Can Silently Change Behavior
Real examples of GPT and Claude silently switching or degrading models highlight the practical risk of vendor lock-in.
01:14Zapier MCP: 8,000+ Integrations as One Server
Centralizing integrations via a single MCP server drastically simplifies agent development and maintenance.
04:34MCP is an Open Standard
MCP's adoption by all major providers makes it the foundation for portable AI agents.
06:21get_llm Function Enables One-Line Model Switching
A clean abstraction that lets developers swap models without rewriting agent logic.
11:27Build on Open Protocols, Treat Models as Commodity Input
The core career advice: builders who win are the ones who avoid lock-in and stay adaptable.
22:09[00:02] noticed several Slack chat updates, emails, and meeting notification. And it really becomes hard to pay attention to what is important amidst all the clutter. To solve this problem, I built an AI agent this morning. It just pulled
[00:19] my calendar, my email, my Slack, and gave me a 30-second brief on my day. Nothing weird about it, but watch this. With one line of code change, I can
[00:31] switch between GPT, Gemini, Claude, and so on. Same agent, different models, so on. Same agent, different models, same brief. Three models, one agent, no rewrites. In the next few minutes, I'm going to show you how exactly I built
[00:45] this. More importantly, I am going to show you why every AI engineer should be building this way in year 2026. Quick note before we proceed further, Zapier sponsored this video. But the angle why I am making this video at all, that is
[01:01] mine. I have been building agents for past some time, and the lesson that I keep on learning the hard way is the one I want to share with you all today. [music] So, if that sounds fair, let's get into it. Today, we will write our
[01:14] code in such a way that with one line code change, you can switch between the models. Now, why is this important? Let me tell you two horror stories. The first one is the developers who were paying for premium GPT-5 model, they
[01:29] discovered that some of [music] their requests were routed to a cheaper variant of GPT under a load. The model selector in the dashboard still showed the original choice. So, the lesson here is that you think you are paying for the
[01:45] model you picked, you are not. Story number two, Anthropic quietly degraded the Claude code coding harness with no announcement. Users discovered it production. The lesson here is your
[02:00] tools can stop working overnight and no one will tell you. The point is not that these companies are bad, but this actually happened with some of the major model providers. If you are locked into a single vendor, then that means you do
[02:14] not have a business, you have a dependency. What do you do about it? Let's brainstorm on how exactly we are going to build our agent. Right now, we going to build our agent. Right now, we have three tools Gmail, calendar, Slack.
[02:27] In reality, in production systems, you can have 100 different tools. Here, you will have your large language model, which will interact with all these tools, and that agent will do the desired work for you. If you are a
[02:41] programmer, the first option that comes to your mind is using LangChain. So, LangChain is a framework that allows you to build agent. Now, let's look at this code, where we have created agent in LangChain, and in the tools, we are
[02:55] LangChain, and in the tools, we are using the calendar toolkit from Google. Now, check this code. Just for integrating Google Calendar, you have to write this much code. If you have 500 tools,
[03:07] So, that is problem number one. Problem two is managing your credentials. So, you have to provide all kind of credentials. Tomorrow, if you want to switch to a different calendar, again, you have to create a new token JSON and
[03:22] provide it here. Some of these tools also require you to refresh tokens because tokens have expiry. And that becomes nightmare. Every now and then, things will break. You have a large, bloated code base. So, let's
[03:36] think about any other option. Tell me, does any other option come to your mind? Well, if you have used Claude, you can actually integrate all these you can actually integrate all these tools directly into your Claude desktop
[03:51] application. Here, I have my Cloud desktop application open and here if you click on connectors you can integrate with so many But there is a problem here as well. The
[04:06] problem is first of all they do not have all kind of connectors, okay? So you might be using some niche tool in your company and if Cloud doesn't have a then you are blocked. The other problem is some of these connectors do not have
[04:22] full APIs. So the other day when I was using it, I wanted to use one tool where they do not have the API that I wanted. So the ecosystem here is kind of new and
[04:34] it is not mature. So then how about we use a mature workflow ecosystem uh such as Zapier. So Zapier has been in automation business for so many years and they have integrations uh for more than 8,000 tools. And Zapier provides
[04:51] this single MCP server that you can connect to your Cloud application which is MCP client here. All right, so this application that you is your MCP client and this is
[05:06] your MCP server. Now in Zapier dashboard you can integrate all these tools. You can these tools and things become much easier because
[05:19] you're connecting to only one thing. Zapier is your single point of contact, all right? So this solves that issue of connecting to so many things, managing tokens refreshing tokens and so on.
[05:33] But there is another problem. People may not want to get locked into one vendor. We just mentioned that issue, right? If Cloud has a production outage or let's Cloud has a production outage or let's say if they silently switch and degrade
[05:48] to a cheaper model, your app may break in production. You need agility. You in production. You need agility. You need some kind of dynamic approach where production. If things fail, you can quickly switch to a different model or
[06:04] different vendor. For that, you can write a custom MCP client. Okay, we are tutorial using Python. And then we'll connect to Zapier MCP server. And our client will be such that
[06:21] you'll be able to connect with GPT, Gemini, Claude, different models. And if things go wrong, you can switch it with just one line of code change. MCP, just in case if you don't know, is model context protocol. It is created by
[06:35] Anthropic, but it is an open standard. Anyone can use this protocol. Anyone can use this protocol. You will see MCP support for all the major model providers, GPT and Claude and Gemini. They all support MCP. All
[06:50] right, so we are going to use MCP now and we will start writing code. Let us work on setup. So, we are going to connect to our Slack. Okay, and I have a
[07:02] Slack channel here. So, this is the Slack channel that we'll connect to. Now, I will show you my actual Teams. Okay, so look at this. I get so many messages, okay? And there are so many channels, so many discussions going on.
[07:18] Right now, I am showing you Slack channel that we have created for this video purpose. But in reality, you just saw Teams looks pretty intense. So, in this Slack channel, I'm getting
[07:32] all these messages. Okay, Siddhanth is saying, "Okay, provide update for next two videos, itinerary for Google IO." And so on. Okay, so I want to capture the essential updates. Whatever is tagged with at the word, I want to get a
[07:47] morning brief for it. Also, for emails, I have tons of emails, but I'm interested in only those emails which starts with task colon or update colon. These are important emails for us. So, from all these clutters, I want to know
[08:03] what is super important for me, which is these two. Okay, actually three. So, this task, this task, and this update. And for calendar, I want to get a brief summary of my today's meetings. Using the link in video description, log in to
[08:17] Zapier. You can log in and create a free account. In this account, you will get 14 days free trial period, okay? So, you can play with various features. You can click on MCP servers. You can either click on this link, or you can say
[08:31] mcp.zapier .com, okay? And here, I'm going to click on new MCP server. So, let's create a new MCP server here. In the bottom, I will select other. And here, you can
[08:46] add tools. Select Gmail. Here, I will say find tools, which means I want to read emails. It selected two tools, okay? So, for email, see, you have tools such as find email, archive
[09:00] email, delete email. I don't want agent to delete my email. So, I'm just giving access to kind of like read-only access to my email system. When you click on connect, here it will ask you to connect to your account. So,
[09:14] when you say connect to new account, okay? It will ask you for Gmail credentials. You give it. I already gave my credentials. This is my test account, and I will say add two tools. Then,
[09:28] Then, add, let's say, Google Calendar. Once again, all find tools. So, it selected five. Connect. Add file tools. >> [snorts]
[09:47] tools. Select add tools. Select add tools. All right. So, see, connection was so easy. I integrated three different tools. You have 8,000 plus apps that you
[10:00] can select from. I will give it some name. I will call it daily brief automation. Now, go to connect. And just say generate token.
[10:15] And copy this URL. Okay, click on this. This is the URL that we will be using in our code. You can download the code from video description below. Here we are using UV as a Python package manager. So, these are the modules that
[10:31] manager. So, these are the modules that we are using. Now, MCP is a Python You can see this. Okay, this is the module that will allow you to use the model context protocol. Once again, model context protocol is created by
[10:44] Anthropic, but it is an open standard. To install the modules locally, you will To install the modules locally, you will say UV sync, and it will create this .venv directory
[10:57] and install all the modules locally. Then, from command prompt, you will say venv scripts activate. So, your virtual scripts activate. So, your virtual environment is now activated. This is
[11:11] how main.py looks like. You can switch between the models by just commenting and uncommenting another line. And in main, you have this function get LLM string. And if you look at that function, say if
[11:27] it is Grok, you are creating Grok client. If it is GPT, you are creating OpenAI client, Gemini client, and so on. And once you get that client, you will And once you get that client, you will create an MCP session, and you will run
[11:41] your prompt, okay? Now, if you look at this prompt, the prompt is common sense. You are a morning brief assistant. You have access to Gmail, Slack, Google Calendar, latest messages from 24 hours where @codebasics.test. By
[11:57] from 24 hours where @codebasics.test. By the way, @codebasics.test is my ID here in the Slack. So, if you look at See my name, Dhaval. See codebasics.test. That's why I'm specifying that. I'm interested only in those messages. There
[12:11] might be 1,000 other messages. I'm not interested in that. And from Google Calendar, pull today's event. And from Gmail, pull the emails which has task update colon or important colon, okay? And when you generate the
[12:25] output, generate it in this format. This is very common sense prompt. You can is very common sense prompt. You can check it out. Now, what exactly is this Grok client, Gemini client, and so on? Well, we have vibe coded that. It is a
[12:39] Well, we have vibe coded that. It is a custom client. So, let's look at maybe custom client. So, let's look at maybe OpenAI. So, here you are running the react loop of agent, okay? So, this while loop is essentially, you know,
[12:52] when you have an agent, you will have this react loop, which is reason and this react loop, which is reason and act. Agent will call some tools, uh check the output, then again call some another tool. It's like as a human, if I
[13:06] am putting a floor in in my uh home, I will put some floor, I will observe, then I will put some other nail, I will do finishing, and so on. So, we take action, observe the output, take second action, observe the output,
[13:22] take third action. All of that is happening in this while loop, okay? Now, here we have used OpenAI module. So, if you search Python
[13:34] OpenAI module, you will find this library. See, pip install OpenAI. So, that is what we have here. In OpenAI, we are going to use async API.
[13:46] And we will be using chat completion. So, here just think you are calling OpenAI's GPT model in uh cloud environment. Okay, so this is the model self.model_id. Whatever model ID we got, this model ID, okay? So,
[14:00] ID we got, this model ID, okay? So, let's say if I'm using OpenAI, this is the model ID GPT-5, mini, etc. And then this is the message. The message is prompt that we had, see? This prompt
[14:13] to uh this model. And you will get a response. If the response doesn't have any tool call, which means it is done with that react
[14:25] loop, okay? So, this is a while true, it's an infinite loop. So, you will keep on calling tools and when uh you have ended, you will uh return uh you have ended, you will uh return this. Maybe you can have some kind of uh
[14:39] iteration as well. So, if you don't want it to go into infinite loop, you can put counter is um greater than 10, then break.
[14:53] You can have this kind of counter as well, okay? plus plus. See? You can do that if you want to um have some kind of control on the tool
[15:06] call so that you don't get like surprisingly high bill. But in our case, we have tried tested and it works okay. So, now uh the next step will be messages.append.
[15:18] messages.append. As I said, agent will perform some task, consume the output, observe it, perform another task. So, putting all the messages in this kind of messages list, okay? And then you keep
[15:32] on calling. So, now here, if you have tool call, you will call the tool with the arguments. Folks, I understand it can be little hard to kind of grasp all
[15:44] of this. What you can do is you can take a look at the code with a calm mind, and you can try to digest it. It is really not hard, okay? You're calling all the not hard, okay? You're calling all the tools, and you are getting the response
[15:57] from a tool call. So, let's say I want to get emails. So, this tool call will have Google Gmail. It will return the actual emails with task, update, colon, actual emails with task, update, colon, etc. prefixes. And then it will put the
[16:11] some kind of formatting, okay? We are just formatting it by adding new line, minor. And then that result is given to the
[16:23] And then that result is given to the content parameter in this messages list. the code we have. So, we have main file, we have MCP tools. I think MCP tools uh is something we did not look at it. So,
[16:38] here, folks, first thing you have to do is take the environment examples file, copy-paste it as .env file, and in Zapier MCP URL, remember we created a URL in Zapier dashboard, you'll copy-paste that URL, and you will put
[16:54] your API keys here. So, you get the Zapier MCP server URL, which you're passing it to your streamable HTTP client. And this HTTP client we have
[17:06] imported from MCP Python module, okay? So, this is your MCP client. This client So, this is your MCP client. This client that you have created is an MCP client. And when you say as write, it will return the read pipe and write pipe,
[17:21] return the read pipe and write pipe, which means the MCP server will read messages from this pipe. It's like a data stream uh from which it will read the messages, and it will write the messages to this particular pipe. So,
[17:34] this is the output variable. Okay, this is just a variable in Python. As a result of calling this function, it will return these two. And it will return the third variable, which is not useful. That's why it's a common
[17:47] convention in Python. I hope you know that. To use underscore. Now, read and write is the output we got by calling this method. We are passing that to our client. So, our client session is the MCP client session. And
[18:01] this is a standard way of doing it. Okay, you create an HTTP client first, you get read and write stream, you pass through to your MCP client session, and through to your MCP client session, and then you say session.initialize.
[18:20] we are getting it in our main function. See, MCP session. That same method we are getting from MCP tools. See, MCP tools, MCP session. That same one we are getting here. And then we are calling
[18:35] client.run. And we are passing this session as a parameter. And here is our session as a parameter. And here is our prompt. Let me try Gemini model first, and let me run it. So, my virtual environment is already activated. Now, I
[18:48] environment is already activated. Now, I can say simply python main.py. Look at this. It gave the output. So, my It gave the output. So, my urgent email is update Agentic AI video
[19:01] is being processed for release. So, let's go to my email. See, Agentic are the emails from today, by the way. Today is May 15. It did not take emails from yesterday, May 14th, because I have given it
[19:16] instruction here. See, last 12 hours unless noted. So, it will take emails from last 12 hours. And in last 12 hours, this is the email with update uh
[19:28] tag. If there were other emails uh which doesn't have a tag, it will not take doesn't have a tag, it will not take that. And then in Slack, see, I have uh received all these notifications. So, let's go to Slack.
[19:42] These are the notification in last 12 hours. And then for calendar, I have two meetings, Google I/O sync-up, AIPM cohort planning. See, Google I/O sync-up, AIPM cohort planning. So, this way uh I can get the
[19:59] important information out of all the clutter I have in my life. I have so many Slack messages, so many emails. I don't know what is important. Every morning when this agent sends me this kind of morning brief, I know exactly
[20:13] what to focus on. Let's now change the model to GPT, okay? From Gemini, we are switching to GPT. Just one line of change. Run the code again. This way, if Anthropic uh deprecates
[20:30] Opus tomorrow, my agent doesn't break. If OpenAI silently routes my request to a cheaper model, I have a way to change my model here, okay? Just just change this line, and you should be good. Isn't this amazing? See, now with OpenAI
[20:45] this amazing? See, now with OpenAI model, I am getting the same daily brief. One last thing I want to mention is Zapier SDK. Let's say you want to access all these integrations in Zapier via code.
[20:58] How do you do that? See, previously, we wrote code, but that code was for our MCP client. We used MCP server directly from Zapier. But let's
[21:10] say you want to access all these individual tools programmatically. How do you do that? Well, you use Zapier SDK. So let me just show you some code here. So if you click on start building up for free,
[21:24] up for free, see, you install Zapier via NPM. It's a node module, basically. And then, in the code, you can list all the apps. For example, by writing this code, you
[21:37] can list all the apps which are supported. You can run the actions get Slack connection, and then list Slack channels, and so on. All right, I'm going to provide a link. Explore it if you are interested in
[21:53] programmatic access of Zapier tools. If you're learning AI engineering in 2026, this is the architectural mindset that will save your career. Models keep on changing. Provider do the things you do not like. The builders who win are the
[22:09] ones who build on open protocols and treat model as a commodity input. And this is the exact kind of thinking that we are teaching to our students in our live AI engineering cohorts. We have
[22:23] sessions on weekends over Zoom. If you want to learn more, the link is in video description. But you do not need a boot camp to start. You can build what I built today this afternoon for free. All
[22:36] right, that's all I had. If you have any questions, post in the comment box questions, post in the comment box below. Thank you very much for watching.
⚡ Saved you 0h 22m reading this? Transcribe any YouTube video for free — no signup needed.