# Setup Deep Research: Free, Private & Open Source ## Metadata - **Published:** 2/11/2025 - **Duration:** 14 minutes - **YouTube URL:** https://youtube.com/watch?v=sGAThYw_BsQ - **Channel:** nerding.io ## Description Discover how to deploy a fully open source implementation of OpenAI's groundbreaking Deep Research agent—all for free and with complete privacy! In this step-by-step guide, we’ll show you how to harness the same advanced research capabilities without the hefty $200 price tag. Plus, customize the agent’s behavior with adjustable breadth and depth settings so it auto-adjusts whether you run it for 5 minutes or 5 hours. 👉🏻 Text Yourself: https://textyourself.app 📰 Newsletter: https://sendfox.com/nerdingio 📞 Book a Call: https://calendar.app.google/M1iU6X2x18metzDeA 🎥 Chapters 00:00 Introduction 01:00 Deep Research 02:42 Setup 05:03 Code 09:52 Result 10:31 Bonus: API 13:02 Human in the Loop 14:23 Conclusion 🔗 Links https://x.com/dzhng/status/1886603396578484630 https://github.com/dzhng/deep-research https://www.firecrawl.dev/ https://www.inngest.com/docs/features/inngest-functions/steps-workflows/wait-for-event ⤵️ Let's Connect https://nerding.io https://twitter.com/nerding_io https://www.linkedin.com/in/jdfiscus/ https://everefficient.ai https://www.linkedin.com/company/ever-efficient-ai/ ## Key Highlights ### 1. Open Source Deep Research Alternative Highlights an open-source implementation of Deep Research, offering a cost-effective alternative to the paid version and leveraging tools like firecrawl. ### 2. Versatile AI SDK Beyond Vercel Showcases the unexpected usage of Vercel's AI SDK independently, outside of the Vercel platform, for building AI-powered applications. ### 3. OpenAI Compatibility for Custom Models Demonstrates the flexibility to use different OpenAI-compatible APIs, enabling the integration of open-source models like Llama or DeepSeek for research tasks. ### 4. From Terminal to API Explores the process of converting a terminal-based research tool into an API using Express, focusing on handling interactive prompts and potential human-in-the-loop integration. ### 5. Human-in-the-Loop for API Interactions Suggests using event-driven systems (e.g., Ingest) and webhooks (e.g., Slack) to introduce human interaction for answering dynamic follow-up questions in the API. ## Summary ## Video Summary: Setup Deep Research: Free, Private & Open Source **1. Executive Summary:** This video demonstrates how to deploy a free, open-source alternative to OpenAI's Deep Research agent using tools like Firecrawl and Vercel AI SDK. The tutorial covers setup, customization (breadth, depth), integration with OpenAI-compatible APIs (like Llama or DeepSeek), and converting the terminal-based tool into an API with potential human-in-the-loop interactions. **2. Main Topics Covered:** * **Introduction to Open-Source Deep Research Alternative:** Overview of an open-source implementation of Deep Research, avoiding the paid version's cost. * **Deep Research Functionality:** Explanation of the agent's architecture, including depth/breadth parameters, user query handling, follow-up questions, search process, and markdown report generation. * **Setup and Code Walkthrough:** Step-by-step guide to cloning the project, installing dependencies, and configuring environment variables (API keys for Firecrawl and OpenAI). * **Customization and OpenAI Compatibility:** Demonstrates how to point the agent to various OpenAI-compatible APIs, allowing the use of open-source models like Llama or DeepSeek. * **Terminal Execution and Results:** Running the Deep Research agent in the terminal, observing the interaction, and analyzing the generated markdown report. * **API Conversion (Bonus):** Creating an API endpoint using Express to access the Deep Research functionality, addressing the challenge of dynamic follow-up questions. * **Human-in-the-Loop Integration:** Exploring the use of event-driven systems (e.g., Inngest) and webhooks (e.g., Slack) to enable human interaction for answering follow-up questions in the API context. **3. Key Takeaways:** * A fully functional, cost-free, and private alternative to OpenAI's Deep Research is achievable using open-source tools. * Vercel's AI SDK can be effectively used outside of the Vercel platform for building AI applications. * The agent is highly customizable with adjustable breadth and depth settings for controlling research intensity and duration. * The agent can integrate with various OpenAI-compatible APIs, allowing for the use of different language models, including open-source options. * Transforming a terminal-based tool into an API requires careful consideration of interactive prompts and can be enhanced with human-in-the-loop mechanisms. **4. Notable Quotes or Examples:** * "What I thought was interesting is that you can run it for 5 minutes or 5 hours um and it'll just keep keep running and that that's pretty interesting to me." * "One of the things that I really love about fir crawl is you know they actually have this new feature called extract but it basically takes uh ser and puts it in into like an llm ready format." * "What's also interesting about this is you can see down here you can actually point this at any really any open aai compatibility API so you could use llama you could technically use deep seek." * [Regarding turning the tool into an API] "...we don't actually know what those follow-up answers are going to be so how would it actually handle that?" * "You could actually use wait for event in ingest...where you could actually wait for an event to be triggered that would say that uh this follow-up question was answered." **5. Target Audience:** * Developers and AI enthusiasts interested in open-source alternatives to commercial AI tools. * Individuals seeking cost-effective and private solutions for conducting in-depth research using AI. * Those familiar with JavaScript, APIs, and cloud deployment concepts. * Individuals exploring ways to integrate human interaction with AI-powered applications. ## Full Transcript hey everyone welcome to nerding IO I'm JD and today what we're going to look at is an open-source version of Deep research that uses fire crawl and what we're going to do is we're actually going to go through a bonus round of connecting it into a API so that you can not only use it in your terminal but you could actually try and use it in an API and even look at like different ways that we could add human in the loop with that let's get into it all right so I actually came across this on TW TT and it was uh somebody's implementation or David's implementation on deep research and the ability to to kind of replicate this without having to pay the $200 um marker and this is like really great to see all these different open source tools that are coming uh you know with the advancements of AI what I thought was interesting is that you can run it for 5 minutes or 5 hours um and it'll just keep keep running and that that's pretty interesting to me so we're going to take a look at the uh the repo and the first thing that I kind of noticed was you know it has this great graph of like what is actually going on here so you can Define the depth the breadth and then you have your user query it also has a step in here where it's going to ask you follow-up questions and then it's going to start doing its research and then it's going to start doing after the the research it's going to start going through this process of ser so uh search engine res pages and how it processes those result and then the directions based on the learning from those searches and then it kind of uh continues to do that depth and refine its search and then produces a markdown report and what it actually does in order to do Ser is it's actually using something called fir crawl and so one of the things that I really love about fir crawl is you know they actually have this new feature called extract but it basically takes uh ser and puts it in into like an llm ready format you can actually go and crawl other pages and do all sorts of things with this but one of the best things is it's also open source so at this point we could host fir crawl as well or run it locally and then we can actually run our deep research as well either locally and one of the things that is uh going on here though is when you go through and actually deploy this currently it only runs in the terminal and so we're just going to kind of look at what that looks like and then we're also going to do uh a bonus experiment of just seeing what would it take to make this an API so the first thing you're going to need to do is just go ahead and clone the project and then pull it into your ID so I already have this set up and I wanted to show the dependencies because I also thought this was really interesting that you know of course it's it's all written in JavaScript and so it has the fir call uh uh package here then if you notice it's actually using versel uh the versel AI package and the versel open Ai and I find that really interesting because you don't see a ton of examples of using the versel AI outside of versel but it can actually be used independently um it's in my opinion really great SDK uh some of the advancements that they're doing with uh verel 4.0 is is pretty awesome so the next thing to kind of look at is what can we do with our environment variables so the first thing is again you can uh for fir crawl you can uh just put in your key you can also put in the fir craw base URL right in case you're running locally or if you're running uh your own instance otherwise it'll default to uh to the fire craw PID service you put in your open AI key but what's also interesting about this is you can see down here you can actually point this at any really any open aai compatibility API so you could use llama you could technically use deep seek you could really use anything to uh any compatible open AI endpoint to actually pull this in so this is another reason where you you can use open source models right out of the box for our test we're just going to uh use uh 03 mini just because that's the default but super interesting that you can actually pull uh in from your local or you could actually pull in from other different models so what we're going to do is we'll go ahead and we'll uh take a look at what's going on under the hood and we're going to see that it's going to ask us a bunch of questions in this run uh in this run and what that means is that we're actually interfacing with this through the terminal so we're going to go ahead and do a default run and we'll see what this looks like so I'm just going to go ahead and do npm Run start because this is the default and we'll see what we get so as you can see what would you like to research so uh one of my interests is robotics so we're going to look at robot Trends in 2025 and what breadth do we want so you can have uh you know as high as 10 the default being four we'll just kind of keep it with the default for now again this is this breath is going to is going to tell you how deep the research should go and how long it should go right and the the higher that you have the longer that it's it's going to same thing with the depth right we have the ability to go uh through 1 through five the default being two so we're just going to say two for now and now it's actually created creting a research plan behind the scenes but it's going to ask us questions and these questions change every single time it's not the same questions it's taking your query and then defining what questions should it come up with in order to uh refine it its search so I'm going to say uh industrial actually I'm going to say AI human and see what even though it's not on the list see what comes up with uh and so again it's going to ask us a follow-up question and I'm going to say market growth and are you looking for Global Trends I'm just going to say us and now what it's actually doing is going through and building the topics for us so as you can see it's starting to put together queries and what its research goals are and while this is running I'm actually going to go through some of the code so when we're looking at again we have multiple different providers this goes back and forth to theel piece we can actually look at the prompt I also found this really interesting so that you have the date so it's actually aware of the time right because llms don't understand that you have to actually send that information and then it's put this PR we could actually uh change we could also add you know our own own personalization to this if we want and then the Deep research itself again we're using fir craw it's going to generate the Ser queries this is what we just saw up here and then it's going to do what it learns right and then give itself feedback based on those learnings of what it went out and crawled so as it's going through and it processes the ser and then this right the final report will come back after all of the iterations it's actually getting again this is our feedback right so the questions it asked in the beginning and then it's taking all of that into how long it should actually research and right here we have our new breadth and new depth and we're continuing to process and so I'm going to go ahead and pause this until it's over and then we'll see what the results are real quick everyone if you haven't already please remember to like And subscribe it helps more than you know also please go check out text yourself it's a simple application that I built that helps keep me on track all you have to do is SMS different tasks and reminders that you need to be sent back to yourself with that let's get back to it all right so it went ahead and returned the result and we're going to actually see what this looks like so in the termin it's actually showing us all the let's just bu this up actually since it's so big it's actually showing us all the data that it went through so once it actually got through these learnings it started to actually write all of the learnings out the things that it understood right it visited 43 URLs right so in fir crawl I mean you again you get 500 for free but then if you running this locally or um through open source but it's 400 different requests in order to scrape all this information or not 400 40 um and then it's actually going to generate the report so this is the final report it actually takes all of this and outputs it as markdown and then it's actually going to return a markdown file right here this output file and so we can kind of see what the actual report is and it's pretty in depth right like that's a pretty long report on its findings um I would say it's more in- depth than things that I've seen with with uh different GPT uh outputs like this um which is super interesting but we know it's a little bit limited right we know that it's limited to the terminal so what if we just uh turn this into into an API so I went ahead and I used cursor and I just had it generate uh an API for me and so it knew right that we need to provide a query we need a bread depth and then the follow-up answers this part's interesting to me because we don't actually know what those follow-up answers are going to be so how would it actually handle that so if we actually look in this the API this is just a an Express app that it generated we can see that it's pulling the parameters that it expects we could actually add you know some authentication here just looking for like a a header and and an xbi X API header um but it still goes through and it takes the questions and then it looks for those questions and you can pass an array and if it doesn't have the the question for that answer it's just going to say no answer provided this is still a bit risky right because we don't actually know what the questions are going to be coming back so by default it'll give us an option to say that uh to go ahead and use your best judgment right or like it I'm not going to provide any answers or we could ultimately turn this into a cumed loop and so let's go ahead and run this API and try Bruno and we'll actually see what uh some of the results are there so if I just come back to my terminal and now that that run has we'll do npm run API again remember I built this so this is not a part of the uh stack but what I had to do is I had to just generate this and we can go into Bruno and we can actually say here's our requests here's our breath and here's our follow-up answer again I don't know what these will be so I'm just going to say use best judgment and we can see that this is going to take a while right like it's going to go ahead and it's just going to start going through the motions of of what it's doing and we'll see it actually start returning the information and while this is processing since we know that this is going to be a problem we don't know how to do the answers you could either do this with a human in the loop or some sort of chain so one way I was thinking about doing this is you could actually use wait for event in ingest ingest is essentially a background queue also has an open source version where you could actually wait for an event to be triggered that would say that uh this follow-up question was answered and so you could send that information out via email you could send it to uh you could send it to slack like in one of the previous videos I did you could actually do a web hook into slack and have that be your chat uh implementation so that you could actually take that and respond to it in for instance like a a slack thread so I thought this would be an interesting way of how you could actually introduce uh the the a uh human in the loop for something that is going to ask you questions but still make it an API so let's just take a look at this and see what's going on behind the scenes so again it's actually going out and it's doing all the learnings and the breath and the depth that we wanted to see and when this finish running finishes running we're actually just going to see it return the markdown in this particular event we could actually then take that and put it through something like NN and actually publish this information or this search that we actually found all right that's it for us today everyone so what we went through was an open source version of Deep research how you can connect it and what it's at what the guts actually are using Firebase and then how you could also actually turn this into an API really simply that happy nerding --- *Generated for LLM consumption from nerding.io video library*