Before we get into showing how you use agentic AI inside Xcode, let’s talk about exactly what that is.
Most people are familiar with ChatGPT. ChatGPT is a generative pre-trained transformer. So what does that mean? It means that it can make new content — it’s generative. It is pre-trained, meaning it has learned a massive amount of patterns from a massive amount of information before you’ve even started to play with it yourself. And it is a transformer — it can understand relationships between words in a sentence. So you have a very chatbot-like process that you go through in order to have a conversation with it: find information, provide it some information, have it look at that information, compare it to what it knows, and hopefully give you answers to the questions that you have.
Now, this is a somewhat simplified look at interfacing with a particular LLM — a large language model. This chat interface for ChatGPT is one way to interact with a large language model, but we can get more complex.
We can go to something called an agentic AI to get a little bit more of a specialized or fine-tuned way of getting information out. Agentic AI, as opposed to the back and forth of ChatGPT, is very autonomous. It is good at making actions and making decisions. It can adjust behavior as new information is discovered. It can create goals to help take a prompt, figure out what it wants to do with it, and come up with a plan of action. The downside to agentic AI is that you may have unique APIs to interface with large language models for every agent that you might have.
The data flow for an agentic AI works like this. A query goes into the agentic AI, which will come up with a plan based on what it can infer from the query. It’s good at natural language processing, like a lot of modern AIs are. It can then take that plan, knowing what tools it has at its disposal, and execute a series of actions to try to satisfy the prompt that the user sent in. What’s great about agentic AI is that it has the ability to self-assess — did what I come up with meet the query? Will it give the information that the user wanted? If not, it can go back and replan, come up with a refined list of things to do, execute a new series of actions, and reassess. It does that until it reaches a high level of confidence, and then it can send a response back to the user. We’ll see examples of this when we get to adding more code to our starter project.
Now, agents can certainly act by themselves and talk directly with an LLM, but that usually involves different APIs talking to the LLM. Anthropic, back in 2024, came up with a generalizable way to interface with LLMs, and that was through the Model Context Protocol (MCP) server. This defined a common set of APIs — a common interface that different agents could implement — to talk to an MCP server and interface with the LLM. And because things are bidirectional, the LLM could then request things of the MCP server. That MCP server could then reach out to the agents, get them to use the available tools that they have, and get the information that the LLM needs.
So here’s where things have sort of skyrocketed in the last six to nine months or so. The number of available MCP servers has dramatically increased, and the ability to integrate those into things like your favorite IDE — like Xcode — has also dramatically increased. So we now have the ability, where before we were simply asking back-and-forth questions, to use these agentic AI components along with an MCP server to get a very autonomous approach to things like adding features to an existing codebase, which we’ll look at in the next video.