Markdown source

Transcript: Building an ACP-Compatible Agent Live — Bennet Fenner, Zed

Source Video

Local Cache

Transcript

I'm Bennett. I work at Zed and we built I'm Bennett. I work at Zed and we built like an AI code editor all written in like an AI code editor all written in like an AI code editor all written in Rust. And last year was kind of as you Rust. And last year was kind of as you Rust. And last year was kind of as you probably all know the rise of the probably all know the rise of the probably all know the rise of the uh AI coding agent terminal user uh AI coding agent terminal user uh AI coding agent terminal user interfaces with every major model interfaces with every major model interfaces with every major model provider like building Claude code, provider like building Claude code, provider like building Claude code, Codex, Gemini CLI, and so on. Codex, Gemini CLI, and so on. Codex, Gemini CLI, and so on. And so at Zed, we asked ourselves like And so at Zed, we asked ourselves like And so at Zed, we asked ourselves like how can we let users bring how can we let users bring how can we let users bring their agent of choice to our tool and their agent of choice to our tool and their agent of choice to our tool and enjoy like a nice interface that is enjoy like a nice interface that is enjoy like a nice interface that is unified across all of them. unified across all of them. unified across all of them. And so that's why we decided we need And so that's why we decided we need And so that's why we decided we need some kind of type of protocol uh called some kind of type of protocol uh called some kind of type of protocol uh called agent client protocol, uh which is agent client protocol, uh which is agent client protocol, uh which is similar to like MCP or uh LSP. It's a similar to like MCP or uh LSP. It's a similar to like MCP or uh LSP. It's a JSON RPC based protocol. And the idea is JSON RPC based protocol. And the idea is JSON RPC based protocol. And the idea is basically that uh agents and clients can basically that uh agents and clients can basically that uh agents and clients can talk to each other through through a talk to each other through through a talk to each other through through a unified interface. unified interface. unified interface. And And And uh yeah, the it's yeah, online. It's uh yeah, the it's yeah, online. It's uh yeah, the it's yeah, online. It's open source. Uh you can contribute if open source. Uh you can contribute if open source. Uh you can contribute if you want. Um at this point we have you want. Um at this point we have you want. Um at this point we have a wide variety of agents already a wide variety of agents already a wide variety of agents already supporting this either by like an supporting this either by like an supporting this either by like an adapter that kind of like translates adapter that kind of like translates adapter that kind of like translates um um um the agent's native language to the ACP the agent's native language to the ACP the agent's native language to the ACP one. Uh and then we have like for one. Uh and then we have like for one. Uh and then we have like for example open code and co- uh and cursor example open code and co- uh and cursor example open code and co- uh and cursor uh having like ACP mode built into their uh having like ACP mode built into their uh having like ACP mode built into their like CLI agents. like CLI agents. like CLI agents. And we also have a bunch of And we also have a bunch of And we also have a bunch of uh clients at this point up to 40 that uh clients at this point up to 40 that uh clients at this point up to 40 that uh implement this including open claw uh implement this including open claw uh implement this including open claw for example. Like open claw itself is a for example. Like open claw itself is a for example. Like open claw itself is a client and a server actually like a client and a server actually like a client and a server actually like a client and an agent. client and an agent. client and an agent. Um and JetBrains and Obsidian and other Um and JetBrains and Obsidian and other Um and JetBrains and Obsidian and other people are supporting this. Um people are supporting this. Um people are supporting this. Um Great. So, Great. So, Great. So, um I'm going to do a live coding um I'm going to do a live coding um I'm going to do a live coding session. Let's see how well that goes. session. Let's see how well that goes. session. Let's see how well that goes. Um Um Um So, So, So, Right. Uh Right. Uh Right. Uh basically, we have some pre-existing basically, we have some pre-existing basically, we have some pre-existing code. So, this is Zed. Uh here I have code. So, this is Zed. Uh here I have code. So, this is Zed. Uh here I have some TypeScript code. Also, bear with some TypeScript code. Also, bear with some TypeScript code. Also, bear with me. I'm I'm a Rust developer. I have me. I'm I'm a Rust developer. I have me. I'm I'm a Rust developer. I have basically zero clue about TypeScript. basically zero clue about TypeScript. basically zero clue about TypeScript. So, if you see anything that you don't So, if you see anything that you don't So, if you see anything that you don't do in TypeScript, tell me afterwards. do in TypeScript, tell me afterwards. do in TypeScript, tell me afterwards. Um but yeah, like here's a very minimal Um but yeah, like here's a very minimal Um but yeah, like here's a very minimal coding agent that just doesn't support coding agent that just doesn't support coding agent that just doesn't support ACP, but it's kind of the bare minimum ACP, but it's kind of the bare minimum ACP, but it's kind of the bare minimum you need to like build a coding agent. you need to like build a coding agent. you need to like build a coding agent. So, So, all it has is really like two tools. One all it has is really like two tools. One all it has is really like two tools. One to read a file and one to edit an to read a file and one to edit an to read a file and one to edit an existing file. Um Yeah, this is like existing file. Um Yeah, this is like existing file. Um Yeah, this is like pretty basic. It provides the model has pretty basic. It provides the model has pretty basic. It provides the model has to provide a path. Then it has to to provide a path. Then it has to to provide a path. Then it has to provide an old text that is like then provide an old text that is like then provide an old text that is like then just replaced with new text and that's just replaced with new text and that's just replaced with new text and that's kind of everything. kind of everything. kind of everything. And then we have uh in this case like And then we have uh in this case like And then we have uh in this case like I'm using Anthropic. Uh there's a way to I'm using Anthropic. Uh there's a way to I'm using Anthropic. Uh there's a way to prompt the agent um prompt the agent um prompt the agent um uh with yeah, the user can prompt the uh with yeah, the user can prompt the uh with yeah, the user can prompt the agent, which is the function that we agent, which is the function that we agent, which is the function that we will going to call here. And then we will going to call here. And then we will going to call here. And then we enter the agent loop and that is kind of enter the agent loop and that is kind of enter the agent loop and that is kind of like the way all agents basically work like the way all agents basically work like the way all agents basically work is the model APIs are stateless. So, you is the model APIs are stateless. So, you is the model APIs are stateless. So, you just attach some like conversation up to just attach some like conversation up to just attach some like conversation up to this point. You call the endpoint. In this point. You call the endpoint. In this point. You call the endpoint. In this case it's like the Anthropic API. this case it's like the Anthropic API. this case it's like the Anthropic API. And then we um And then we um And then we um yeah, we get like a message from the yeah, we get like a message from the yeah, we get like a message from the model and either it can be like a end model and either it can be like a end model and either it can be like a end turn. That means like the model decided turn. That means like the model decided turn. That means like the model decided to uh to uh to uh yeah, just output some text and do yeah, just output some text and do yeah, just output some text and do nothing or it can call a tool. nothing or it can call a tool. nothing or it can call a tool. And in this case it would be like a read And in this case it would be like a read And in this case it would be like a read or a write uh tool call. or a write uh tool call. or a write uh tool call. And then in the case of a tool call, we And then in the case of a tool call, we And then in the case of a tool call, we like like like run the for example the edit file tool run the for example the edit file tool run the for example the edit file tool call locally, um collect the result, and call locally, um collect the result, and call locally, um collect the result, and then send it up to the model again. then send it up to the model again. then send it up to the model again. That's where this this loop um That's where this this loop um That's where this this loop um And then we call the API again with the And then we call the API again with the And then we call the API again with the conversation up to that point and that's conversation up to that point and that's conversation up to that point and that's kind of everything. kind of everything. And then we have like these this like And then we have like these this like And then we have like these this like handle tool call function here, which handle tool call function here, which handle tool call function here, which yeah, handles like read and write uh yeah, handles like read and write uh yeah, handles like read and write uh tool calls, which does what you expect. tool calls, which does what you expect. tool calls, which does what you expect. We get the path. We read it from the We get the path. We read it from the We get the path. We read it from the file system and we return some some uh file system and we return some some uh file system and we return some some uh result. Right. So, now the question is result. Right. So, now the question is result. Right. So, now the question is how do we make this thing ACP how do we make this thing ACP how do we make this thing ACP compatible? And hopefully we can do it compatible? And hopefully we can do it compatible? And hopefully we can do it in 10 minutes. So, let's see. in 10 minutes. So, let's see. in 10 minutes. So, let's see. Um so, yeah, I have some boilerplate Um so, yeah, I have some boilerplate Um so, yeah, I have some boilerplate here. here. here. Uh in this case I'm using the TypeScript Uh in this case I'm using the TypeScript Uh in this case I'm using the TypeScript SDK as I said. SDK as I said. SDK as I said. Um and the way this works, you implement Um and the way this works, you implement Um and the way this works, you implement uh the agent interface provided by this uh the agent interface provided by this uh the agent interface provided by this uh library. uh library. uh library. And then you have to at minimum And then you have to at minimum And then you have to at minimum implement these three uh four functions. implement these three uh four functions. implement these three uh four functions. So, the first one that we're looking at So, the first one that we're looking at So, the first one that we're looking at is kind of this initialize here. is kind of this initialize here. is kind of this initialize here. Um Um all we really have to do here is like all we really have to do here is like all we really have to do here is like respond with the protocol version we respond with the protocol version we respond with the protocol version we support, which in this case is just the support, which in this case is just the support, which in this case is just the latest. There's also like some latest. There's also like some latest. There's also like some capabilities like client and uh the capabilities like client and uh the capabilities like client and uh the agent can itself advertise capabilities agent can itself advertise capabilities agent can itself advertise capabilities of stuff it supports, but we're building of stuff it supports, but we're building of stuff it supports, but we're building a very minimal coding agent, so we don't a very minimal coding agent, so we don't a very minimal coding agent, so we don't support anything outside that's support anything outside that's support anything outside that's necessary, I guess. necessary, I guess. necessary, I guess. Um then for us like authentication is Um then for us like authentication is Um then for us like authentication is irrelevant since it's just using my API irrelevant since it's just using my API irrelevant since it's just using my API key from an env var. key from an env var. key from an env var. And then there's this concept of And then there's this concept of And then there's this concept of sessions in ACP. So, sessions in ACP. So, sessions in ACP. So, basically every time you start a thread basically every time you start a thread basically every time you start a thread in Zed or in a different editor or in Zed or in a different editor or in Zed or in a different editor or client, uh you you call a new session. client, uh you you call a new session. client, uh you you call a new session. And And in a session you can prompt and then in a session you can prompt and then in a session you can prompt and then yeah, from there on you can like get get yeah, from there on you can like get get yeah, from there on you can like get get your output. So, all we really do here your output. So, all we really do here your output. So, all we really do here is like we generate a random ID. is like we generate a random ID. is like we generate a random ID. Um Um then we then we then we um instantiate um instantiate um instantiate uh this coding agent with the current uh this coding agent with the current uh this coding agent with the current working directory, which we get from the working directory, which we get from the working directory, which we get from the client. Um client. Um client. Um we store it in our internal map and then we store it in our internal map and then we store it in our internal map and then just return the ID to the client so that just return the ID to the client so that just return the ID to the client so that the client knows the client knows the client knows um um yeah, knows the ID and that is kind of yeah, knows the ID and that is kind of yeah, knows the ID and that is kind of then used inside prompt. Um then used inside prompt. Um then used inside prompt. Um because what prompt does in this case, because what prompt does in this case, because what prompt does in this case, um um it like prompt the prompt request, if we it like prompt the prompt request, if we it like prompt the prompt request, if we go to the definition here, all this is go to the definition here, all this is go to the definition here, all this is kind of doing is uh it provides a kind of doing is uh it provides a kind of doing is uh it provides a prompt, which is an array of content prompt, which is an array of content prompt, which is an array of content blocks that can be like text, images, blocks that can be like text, images, blocks that can be like text, images, whatever, the session ID for reference. whatever, the session ID for reference. whatever, the session ID for reference. And so all we kind of have to do here is And so all we kind of have to do here is And so all we kind of have to do here is yeah, we look it up in our internal yeah, we look it up in our internal yeah, we look it up in our internal state. We get the relevant agent uh for state. We get the relevant agent uh for state. We get the relevant agent uh for that uh current session. that uh current session. that uh current session. And then I have a help helper function And then I have a help helper function And then I have a help helper function here, which just in this case ignores here, which just in this case ignores here, which just in this case ignores everything that's not a text because we everything that's not a text because we everything that's not a text because we don't support images and stuff like don't support images and stuff like don't support images and stuff like this. this. this. Um and then we call this like prompt Um and then we call this like prompt Um and then we call this like prompt function I showed earlier, which then uh function I showed earlier, which then uh function I showed earlier, which then uh runs tool calling loop. runs tool calling loop. runs tool calling loop. And so then just like as a nice to have And so then just like as a nice to have And so then just like as a nice to have uh feature, we also support uh feature, we also support uh feature, we also support cancellation. cancellation. cancellation. Uh that's also pretty pretty simple. So, Uh that's also pretty pretty simple. So, Uh that's also pretty pretty simple. So, these are kind of like the four minimal these are kind of like the four minimal these are kind of like the four minimal things we have to implement. things we have to implement. things we have to implement. And I have this hooked up in Zed just by And I have this hooked up in Zed just by And I have this hooked up in Zed just by there's no special code. All I have is there's no special code. All I have is there's no special code. All I have is kind of like I tell Zed there's some ACP kind of like I tell Zed there's some ACP kind of like I tell Zed there's some ACP compatible agent and you can run it with compatible agent and you can run it with compatible agent and you can run it with node and then my path to that agent.js node and then my path to that agent.js node and then my path to that agent.js file. file. file. Um so, when I uh let's do that in here Um so, when I uh let's do that in here Um so, when I uh let's do that in here as well. as well. as well. So, when I run, I'm going to build. Um So, when I run, I'm going to build. Um So, when I run, I'm going to build. Um I'm going to build, right? And then I'm I'm going to build, right? And then I'm I'm going to build, right? And then I'm going to going to going to restart uh yeah, launch a new ACP demo restart uh yeah, launch a new ACP demo restart uh yeah, launch a new ACP demo agent. agent. agent. And you can see if I ask it for And you can see if I ask it for And you can see if I ask it for something, you can see wait indicator. something, you can see wait indicator. something, you can see wait indicator. And now it's done. So, nothing. And now it's done. So, nothing. And now it's done. So, nothing. Which is what we expect, right? Because Which is what we expect, right? Because Which is what we expect, right? Because like what we can see here, like what we can see here, like what we can see here, if I go over Oops. if I go over Oops. if I go over Oops. Um Um If I go over here, If I go over here, If I go over here, we have some kind of like ACP debug view we have some kind of like ACP debug view we have some kind of like ACP debug view in Zed. So, to make it easier for us to in Zed. So, to make it easier for us to in Zed. So, to make it easier for us to develop. And you can see like Zed sends develop. And you can see like Zed sends develop. And you can see like Zed sends a session new request. We respond with a a session new request. We respond with a a session new request. We respond with a session ID and as soon as I type in session ID and as soon as I type in session ID and as soon as I type in something, we get prompt. we get prompt. And now we got a stop reason, right? So, And now we got a stop reason, right? So, And now we got a stop reason, right? So, these red arrows come from the uh from these red arrows come from the uh from these red arrows come from the uh from the adapter the adapter the adapter that we are building from the agent. But that we are building from the agent. But that we are building from the agent. But it's not outputting tokens, right? Like it's not outputting tokens, right? Like it's not outputting tokens, right? Like behind the scenes it's obviously like behind the scenes it's obviously like behind the scenes it's obviously like Anthropic is giving us tokens, but how Anthropic is giving us tokens, but how Anthropic is giving us tokens, but how do we make them show up in Zed? do we make them show up in Zed? do we make them show up in Zed? So, that's the next thing that we So, that's the next thing that we So, that's the next thing that we uh yeah, want to focus on. So, uh yeah, want to focus on. So, uh yeah, want to focus on. So, the first thing that we kind of need to the first thing that we kind of need to the first thing that we kind of need to do, like our coding agent itself uh do, like our coding agent itself uh do, like our coding agent itself uh needs to have a way to needs to have a way to needs to have a way to um send something over to the um send something over to the um send something over to the connection. So, what we're going to do connection. So, what we're going to do connection. So, what we're going to do here is like the coding agent is going here is like the coding agent is going here is like the coding agent is going to take the to take the to take the ACP connection and then also the session ACP connection and then also the session ACP connection and then also the session ID. And then inside here, we have to ID. And then inside here, we have to ID. And then inside here, we have to provide this uh provide this uh provide this uh connection and connection and connection and the ID. And then if we go Okay, I'm just going And then if we go Okay, I'm just going to close this. Right. If we go back to close this. Right. If we go back to close this. Right. If we go back here, here, here, now inside of now inside of now inside of uh prompt, Anthropic like this is the uh prompt, Anthropic like this is the uh prompt, Anthropic like this is the Anthropic SDK. So, in this case like in Anthropic SDK. So, in this case like in Anthropic SDK. So, in this case like in Oops. You can just use um Oops. You can just use um Oops. You can just use um this like stream on this like stream on this like stream on uh uh uh Yeah, that's like a Anthropic SDK. Like Yeah, that's like a Anthropic SDK. Like Yeah, that's like a Anthropic SDK. Like you can react to a text event. So, every you can react to a text event. So, every you can react to a text event. So, every time we basically get a chunk, time we basically get a chunk, time we basically get a chunk, uh we send this kind of what ACP calls a uh we send this kind of what ACP calls a uh we send this kind of what ACP calls a session update. As I said, a session is session update. As I said, a session is session update. As I said, a session is like a single thread or a conversation. like a single thread or a conversation. like a single thread or a conversation. And then you can send updates kind of And then you can send updates kind of And then you can send updates kind of like notifications to the client that like notifications to the client that like notifications to the client that are not like a usual request response, are not like a usual request response, are not like a usual request response, right? It can happen at any time and the right? It can happen at any time and the right? It can happen at any time and the client reacts to it. And so here we are client reacts to it. And so here we are client reacts to it. And so here we are associating with the session update with associating with the session update with associating with the session update with a session ID. And then this like There's a session ID. And then this like There's a session ID. And then this like There's a type of session updates. There are a type of session updates. There are a type of session updates. There are multiple. We will see more in a second. multiple. We will see more in a second. multiple. We will see more in a second. But this agent message chunk is just But this agent message chunk is just But this agent message chunk is just like, "Okay. Hey, here's some new output like, "Okay. Hey, here's some new output like, "Okay. Hey, here's some new output from the model." from the model." from the model." And so if we And so if we And so if we build again, build again, build again, uh we go back to Zed. I'm going to have uh we go back to Zed. I'm going to have uh we go back to Zed. I'm going to have to restart the agent. to restart the agent. to restart the agent. I go here I go here I go here and I say, "Hello." Hello. Hello. Well, here's Opus talking, Hello. Hello. Well, here's Opus talking, right? You can see like we're streaming right? You can see like we're streaming right? You can see like we're streaming in these in these in these individual uh individual uh individual uh chunks, right? Right, that we got from chunks, right? Right, that we got from chunks, right? Right, that we got from Anthropic. So, so far so good. Anthropic. So, so far so good. Anthropic. So, so far so good. Let's hope the demo gods uh stay with Let's hope the demo gods uh stay with Let's hope the demo gods uh stay with us. Um us. Um us. Um Right. So, that's one piece. The next Right. So, that's one piece. The next Right. So, that's one piece. The next thing though is like I want to like it's thing though is like I want to like it's thing though is like I want to like it's a coding agent, right? It's supposed to a coding agent, right? It's supposed to a coding agent, right? It's supposed to edit code. edit code. edit code. So, I can actually tell it So, I can actually tell it So, I can actually tell it already because we have tool support, already because we have tool support, already because we have tool support, right? I can tell it to read, for right? I can tell it to read, for right? I can tell it to read, for example, this like helpers example, this like helpers example, this like helpers .ts file .ts file .ts file and it's going to give me and it's going to give me and it's going to give me if the Wi-Fi isn't too slow, if the Wi-Fi isn't too slow, if the Wi-Fi isn't too slow, it's giving me a description of what it's giving me a description of what it's giving me a description of what this file actually contains. Like if you this file actually contains. Like if you this file actually contains. Like if you look here, look here, look here, that's basically the description of the that's basically the description of the that's basically the description of the file, but again, you don't see it in the file, but again, you don't see it in the file, but again, you don't see it in the UI, right? UI, right? UI, right? So, now we need to emit more session So, now we need to emit more session So, now we need to emit more session updates, similar to like what we did for updates, similar to like what we did for updates, similar to like what we did for text. So, if we actually go towards the text. So, if we actually go towards the text. So, if we actually go towards the read file, read file, read file, kind of what we need to do here kind of what we need to do here kind of what we need to do here is like the way it works usually in ACP, is like the way it works usually in ACP, is like the way it works usually in ACP, like you emit an initial tool call like you emit an initial tool call like you emit an initial tool call update, uh which I'm going to paste in update, uh which I'm going to paste in update, uh which I'm going to paste in here. here. So, yeah, again we're emitting a session So, yeah, again we're emitting a session So, yeah, again we're emitting a session update in this in this case, it's uh update in this in this case, it's uh update in this in this case, it's uh type of tool call. type of tool call. type of tool call. And then there are multiple properties And then there are multiple properties And then there are multiple properties we can specify, for example, like the we can specify, for example, like the we can specify, for example, like the title, kind of some kind of data um title, kind of some kind of data um title, kind of some kind of data um that Z uses, for example, for like yeah, that Z uses, for example, for like yeah, that Z uses, for example, for like yeah, using some icons and stuff like this. using some icons and stuff like this. using some icons and stuff like this. And then we indicate that the status is And then we indicate that the status is And then we indicate that the status is in progress, and you can also like in progress, and you can also like in progress, and you can also like associate tool calls with like actual uh associate tool calls with like actual uh associate tool calls with like actual uh locations. locations. locations. And so, And so, And so, now we signaling over ACP that something now we signaling over ACP that something now we signaling over ACP that something is in progress, right? This tool call. is in progress, right? This tool call. is in progress, right? This tool call. But then we also want to at the end, But then we also want to at the end, But then we also want to at the end, like once the tool call has finished, like once the tool call has finished, like once the tool call has finished, like at the bottom here, like at the bottom here, like at the bottom here, we kind of want to send another update. we kind of want to send another update. we kind of want to send another update. And in this case it's not tool call And in this case it's not tool call And in this case it's not tool call itself, but it's a tool call update. So, itself, but it's a tool call update. So, itself, but it's a tool call update. So, you have to emit you have to emit you have to emit on the agent, you have to emit like a on the agent, you have to emit like a on the agent, you have to emit like a tool call, like session update of type tool call, like session update of type tool call, like session update of type tool call, and then once once the client tool call, and then once once the client tool call, and then once once the client knows about it, uh you can emit updates knows about it, uh you can emit updates knows about it, uh you can emit updates for that. Uh and this is the way that we for that. Uh and this is the way that we for that. Uh and this is the way that we set the status, and we can also return set the status, and we can also return set the status, and we can also return the content. the content. the content. Um and then one additional thing that Um and then one additional thing that Um and then one additional thing that I'm going to do here is the I'm going to do here is the I'm going to do here is the um instead of like if you can see here, um instead of like if you can see here, um instead of like if you can see here, we're calling, I guess it's a bit hard we're calling, I guess it's a bit hard we're calling, I guess it's a bit hard to see, but like here we're calling to see, but like here we're calling to see, but like here we're calling fs.readFile, right? So, we're just using fs.readFile, right? So, we're just using fs.readFile, right? So, we're just using the native file system APIs. But MC uh the native file system APIs. But MC uh the native file system APIs. But MC uh ACP actually proxies the file system ACP actually proxies the file system ACP actually proxies the file system too. Like the client can provide a uh a too. Like the client can provide a uh a too. Like the client can provide a uh a file system capability, and if it does, file system capability, and if it does, file system capability, and if it does, um we can like proxy those uh file um we can like proxy those uh file um we can like proxy those uh file system tool calls over ACP. And it kind system tool calls over ACP. And it kind system tool calls over ACP. And it kind of makes sense, for example, for an of makes sense, for example, for an of makes sense, for example, for an editor, right? You want to um editor, right? You want to um editor, right? You want to um if I have unsafe changes in my buffer, if I have unsafe changes in my buffer, if I have unsafe changes in my buffer, they're not actually on the file system, they're not actually on the file system, they're not actually on the file system, but the agent should still see them. but the agent should still see them. but the agent should still see them. So, that's why we call this like uh read So, that's why we call this like uh read So, that's why we call this like uh read text file um over ACP. text file um over ACP. text file um over ACP. And so, now if we go back here and hit npm run build, and hit npm run build, and then go back here, and then go back here, and then go back here, restart, restart, restart, and say read and say read and say read uh uh this file. Oops, not the rust. Then we should be seeing um Then we should be seeing um Yeah, so now we see read Yeah, so now we see read Yeah, so now we see read tool calls, right? Okay, something is tool calls, right? Okay, something is tool calls, right? Okay, something is going wrong because going wrong because going wrong because everything is duplicated. everything is duplicated. everything is duplicated. Um Um yeah, but like here you can see the yeah, but like here you can see the yeah, but like here you can see the output um output um output um of the actual file. And because I think of the actual file. And because I think of the actual file. And because I think I'm low on time, um we're we're going to I'm low on time, um we're we're going to I'm low on time, um we're we're going to basically going to do the same for edit basically going to do the same for edit basically going to do the same for edit file. Um and I'm going to compile again. Um and I'm going to compile again. And And if I again restart, and say and say add a comment at the top of add a comment at the top of add a comment at the top of agent source agent.typescript, then you're going to see then you're going to see um Hopefully, clo- uh Opus is going to Hopefully, clo- uh Opus is going to decide to add hello world at the top of decide to add hello world at the top of decide to add hello world at the top of the file, and we actually get a diff the file, and we actually get a diff the file, and we actually get a diff here because the over ACP we send like a here because the over ACP we send like a here because the over ACP we send like a diff of the file. diff of the file. diff of the file. Okay. Yeah, I think there's something going Yeah, I think there's something going wrong with the wrong with the wrong with the connection. I'm yeah, connection. I'm yeah, connection. I'm yeah, yeah, no time to debug right now. Sorry. yeah, no time to debug right now. Sorry. yeah, no time to debug right now. Sorry. Uh am I out of time or do I still have Okay, maybe like we can Okay, maybe like we can see. So, now that Okay, just another see. So, now that Okay, just another see. So, now that Okay, just another minute. Um now that the coding agent minute. Um now that the coding agent minute. Um now that the coding agent supports reading and writing files, we supports reading and writing files, we supports reading and writing files, we can actually can actually can actually Oh, great. Uh okay, then I don't need to Oh, great. Uh okay, then I don't need to Oh, great. Uh okay, then I don't need to rush. Um rush. Um rush. Um now we can kind of bootstrap the agent now we can kind of bootstrap the agent now we can kind of bootstrap the agent itself, right? Like the coding agent itself, right? Like the coding agent itself, right? Like the coding agent supports reading and writing supports reading and writing supports reading and writing files. files. files. I can just ask it, I prepared a prompt I can just ask it, I prepared a prompt I can just ask it, I prepared a prompt here, to add a terminal tool to itself, here, to add a terminal tool to itself, here, to add a terminal tool to itself, right? right? right? Let's see how this works out with like Let's see how this works out with like Let's see how this works out with like the duplication we're seeing. the duplication we're seeing. the duplication we're seeing. Uh but basically I'm telling it some Uh but basically I'm telling it some Uh but basically I'm telling it some something about the ACP um APIs, and something about the ACP um APIs, and something about the ACP um APIs, and there's some there's some APIs in ACP there's some there's some APIs in ACP there's some there's some APIs in ACP which also, that's another like which also, that's another like which also, that's another like capability of the client, where the capability of the client, where the capability of the client, where the client can um client can um client can um advertise that it supports creating advertise that it supports creating advertise that it supports creating terminal and managing terminals for the terminal and managing terminals for the terminal and managing terminals for the agent. Like the agent can also do it agent. Like the agent can also do it agent. Like the agent can also do it itself, of course. itself, of course. itself, of course. Um but it's a nice way uh for us to add Um but it's a nice way uh for us to add Um but it's a nice way uh for us to add some more interactivity. And so, the some more interactivity. And so, the some more interactivity. And so, the agent here decided to add a new tool agent here decided to add a new tool agent here decided to add a new tool description. Now it yeah, I'm live description. Now it yeah, I'm live description. Now it yeah, I'm live coding basically this terminal tool. coding basically this terminal tool. coding basically this terminal tool. Um and let's see if Um and let's see if Um and let's see if it actually builds. it actually builds. it actually builds. It does. Well, that's good. It does. Well, that's good. It does. Well, that's good. Um and then Um and then Um and then again, I'm going to going to restart the again, I'm going to going to restart the again, I'm going to going to restart the agent. agent. I'm going to run our demo agent, and I'm I'm going to run our demo agent, and I'm I'm going to run our demo agent, and I'm going to ask it to run sleep five going to ask it to run sleep five going to ask it to run sleep five ls. ls. ls. Let's see. Let's see. Let's see. There you go. You can see a terminal There you go. You can see a terminal There you go. You can see a terminal running, running, running, sleeping 5 seconds. There is the output. And there's Yeah, and that's it, And there's Yeah, and that's it, basically. Yeah, so Yeah, so that's how you kind of build an ACP that's how you kind of build an ACP that's how you kind of build an ACP compatible coding agent in compatible coding agent in compatible coding agent in 15 minutes or so. 15 minutes or so. 15 minutes or so. Um yeah, if you want to uh check it out, Um yeah, if you want to uh check it out, Um yeah, if you want to uh check it out, just go to agentclientprotocol.com. just go to agentclientprotocol.com. just go to agentclientprotocol.com. Um in case anyone Um in case anyone Um in case anyone wants the demo code, but please don't wants the demo code, but please don't wants the demo code, but please don't use it in production. It's all use it in production. It's all use it in production. It's all agent generated. Um it's not upload it agent generated. Um it's not upload it agent generated. Um it's not upload it yet, but it it's an empty repository. yet, but it it's an empty repository. yet, but it it's an empty repository. I'm going to upload it in a second. Uh I'm going to upload it in a second. Uh I'm going to upload it in a second. Uh yeah, thank you for listening. yeah, thank you for listening. yeah, thank you for listening. Happy to answer questions. Happy to answer questions. Happy to answer questions. That's it. YEAH. UH THE DIFFS UH YEAH, WE HAVE LIKE IN in UH THE DIFFS UH YEAH, WE HAVE LIKE IN in ACP there are multiple content types, ACP there are multiple content types, ACP there are multiple content types, and one content type is diff, and so the and one content type is diff, and so the and one content type is diff, and so the agent sends old text, new text, and then agent sends old text, new text, and then agent sends old text, new text, and then Z does the diffing for you. Z does the diffing for you. Z does the diffing for you. Yeah. Yeah. Yeah. Yeah. Yeah. Cool. Cool. Cool. Do I need to go or can I Do I need to go or can I Do I need to go or can I Okay, one more question. Yes. Yeah, the connection works over standard Yeah, the connection works over standard IO. Uh there are some folks well, I IO. Uh there are some folks well, I IO. Uh there are some folks well, I think from the JetBrains people are think from the JetBrains people are think from the JetBrains people are working on like remote uh transport, uh working on like remote uh transport, uh working on like remote uh transport, uh which we're going to have soon, I think. which we're going to have soon, I think. which we're going to have soon, I think. So, yeah. So, yeah. So, yeah. But right now it works over standard IO. But right now it works over standard IO. But right now it works over standard IO. Yeah.