Building Agents on Farcaster with Privy and Neynar
Farcaster Agentic Bootcamp · 7 Apr 2026 · 45:19
Limone hosts a hands-on session of the Farcaster Agentic Bootcamp, opening the second week ahead of the online agentic hackathon. Working from a forked open-source repository, made compatible with Privy, he shows how to create an agent that interacts on the Farcaster feed using Neynar documentation, with Cursor and Claude Code in the loop. The week also looks at commerce, identity, reputation and virality for agents.
Speakers
Topics
From Farcaster Agentic Bootcamp, hosted by Urbe.eth.
Transcript
So hello everybody. We are back with Farcastaster Agentic Boot Camp um second week starting today. We just finished Easter. Somebody had beautiful lunch and celebration and today we are celebrating this also the start of the AATON. So the Aenticathon of Farcastaster started officially today. It will be going on for two weeks. Um some people were asking why like keeping to do these sessions even the acadon even if the acon started it's because I believe with everything that we've seen last week you have enough tools to start building something applying everything that you
learned re-watching the workshops the transcript and the slides and and actually start building small pieces of your idea and this week we are going to go deeper in some topics like commerce identity reputation uh virality also. So something like cherry on top that you might want to add on on your projects like down the line. Today I will be hosting the session. It will be a very hands-on session uh on building a an agent on forecaster with nar and prey. So I spent the whole morning here in Lisbon um forking a repository by re uh I think it's a very
recent repository uh that I will also show of course uh let me pick uh GitHub here and I made it compatible with preview so that we can put all these pieces together and see how we can actually um make an agent create an agent that inter interacts on the feed. Uh I'm going to use uh both like code uh and cursor. Uh I will also show some code that's why um I'm going to use uh also cursor. Um of course like this is all registered. The repo that I created is open source and so you can also pick that later, feed it to your agent, your
code and whatever and and get started with it. So let me start sharing my screen. Perfect. All right. So please interrupt me whenever uh you feel like uh you're you're missing something. So this is a very like impromptu session. Uh I'm going to start with uh showing you uh this documentation by Nar on uh yes autonomous agents setup. Uh I will also share this uh in the chat. Let me have it here.
So this is our starting point. This is where this morning I started. I I was reading all this documentation written by the Nard team. And if you see here, they also have a public repository for caster agent. What is this repository about? I mean, we we can check it here, but we can also check on the on the documentation. But the main goal of this repository is to help you ship an agent on forecaster that uh interacts with people on the feed. And of course, you can tweak on on these interactions. You don't need an NER API key for this uh repository and also for the workshop because everything will be paid by the funds that we will
put in our wallets and so it's very it's really autonomous of course like when it comes to setting up the wallet uh the Ner team used a simple um private key creation approach. So they used ethers to generate a wallet locally and uh after finding that wallet they with a script they are able to create a forecaster account set up the web book interact with ner and forecaster and blah blah blah and make it work. The main difference of what we are going to do here is that in this step oops in these steps instead of generating the wallet with interest we are going to use preview. So I'm also going to use the
preview dashboard and the preview SDK and uh environment variables and whatever to set up the wallet. We will fund the wallet. Um we will run the local scripts to create the account on forecaster interact with Nar using X42 uh and posting our first cast. And so the agent will be posting the first cast on the feed. Once that's done, we will be setting up the ner web book and the ner web book is needed uh because in this way we can listen for events coming in from forecaster. So people mentioning the agent of course like this is the simplest experiment that we will be
running uh and the agent reacting. So sending a simple reply that's what we want to do today. So you can follow of course to start if you feel like if it's simple later after the workshop you can follow the guide from NAR and use the local setup without preview and then later use uh preview. Why I told about using preview here? Because preview of course will be offering bounties and prizes for the the arathon and I'm going to announce the the trucks soon. And so of course if you're using preview for the arcaton it's more likely that you're going to win some some money out of it.
And so um here nar like describes all the uh steps. So registering an FID an account on optimism, adding a signer key, setting up forex 402 micro payments and all the contracts and addresses and and this page is thought to be sent to your code. So you can pick it up here opening code and you have a bunch of um copy page uh the MCP server you can connect to cursor whatever. Um, I already did that and put every all the results in the in in the in the repository. So like most of these steps are are done. Let's get back to cursor.
Um, so what I'm going to do of course like here you will see a bunch of um sensitive variables. Uh they are actually they are real but they they don't own any any funds. So, uh, if you want to steal them watching the recording, it's fine. What I'm going to do now is setting up, uh, preview. Um, so to set up preview, um, why I'm setting up prey? Because to create the forecaster account, we need an Ethereum wallet, an Ethereum wallet with funds on uh, optimism. So, what I'm going to do now is um creating a new preview app.
So, I'm in the preview um dashboard dashboard.preview.io. Um I can create I I've reached the maximum apps. So, let let me use the existing one that I created today. So, you can create a new app with a random name title. And uh the first thing that we want to do for our agents is the wallet infrastructure part. So uh I know actually if we go into app settings this is the most important thing. So API keys for preview. You get the app ID and the app secret. So you copy these and you copy this and you paste them here. Preview app ID
and preview app secret. This is what will allow you to use your pre account basically. Once this is done, we can create wallets as many as we want. Uh to create wallet, we go in the uh authorization tab. And so we are creating a new key that authorize authorizes an agent to use a wallet. So uh this is going to be called agent demo. We create a new key and we get an ID and a private key. This private key is the uh preview authorization private key.
It's what we are going to use for authorizing transactions. And then we have the ID. This ID is the preview owner ID. And don't worry if you miss this. There's also a read me and an agent guide so that you can um follow these steps later if you miss some links and stuff. It's all it's all in there. So once we set up the connection with preview the wallet what we want to do uh actually the the private key what we want to do is actually generating a wallet starting from this private key and to do so we have a a script a command to run in the uh let me okay much better now
uh yes oops let me so There's this uh script here. Um where is it? In the scripts uh folder in the in the repo that I created, there's um a script called create preview agent wallet. Once you run this script, oh, what's happening now? Once you run the script, we should see um let's see what happened. I think I broke something. But basically, it should output us the uh wallet address and the
wallet ID. The wallet ID we need for the environment variables so that um we can use that wallet indeed to to create the uh Oh yeah, I'm in the agent service. Good point. Thank you. So dumb of me. Perfect. Thank you so much. Um, so preview wallet ID is this variable here. And if you remember, we have a preview wallet ID environment variable missing. So we set the preview wallet ID here. Then we have the uh address.
Let's stop cursor now uh and actually create a new uh Okay. So now we have the address. Once we have the address, we can finally create the account. There's another um command to to to call and it's called npm run auto. npm run auto runs all the um command line and API calls that you need to create the forecaster account. So I run this and it should fail. Why it should fail? because the wallet is empty of course like the wallet is empty so it cannot create uh the account on forecaster now it's like trying it first
like tried on it's trying with the RPC but basically yeah it says please fund at least one of the supported chain Ethereum optimis base arbitum or polygon recommended balance um and I'm going to send this on base once we send this on base. We also have bridging in place here. So as long as we send Ethereum on base, the script here will also bridge to optimis register the farcaster account on optimist because again the forcaster uh registry is on optimis. Uh so once that's done um once you fund this wallet and I'm going to do it now.
So sending small amount of it The script should work and what's it going to do is again like bridging from base to optimism some funds uh it will keep some it on base and swap it to USDC because we are going to use USDC on base for the X42 API interactions for NAR. Uh I don't think so because I about test net uh saren I don't think so because um I don't even know if like there are like working registry contracts yeah on for forecaster on test net so it's just $1
of it on base so it it should be fine. So I'm npm runo again I I filled the the balance and it found it. So now it's using relay is um is a protocol that I often use for bridging and it's automatically moving funds to optimism. After moving funds to optimism is also making sure that we still have some USDC on base because we need USDC to do some stuff with ner because the payments to ner are not coming um via the API key but via exporter 2. So as you can see it's been doing a bunch of stuff. So registering FID and we have it here. Um adding signer key and so it's
authorizing our um previous signer to cast on behalf of that account and finally is waiting for the app confirmation. Once that's done the agent the script in this case should publish uh a cast on the feed. So let's wait uh a few seconds here. Okay, verifying cast. Perfect. So, let me open this link and I will also show it to you here.
Actually, let's make let's move it here. This is the account GM. This is this account was created autonomously by an AI agent. That's like a simple text that we send. And then it asks me set your handle display name bio and optional profile picture. So we call this agent lemon demo display name agent lemon demo and then bio. This is a testing agent from the castaster agentic boot camp profile picture. Um let's keep it for now.
So now it's setting all these uh variables for us and synchronizing with the with the ABS again. And once that's done, our agent is up and running. Uh actually actually not up and running like the account is set up on chain and on the snap chain for the ABS to know. The next step is actually setting the agent up and running on Versel on Versel. Why? Because it's again it's um following Dish uh recommendation earlier last week. We want to have the first version of our agent running on a serverless environment and so just
making sure that the agent can receive web hooks, react to event and reply. Uh all right. So let's see. Yeah, this worked. So, we have agent lemon demo uh agent lemon demo and this is a testing agent. So, everything was set up correctly. Another thing that it did in the meantime uh and this is useful for the versel setup that we're going to do is that we also saved some credentials locally. These credentials are not going to be pushed to the repository, not going to be pushed to versel for safety reasons, but we have them locally.
So in this case, our FID uh is this one. Uh so as you can see, I was registering a bunch of FIDs earlier, but the last one is the one that we just created. So locally we are storing data about the FID the custody address the custody back end type which in this case is is preview because if you want you can still use the same repo with the you know like local private key minimum setup we have the preview wallet ID uh we have the signer public key and the signer private key uh and in particular like the signer private key is important because it's what we need to set on versel when it comes to uh having the
agent posting something on behalf of the agent. All right. So this is the first step like we have the agent set up on chain account registered on forecaster. Any uh any question? Um any other question so far? Let me see if in the chat uh >> is this registration uh different than a human? So is there a distinction on the account layer? It's just a way to do it.
>> No, no, it's um no distinction. So it's a totally valid um account. Of course, like it's an empty account, zero following, zero followers. So you need to build a reputation for it. Um, but it's the same. The the main difference is that when you create an account via the the mobile app, the custody wallet is stored on your device uh local credentials. And so that's um that's actually how you can cast uh and authorize other signers uh from the uh from your mobile app. In this case, the custody wallet authorized to create new
signers. The signers are the accounts and the keys that are able to sign, post, publish messages to the network. They are generated and stored on the preview um server side. um which to me is much better than u local private keys because of course like local private keys it's the bare minimum but um of course if you lose that key there's no chance you can um uh recover the account let's say um Sonia does this environment have to be running locally uh no so what we're going to do Sonia now is deploying the
agent on Versell. We we launch the agent on Verscell and it's going to be serverless and this means that Versell is only going to process uh and compute some stuff when we want it to do so. So BNER we can define when we want our agent to do some stuff. So we want to listen to certain type of events. So if somebody mentions us, if somebody replies to a cast, if somebody mentions a keyword. So like very specific events we can also decide to listen to everything and of course like we will process more messages but the core idea behind using Versell is that the agent is computing only when um we want it to do so so it's not 247 actually um and
this is actually responding to z uh as well uh of course you can also have a 247 setup um But as Dish was suggesting earlier last week to start like a serverless environment is should be cheaper because you don't need it to be like 247 up and running uh and spending let's say a fixed amount and then of course like it's it's your decision because like with versel you can have a more like pay as you go uh setup. So the more people are calling the agent the more you are going to pay. If you use a virtual private server, VPS, whether it's railway, AWS,
you're going to pay a fixed amount whether the agent was processing some stuff or not. So, it's also up to you. Um, in this demo, we're going to use uh Versel. Yes, please. So when you say serverless versus um a VPS um the functionality of the agent is limited when you're serverless but you can start at that level and use versel if I'm understanding correctly. >> I I won't say that the functionality is limited. Uh you can >> so you can get almost the same functional. Okay, cool. That's good to know because I jumped right into the server when I started and it was uh its own challenge. So that's that's cool to
try out. >> Yeah. Yeah. All right. Um any other question before we move on with the actual uh Versel deployment? No other question. Perfect. So um in this same folder I don't say is that egress fees? I don't know. Yeah, it's like if you go aboveress, yeah, outbound traffic or if you go above the threshold that you have for your current plan, of course, they charge on top. Um, and so I I when I was building farville last year, we paid a
lot of money just because of that, but we were processing like crazy amount of like requests. Um I I think that to start Versel is the right option. Then you can easily move out of it once you you have a more solid agent use case and end usage as well. So moving on uh in this same folder uh and repository we have another folder. It's called agent service. And the agent service uh is using uh a bunch of stuff that we also have for used to to create the the original account.
But then is also exposing two APIs. Two APIs that are the ones that that are going to activate our agent when we want it to do so. The first one is the web book. So a web book is an endpoint that uh we can have narr calling whenever we want. So we can tell narr to call our API webbook endpoint and activate the agent when somebody mentions our agent, somebody reply to it, somebody likes a cast, somebody post a specific keyword and so all the code that that is contained in this webbook.js JS um is
defining what the agent does when it gets pinged. So when the right event arrives to the web hook, we are deciding here how to process it. So for example and and you can find all the comments here. So um we are making sure that the event is in the right um let's say has the right payload type and and metadata. We are making sure that the event is only cast created. So if the type of the event is not cast created but is um and and I can show you what does it mean. So if we go on ner uh dev.n.com ner.com.
We go on the webbooks page and on the webbooks page you you can create multiple ones. Uh this is the the current one that I was using and as you can see you have a bunch of events that you can filter. So let me zoom in a little. So user created we can get the agent do something when a new user is created. uh when a user is updated. So maybe they update their bio, they update their uh name, whatever when a cast is created and and this is the most interesting one to me because you can uh interact with people.
Uh so in this case I was filtering out cast only coming from lemon. So from myself so I was the only one able to talk with the agent basically because if I ping the agent, it replies to me. Um, I can decide the agent to um get pinged when a new cast uh gets created in a channel, when a specific user gets mentioned, a bunch of things that you can see here. Um, we can also exclude some users. So, not only like filtering in only the users that we want, but let's say that uh I don't want um another user um being able to uh interact or or trigger the
agent. Uh we can do something on cast deleted, reaction created, reaction deleted, follow created and deleted, and also trade. Oh, this is this is an interesting one. So if a user on the network trades something uh the agent also maybe can post a comment about it and of course like when these events are um created and sent to the agent we have all the data about them. So if a cast get created, we have the author, the text, the links, the uh embeds, everything related to the cast is in there. And so getting back in here where I'm filtering only uh event types
of cast created. So if if it's not a cast created event, I don't want to deal with it. uh if we are if we go over that uh branch then of course there are other conditions. So another thing that I was checking is if the agent should respond to a specific cast and so we can have two modes. It can be like reply mode to all. So like reply to everybody or reply only if the agent gets um mentioned directly and so a bunch of like you know conditions that you can enforce and and of course once that's done you can get the author username the cast text the ash the fid
and everything that you need to generate a response um even extracting the image urls to generate the response we are using open router Open Router is my favorite um LLM API gateway. So, it's cool because with one single API key um you can access multiple models. Uh, of course, there are ways I didn't have time, but there are also LLM providers that allow you to pay with XO2 directly. I didn't have time to set this up, but I think it would be something cool to build for the Aaton maybe or to extend the repo. So instead of using
open router to process the reply and generate a response with AI, you can pay um for example I was called it Lucid I think. Yes. So I know that Lucid has um has a has a bunch of services and among them there's also um LLM uh and inference and so you pay Lucid APIs with USDC on base and it allows you to compute u AI with AI and so here I was using open router and this is all the code that gets the uh actual content of the cast.
So their message was blah blah blah. Uh and then it asked the LLM the AI to create a reply to that. And so for example, if we go to uh my profile again, you can see that I pinged another agent earlier. Um and so I said, "Agent Lemon, how are you?" And Agent Lemon with some issues to fix. Still, it replied, "I'm doing great. Thanks for asking. how about you? And so this is like the simplest thing that that you could do here. And once that's once the the response is generated, we have the post cast uh function and this postcast function
again is using NAR APIs through X42. So our preview wallet that we funded earlier will also be used to post uh stuff on narr to read content from ner and forecaster. Uh the other API end point that we have is a chrome. Uh for those who are not familiar with chrons uh they are um scheduled jobs basically. So you can decide to activate or trigger your agent uh periodically. So I want my agent to I don't know do something every hour and then post about it on forecaster. So this is another um approach that you can have to to trigger something and you can
use crrons, you can use web hooks, you can use a combination of both. Um but it's basically the same thing. Um it's just about the use case that that you are building. Any question um so far about this brief introduction? Am I going too fast? No. Good. All right. Um then uh let's go on the uh Versel uh deployment actually. So if I go on in here,
I have a Verscell.json and this Verscell.json JSON is defining some stuff and functions for the agents, the the chrome schedule and and everything. But then I also have this package.json. Package.json is what allows me to um not only like run the process locally but also to deploy to Versell. So if I click um mpn run deploy, it's connected to my uh Versel account here. Of course, if you're not connected, it will prompt you to to connect via via web.
And it's running a a deployment. So, going to versel agent service. You see, it's redeploying the the new the new service. What we need to do once the service is deployed is actually setting up all the environment variables because these environment variables is what we need to make sure that the agent has access to the wallet has access to the right account the all the authorization that he needs and so make sure that these variables are never shared with anybody universal environment variables they are
safe uh but again I'm showing them here just for you to see like the whole process, but usually like these should be like very sensitive ones. Um so if we go inside agent service, you can see that there's another environment file. This environment file has a bunch of um variables. First one is the open router API key. So you go on open router, you get your API key, you charge it with one, two, $3, whatever, and you paste it here. Then you have the preview variables. So again, you need to fetch the preview app ID, the preview app
secret, the wallet ID, and the authorization uh private key. So let me get the the wallet ID and the prey authorization private key. Then we need to set the agent FID and the signer private key. The signer private key is in the credentials. So make sure to pick the one attached to the same FID signer private key. And we copy it here.
Uh yes. And then um CR secret for now is just secret. It could be like a random string. It doesn't matter. Um and then nar web book secret. This is important because it's what we use to authorize ner to trigger our bot. So if we go back to the ner uh dev panel on the setup tab, not the filters, the setup, we have a secret for verification and it's exactly this one. Okay, so we set the secret in the environment variable and then here on the target URL we should put our versel
web app URL and slash API webbook. This is where the agent is going to get trigger where the agent is expecting to get trigger. So um most of these variables I already set on on Versel from my previous deploy but I need to change the um the wallet ID for sure. So I can go in here update the wallet ID and then I need to update the authorization private key and also the agent username. So agent username was agent lemon lemon demo.
Yes, perfect. The signer private key is a new one. So this will be empty for you to start with. Uh I'm just replacing them uh from the previous deployment. the agent FID custody back and uh yeah this is all the same. So redeploy. So we wait for uh versel to deploy the new build and then if I ping agent lemon
demo I should receive an answer from it. Few seconds. Oh, somebody spent a lot of time fix. Let's see. Perfect. So agent lemon demo, how are you today?
Let's go back to our cell and see if it's received a book event. Oh no, it's not this one. Here we go. Yeah, it still has that same bug. So it's tagging me twice. Uh and we can check why. So if we go in web book when it generates the response uh somewhere is
attaching. Yeah. And maybe we can use code for this. So let's go on full clothe. But I mean right now okay I say can you make sure the uh open router generate response method reduces clean responses without double or wrong mention. ions and usually I also
attach a screenshot. Let's see if it also listen to reply. Doing great. Where what are you working on today? Of course, like the agent when we we launch it, when we register it, you won't see notifications uh first because it's it's filtering out spam. So, make sure to just go check inside the actual um
the actual cast. Yeah, you see there was a there was a problem here in submitting the cast because I I don't have more money on on the wallet. So, let me get back to the to the preview wallet. Let me send it some USDC. What are you working on today?
Let's hope it works this time. Okay, this should be fixing the responses. Tokens that are used are coming from cursor plan. Where can you see the usage? Um so in Corser yes they are they are coming from my cursor plan. Um and you can see usage in the settings of cursor and the same goes for code. They are two separate plans however. So the the ones that are here in the terminal uh they are from code uh I was using cursor because I I finished my session uh earlier.
Uh okay. So, I'm redeploying to see if it gets fixed. Oh, and it worked this time. So, I sent USDC and now it was able to uh to reply. Of course, the the the fixing uh is still going on and it said, "I'm having it on new project on digital art. How about you?" So, let's wait for the final redeployment if we fix these uh mention issues and and then we're done. Okay. Uh I'm working on you actually just
given you life. Ask him if he is a good robot or a bad robot. Okay, let me wait for the reply. And it's also super fast in replying actually. Yeah, I wasn't able to fix the mention. But are you a good robot or bad robot? Um,
but yeah, that's uh that's pretty much it. That's what I wanted to show you. Um, let me also show you the the repo and give you the the link. It's called forecaster agent and it's thought to be just a starting point. So from here you should have enough space to do whatever you want with this agent. So this is just simple like reply response. But imagine that when I don't know if I if I trigger the agent maybe I want it to generate a video an image. I want you to run a research on Google maps. Um thank you protocol dev for for the tip
like for spam cate categorization. That's a that's a good point. So, you can really do a bunch of things starting from here. And I'm definitely aiming to be a good bot just here to chat and hopefully make your day a little brighter. Nice. Um, so everything is on this repo. I will also push after the after we close the session, I will push the latest update that uh we we tweaked during the live. Um, oh, I didn't know it was Cassie.
Nice Cassie. Um, and yeah, so you can check everything here. Uh, it's describing most of the steps. I will also try to make them more explanatory. Uh, you are free to uh fork this uh make it uh with whatever like wallet provider you like. Um, extend it with everything you want. Uh any other question before we wrap up? >> Sweet. So let me stop uh presenting.
Amazing. So um I'd say thank you everybody again for connecting today. Uh I don't know if you're still celebrating Easter or or not, but uh it was lovely session. Hope you enjoyed or any other question or doubts or issues that you find while trying this out, feel free to ping me on the Telegram group. So give me a second. I will also post the Telegram group link on the group chat again.
Uh so join that group. Also, if you're attending the AATON, that's the main group that we're going to use. Uh and yeah that's it for today. Tomorrow we will have a session around uh aentic commerce. Um so things will get more and more interesting. So maybe after like today's session that you know the basics tomorrow you will learn about some tools that you can use to do like actual commerce and negotiation with between agents on the feed. Um and then actually since Cassie is here I didn't yet announce it. uh because it's uh some recent news, but Cassie is going to run the the last session this Friday on multi- aents uh system. So that will
be the cherry on top of all the other session that we've been running. Um very grateful to have Cassie running it. All right, so thank you everybody. I will stop the uh recording now and we'll see you tomorrow. Chiao.
Related talks
- Farcaster Building Blocks
- Agents 101
- Multi-Agent Systems & Open Coordination
- Building AI Agents with XMTP - ETHGlobal Bangkok 2024
- Give Your Agent a Wallet with Privy
- Building AI Agents with XMTP - ETHGlobal Bangkok 2024
- Agent Bootcamp with x402 I Lincoln Murr
- The Trustless Agentic Economy with ERC 8004 and x402 I Ed Marquez
- ASI Workshop I Rishank Jhavar
