AI Agent Generated Podcast using CrewAI and ElevenLabs

Build an automated podcast generator using CrewAI agents and ElevenLabs that converts PDFs or text into a two-person dialogue and synthesizes it to MP3. The system uses OpenAI o1-preview for summaries, Claude Sonnet for script enhancement, and ElevenLabs voices like Julia and Guido for audio generation. A live demo shows the full pipeline turning a workplace productivity paper into a finished 4-minute podcast.
Chapters
Hi there. In this video, I'm going to show you how you can create your own podcast generator. So you can give it PDFs, text files, Markdown files. It generates a summary of that, and then it generates a transcript between 2 individuals discussing the contents of that document. And then it generates an MP3 of the full conversation. So let's get to it. Well, I'm sure you're wondering, well, this sounds like NotebookLM, right? From Google. Yes, it does sound like NotebookLM. And we're only going to focus on building the Deep Dive section, which is the podcast section or the voice, 2 people talking together about the document together here. So if you're not familiar with what Deep Dive is or NotebookLM, this is a quick intro of what it is. So essentially, if you go to notebooklm.google.com, it will show you this section where you can actually upload a document like a PDF file. You can even add your copy text. So essentially copy your text, paste it in there, or connect to Have a YouTube— connect to a YouTube video, websites, Google Docs, anything really. Throw it in there. It's going to do a synthesis. It allows you to chat with it here, just like regular RAG, for example. But then it also generates an audio of it, of 2 people discussing that specific paper, in this case, which is the deep dive. We're going to focus on only recreating this deep dive section. And let's take a listen to how theirs sound, and then we'll compare with how ours sound. It's not going to be as good. But theirs is much better because of course they focus on the quality there. But let's, let's give it a quick listen.
And have you ever, like, gotten so frustrated trying to find something, some specific information buried in just tons of documents?
Oh yeah.
You know, keywords, keywords are helpful, but like, yeah, what if the most important clue is actually like a chart?
Right. Yep. So You can tell it's pretty good. They have their own voice synthesis model there and it's pretty good. Sounds very human interaction style-like. We're going to try to replicate that and we're going to use ElevenLabs for our voice synthesis. So let's get started. And as always, you'll find all the code that we're going to be going over today in the GitHub repo. And I'm going to add the repo in the descriptions below. So the goal of this really is to show you what the code does, explain it to you, and also For you to understand what each section does. So that way, if you go and clone this code that I have and actually try to edit and add some of your flavor, you know what exactly is happening and maybe help you troubleshoot the problems that you might have when you're trying to add more flavor to this codebase, for example, or just trying to run it for that sake. So first of all, as always, I also, I like showing you what the tree structure will look like. So essentially what files we have and what do they do and why you need them. So let's start here with the virtual environment here. I've talked about virtual environment. If you're not familiar with it, think of it as a box. You have all your dependencies or libraries installed in there. And so if you don't have a box, you can just install it everywhere. So it's like a mess really. It could affect other projects that you have that maybe have dependencies that don't match whatever that you need for this specific project. So you just need that for that purpose. And then I also have here a folder called knowledge. And essentially this is where you add all your documents that you want to create a podcast out of. PDF, text documents, Markdown documents. This is where you dump them. You dump them in here under the knowledge folder. And you also have the environment variables which you would need for this code to run. And I'm not going to show you the .env that I have because that has my keys. But I created an example here that you can actually just replace this with your keys. So for example, OpenAI API key, just replace OpenAI. Cerebras, we're not going to use it in this example, but If you're going to use them, have them in there. I have ElevenLabs, I have Serper API key. This is for searching the web, Anthropic, and then Ben's voice and Claudia's voice IDs. These are from ElevenLabs and they have really good documentation. You can figure out where you can find those within ElevenLabs. And so the .gitignore here is really just everything that I don't want to commit to GitHub, of which one of them is that API keys that are under my environment variable and also my virtual environment. I just don't need to Commit those to push those to my GitHub repo. So I'm ignoring that. They will be ignored during that process. And then there's this podcast generator where we have all our code that we'll be using to generate the podcast. And then we have the README, which basically just walks you through the steps of how to set up this project and run it on your local machine. So please refer to that whenever you're running this, on this video as well, of course. And then the requirements file, which has all the requirements that will be needed to run this project. So of course you have CrewAI, which is an agentic framework, and we're going to be using agents on the backend to actually orchestrate all of these things together. So we just give it the PDF, it does all the work on the backend. At the end of it, we should just get an MP3 file, one single MP3 file that we can listen to. That's what the agent is going to do in the backend. And then we have ElevenLabs. Of course, this is for voice synthesis. It allows us to use AI-generated voices to speak on our behalf. We give it text, it generates audio on the other side. Python.env. This is just for environment variables. And then PyDub for audio enhancements and editing here and there. And then we have Pydantic models. This is just to make sure that maybe our output gets structured in a certain way and consistently. So I'll talk about that a little bit as well. And then we have tools. These are essentially what is required by the agents. So agents require tools. So you can think of agents as humans or people that work in a at a company, for example. So if you work at a company, you have a goal, you have a specifically, you just have all the required job requirements. You have objectives that you need to achieve and your story, your backstory. Maybe you're an engineer, you're a marketing person. So essentially you also need tools to help you do that job that you've been employed for. So essentially what we're doing with tools here, the 5, Basically, we're creating the tools that the agents will need to accomplish their task of generating the podcast for us. And we'll go into detail on that. So that covers our tree structure. And so now let's go ahead and look at the code directly from the podcast generator. All right. So from up here, this is our podcast_generator.py file. And let's walk through the imports. So we're importing CrewAI. So from CrewAI, we're importing an agent. So think of it again as an agent, as an employee, and then the task, which is essentially What the agent needs to accomplish or guidelines, set of instructions the agent needs to tackle to actually produce an output. And then we have a crew, which is more of like a representation of the entire— so if you think of it, when I tell you, hey, who's in your crew, for example, right? It's probably you and some of your friends and things like that. So same thing here. Crew is a collection of agents that perform a specific given task at the end of the day. So for example, here we have Podcast generator crew, and they go ahead and just generate podcasts for us based on documents. So that's their job. And then process is how these agents are actually going to generate the final product or how they're going to accomplish the tasks. In this way, in this process here, we are doing sequential, which is essentially one agent takes on a task, finishes, passes the next one all the way down to the final person. There's different processes on how to do that. There's hierarchical where I call the shots. Who does what. And then there's also like, we all do it parallel. So there's so many different variations of that. And then LLM, of course, that's pretty self-explanatory there. And then we have CrewAI Knowledge. So this is where it takes in the PDF knowledge source. Essentially, it abstracts away the work of us passing in the PDF and doing RAG on top of that to generate the summary and all that. So this portion here will do it for us. We just pass it to this class, PDF knowledge source, and it will handle all the processing, chunking, putting it in Chroma database and doing all that work. And then here we also have tools from CrewAI, which is Serpadev. Serpadev essentially allows you to give the agent to surf the web and find answers, and it's going to do through Google. And there's an API for that. It's free actually, up to some limit, but you can get that for free as well. And then we have Pydantic, which allows you to create the models that we basically structure a way we need to get the agents to structure their output each time so that way it stays consistent. And then this is just typing datetime for dates, load environment variables. Those are variables that the API keys that we want to load so the agents can use. And then operating system, podcast generator. This is from tools and then podcast mixer config. Yeah, this is from our tools that we will go over as well. And these are the tools that the agents will need to accomplish these tasks that we have for them. So the first step here that I'm doing is setting up the directories. So first of all, we're talking about, we're going to generate a bunch of things. So let's go ahead and talk through them. So the first here, I have timestamp, and this is just to timestamp every document that's generated or folder. Because if I generate a podcast right now, maybe with a different PDF and then I want to generate another one, I want them to be in different files, not jumbled all together. So I want them to be separated by time. You can choose to separate by name, which could be more efficient, but I want it with time so that way I can track. Essentially which time I generated which one. And then here we have different directories. We have the base, segments, final, and then data. So the base one should be like the first one. And then the segments is like the individual audio that's going to be generated and then the final, and then the data. That data is going to hold all the summaries and some of the other stuff that we're going to talk about here in a second. And that's what this entire function does essentially is generate folders and manage folders for us. That's all it's going to do. And we load the environment variables here. So we load all the API keys there. And the first section we do here is we add the PDF knowledge source that we want. So in this case, the PDF knowledge source workplace production PDF. So let's look at this PDF and here it's workplace production PDF. This is the PDF here that I'm going to be using. And this PDF essentially, let's see what it talks about and let's just move that to the side. All right, cool. So this is Workplace Productivity and Well-Being Using AI Agents. So this paper is talking about how they're going to use AI agents to enhance productivity at work. So pretty interesting. So we're going to take that entire paper and pass it to the agents and let them generate a podcast about that. So that would be interesting to hear what that's about. So the next station step here is the pedantic models definitions. And this is what I was talking about with pedantic models. So What we want here, the first section here, there's a paper summary. So like I said, you will get these PDFs, we'll give it to the agent. The first agent is going to generate a summary of that paper first of all, because for us to generate a script of 2 people talking about that specific paper, we need to have a summary of it first of all. Not necessarily, but that's how I'm trying to— that's how my thought process and approach is going to go with this one. So what I want to do is generate a summary of it. And to generate a summary of this and all the papers that I'm going to upload to it, I want it to be very structured. So first of all, I want the agent to extract the title of that paper. So in this case, the definitions here, think of the Pydantic models in this case as more of just different paths that I need to get things done or different cabinet drawers. This goes in this cabinet, socks go in this cabinet, t-shirts go in this cabinet, ties go in this cabinet essentially, and all of them end up being what you need to put on to look good to go somewhere. Hopefully that makes it a little bit, a little bit clearer. So in this case, we're giving it the PDF, which is the final product. But within the PDF, we have a title, we have the main findings of the paper, which is all in there. There's also methodology that was used within the paper. There's key implications that the paper mentions. There's limitations that the paper mentions, future work that's mentioned in the paper, and then the summary date. This is just an extra timestamp that I'm adding to make sure that when was this actually analyzed and have that in there. Same thing here with dialogue line. This is for the podcast. I want the agent that's going to be working on this, which is basically using an LLM, and I want it to generate the name of the speaker and then the text that that speaker is going to say, so a script. In this case, I have 2 speakers. Well, I named one of them Julia and another one Guido. If you've been in data engineering, you probably are familiar with maybe Julia, which is a programming language. It's mostly used in data engineering, but not as much popular as Python. And then Guido is the founder of, or the builder or the creator of Python, Guido van Rossum. So shout out to Guido. And then text here would just be the dialogue that will be happening. So I wanted to have a speaker and then the dialogue step by step, each individual ones, because when we go ahead and generate the podcast transcript, you see why that is important. So when you get here to podcast transcript, now that we have the summary, we give it to another agent, which essentially still uses an LLM. It looks at that summary and says, okay, let me generate a very interesting conversation out of this summary. And also what I've gotten from this entire summary up top here with the title and all the key findings and all that information, I want to generate a transcript of 2 people talking about this. So it's going to go ahead and generate a dialogue of 2 people talking about that. So that's what the podcast transcript model does. And so this is just a model to make sure that that conforms to that aspect of it. And then we have the audio generation, which is essentially just going to segment the files. We have a segment file that's going to have a list of files, individual files. So when we pass each of the script or the speaker dialogue to ElevenLabs, and maybe we pass it to the title of Guido, which is going to be the name ID of— because first of all, all the audio AI audio models that are within ElevenLabs, they have names, for example, but they also have IDs. So you want to be able to pass a certain script to that model that has a name or which is now the voice synthesis. So for example, we're going to call it Julia. It's going to pass a text that Julia said to ElevenLabs. ElevenLabs is going to go ahead and take that text using Julia's voice on the other side and generate a voice of Julia saying those specific words. And then it's going to return that. And that's just going to be one segment. And that's what it does here with segment files. It's just going to be individual lines, individual audios. And then at the end of it, the final podcast is going to be a combined version of all of them with timestamps so that it sounds natural and one entire podcast without splits. Pretty cool. Then the next section here is the LLM setup. Like I said, each agent here can use different LLMs, which is really cool. I just set up all my LLMs that I'm going to use and then I'm going to assign to the agents at the bottom here. First, I have the summary LLM. This is the LLM that an agent down here is going to use to do summary. The first one that I have here is I'm going to use OpenAI, but I'm going to use 01 preview model. You can change this one to be any type of model that you want to use. You can use not only OpenAI, but for example, you saw I had used Cerebras. You can use Groq, you can use Anthropic, you can remix however much you want. If you want to cut costs, you can also play around with local models as well in this. The only thing that I have to mention there is the quality reduces with the model that you use. So there's cost benefit there to quality. And then I'm also setting the temperature to 0 because I don't want it to think so much, especially in summary. I just wanted to use the context that it's getting from the PDF or the source. So make it a little bit more deterministic. But of course there's always non-determinism in there. And then we have the script LLM, which is going to generate the script. Of the dialogue. At the same time, I'm still using O1 Preview on this one, but I add another segment on there, another LLM there for script enhancement. What I noticed is when I just have this one pass-through script, maybe I want it to be funny, maybe it wasn't as funny as I like it. I thought maybe, wait, when I create the first script, I want to pass it to another LLM to look at that script and say, okay, how can I make this even more funny or more lively? I passed the first one was 01 preview, but then on the second pass I give it to Anthropic LLM, which I'm giving it to Claude Sonnet 3.5 Sonnet. And I'm telling it just generate a more funnier version of this one or more funnier or informative or whatever parameters you want to pass in. And what I did here as well, I set the temperature a little higher so that way you can be more creative with it. And the first one, For the first script, I just put 0.3 here for the O1 preview, maybe a little, but not too much. Still stick to the concepts. You can play around with that different variation and see which one works best for you. But I found this one works a little better for me. Then for audio, I just use Cerebras here. The audio LLM doesn't really need an LLM, but since each agent needs to have an LLM assigned to it, I just put this one for this, but it's not going to do anything in this case. But if I want to use this, somewhere else, I could still use it. So that's pretty cool. So the next step here is just create and configure the tools. So our directories, this function up here that we were talking about earlier of setting up the directories, we're just calling it now and making sure it generates, it sets up the directories to begin with. And then we start with the audio generator here. So it's going to generate the segments as well, sections of the folder essentially. That's what it does here. And now here I have the speakers. So audio generator, what I'm doing here, I'm adding a voice. First one is Julia, and Julia, I'm getting Claudia's voice. So on ElevenLabs, there's a voice called Claudia. So this is what the API key as well. I have an ID for Claudia in my environment variables. You can pick whichever one you want on your side. When you get to ElevenLabs, there's a way you can go find the IDs for that as well. And it's pretty easy. Once after that, I just load in the configurations and we'll go over that podcast audio generator function on the other side or class on the other side. And I'm just setting different stability here. So more variation for natural enthusiasm. So if you play around with these numbers for stability, the lower it is, the more stable it is and more natural it sounds. And then similarity boost. So to maintain the consistency of how it says stuff. So you can play with these numbers, you'll get a different tone of it. So I try to think pushing this to 9 and And it sounded really weird. If you put it lower, it's going to sound really generated. So you can play around with that to see where it sounds a little bit more natural. I think I found a sweet spot with this current parameters that I have here, but I probably could still play around with it. And then there's style. So good expressiveness without being over the top. So expressiveness, maybe adding exclamation somewhere or just like, I don't know, it's a bit more expressive. I don't know how to say it, but you have a feeling when this is a bit more natural or doesn't sound natural at all. These numbers is what is going to affect that a lot. And then use speaker boost. This is more something that's inbuilt within ElevenLabs. And this is just to make the speaker more natural at the same time. Then same thing with Guido, doing the same thing. So Guido, I'm using Ben's voice on ElevenLabs. And for Julia here, I'm using Claudia's voice on ElevenLabs. They're not called that. So you can see I changed the names. So I can change this to any other name that I want. My podcast hosts to be. So cool. And the next step here is the podcast mixer. And what it does essentially is takes all the segmented files or audio files for each of the speakers and just puts them together, generates a final podcast. So pretty cool. And then the search tool, separate dev tool, is what one of the agents will use to search the web to augment it or enhance their research from the paper. So we have the paper, maybe the paper was written years ago, but I want also the agent to go search the web and find new information to to augment that so that when we generate a transcript, the hosts are talking about that paper, but they can also reference new information and talk about the new information that's out now. So let's go ahead and talk about agents now. So the agents, we have a researcher agent and this agent basically does comprehensive. And like I mentioned, first of all, we have for each agent, we have a role. So the role of this is research analyst. So think of this when I'm walking through this, think of it as an employee. So an employee usually has a role, right, at a company. So for me, I'm a developer advocate. Somebody else might be like a sales engineer, for example. And they have a goal, what they need to accomplish within that specific role. So that could be the job description right there. And then the backstory is, you know, what are the qualifications that this person has? So research analyst, maybe they're a PhD researcher or blah, blah, blah. You know, you can add whatever stuff you want to add in there about that specific employee. And then verbose here is basically saying, When you're walking through your steps as an agent, I want you to spell out everything so I can see what actually you're doing. You can actually follow the steps. We have to assign an LLM to an agent. In this case, we are assigning the summary LLM to it, which is the Owen preview. Next, we have another agent for research, and this is the one that's going to go to the web and do some research. In this case, we also have the title for the agent is a research support specialist, and their goal is find current context and supporting material relevant to the paper's topic, like I mentioned. They also have backstory and then verbose true. But one extra thing that we add for this one is tools because it needs a tool to go do that web search. We have the SopraDev tool that we talked about. In this case, we're going to pass the search tool as a tool that it's going to use. Then we assign it an LLM, script enhancer LLM, which is still going to use O1 to do that as well. Then we have the scriptwriter agent. This is a podcast script writer. It also has a goal of create an engaging educational podcast script about technical topics. And then they also have a backstory and verbose true, LLM script, LLM. That's where you assign the LLM. So you can tell already it's pretty repetitive. We just have to set agent and a task, agent and a task. And so here we have another agent here for a script enhancer. So this enhances the original script. And what I added at the bottom here as well is I told it, You're a veteran podcast host, and I gave it, you excel at adding natural humor, relatable analogies, and engaging banter while ensuring core technical content remains accurate and valuable. You've worked on shows like Lex Fridman Podcast, Hardcore History, and Joe Rogan Experience, bringing their signature blend of entertainment and education. See what I did there? Well, most of these LLMs, you just have to prompt it right. It knows who Joe Rogan Experience— he knows who Joe Rogan is. He knows who Lex Fridman is, and he probably knows what type of content they create, how they sound like, the tone. So I'm just giving it basically more credentials to say you're experienced, you've worked with this podcast, so try to replicate that with our podcast essentially. So it's just another way to cleverly make it generate better transcripts in a sense, or better scripts for our agents or for our podcast in this case. And finally, we have Audio Generator Agent, and their goal is to generate high-quality podcast audio with natural-sounding voices. You're experts in audio generation. You consider pacing, tone, audio quality, and your production. So propose true, allow delegation false. Basically we're telling it don't delegate your work to anybody else. You are the one that's going to do the job. And then the tools, we gave it an audio generator tool and podcast mixer tool. We're going to go to the tools very shortly here. So these are tools it's going to need to get the job done. And finally we have tasks. So those were agents. Now we have tasks that each agent is going to do. So you build it, you You build the agents. So these are individuals and then you build a task and then assign the agent to the task. So let's walk through this. So the first task is summary task. So this is the summary. We're passing in the paper here within the squiggly brackets there to tell it this paper. So he knows which paper we're talking about. And then we wanted to create this essentially, main findings, all this, do a summary of that. But one cool thing here as well, we have the output Pydantic. So remember the Pydantic models we created up there? We're just passing it in individually to each one of them so it knows what structure it needs to generate it in. For this one, paper summary structure, it's going to generate the summary of the research paper title, make sure that it has all those sections when it generates that. Then also we want it to output the file into this folder that we're maintaining at the top. This is pretty good. Then we assign the agent that's going to actually do these tasks, which is the researcher agent. Pretty clear up to that point. Next thing, we do the same thing with supporting research agent. It's just telling it exactly what we want it to do, to go fetch some extra data, supporting evidence, real-world impact, different perspectives from the web, and that could go with that paper that's relevant to the discussion of the podcast. And then same thing, we have an expected output, structured collection of supporting materials and examples. And then the agent, who is the research support agent, is going to do this task. And then context, Context here is what exactly, what does it need to have context of? In context, we're telling it, hey, we're going to have context of summary tasks. There's a first task that we did, which was generate the summary. We want this new agent to have context of the summary task in this task that it does. Essentially, when I finish a certain piece of work, I wanted to pass it to somebody else. I also want to give them the context, hey, this is what I worked on and this is what it is. Here it is so you can do a better job. So essentially that's what it does. And then we also have output file there that it outputs what it finally accomplishes. It needs to output it somewhere so we can review and make sure that you did it right. And then we have podcast task here. And this is just the one that's just going to generate the podcast. And I'm just going to skim through it. It's a lot of text. And this one as well, we are assigning the output Pydantic podcast script. Same thing, context. The more we go down, the more context we have and the more we have to add into each of the contexts there. And then for this one is the scriptwriter. It's just going to generate a well-balanced podcast script that clearly distinguishes between the paper contents and supplementary research. And then convey reactions. Of course, we have to just give it explicit instructions there. So we give it even one-shot examples. By one-shot examples, I mean we give it examples of how it's supposed to sound. So for example, here we have conversational flow. We're just telling it core discussion, focus on the research and findings, and then natural tangents with clear attribution. So building on the paper's findings, that's an example of how they could make sure that we're referencing maybe new material from the research as well. So that's pretty interesting as well. And then enhance script task. This is just enhance script task. We're telling it once the first transcript is generated or the first script is generated, we want you to enhance that to make it better, sound better. It all depends on, we could build all we want, but it's going to depend on what was written as a script is what's going to sound at the end. So we're just telling it to keep all natural elements. Julia is knowledgeable expert and Guido is the engaged and curious host. So Julia is going to be the one that's knowledgeable about that specific content that they're going to be talking about. And then Guido is going to be the most engaged and more like the curious host, the one that's asking more questions. And then we wanted to include natural verbal reactions like, oh, that's fascinating. Wow. And things like that. So that's another, just to make it more natural and human feeling. Another one-shot here, natural reaction examples. Oh, that's fascinating. Wait, that doesn't make sense. Wait, really? And then we have wrong. So those are the right ones. And then we give it also what wrong looks like. So wrong is like you have the asterisk, chuckles, or laughs. Sometimes it does this. Before I put this here as guardrail. And when it does this, when we set it to ElevenLabs, it just messes it up. It actually brings back the audio saying star chuckles star. And I'm like, no, that's not what's supposed to happen. It's just supposed to chuckle, right? But it didn't take that. So I decided to put that as that's wrong. And then another wrong thing is adding new speakers or changing hostnames. That happened a little bit in the beginning, but then after adding some of this kind of little tweaks, it worked great. So making sure it doesn't add any new random speakers that we didn't have. And then the goal, of course, to make the content feel more conversational between the 2 hosts. And again, context, agent, and then output file as well. And then we have the audio task, which is going to compress all these individual segments into full final MP3 podcast that we can listen to. And then finally, we have the crew, which is Bringing the entire group together, like who's in your crew. In our crew here, we have the researcher on agent side. First of all, we have researcher, we have research support, and we have a scriptwriter, script enhancer, and then audio generator. Those are the individuals in our crew. And then we have also bring their tasks, what they're responsible for as well. We have to put them in there. And then the process of how they're going to actually work together is sequential. Researcher starts, passes it to the support agent, passes the scriptwriter all the way to the audio generation generator agent.
Okay.
And then knowledge sources is the research paper. So remember, the knowledge source that we want them to reference is the research paper that we uploaded. So that's the knowledge. That's what they need to reference. And then the verbose true is we want them to show us what they're working on as they go. So pretty cool. And then here I'm just, if name equals main, we're just bringing everything together. So update the task output files. So the first one here, we're just updating the file tasks and then setting up everything. And then Finally, here we just run the podcast. So crew kickoff, and then the input, we have the paper and then the workplace prod PDF. And like I mentioned, this is where the PDF is going to be. One thing to note when you're doing this, make sure you don't pass the full path. So if you're going to pass the path to this file, for example, it probably would start with knowledge/knowledge. Well, Forgive me, so it's knowledge/workplace-bra.pdf. That would have been the full path. But in this case, since we already have the knowledge and part of the hardcoded part of the package is just ignore the knowledge because it's going to automatically figure out where that is. So just put the name of the file directly and it's just going to bring that in. So pretty cool. And now we are moving to the next interesting part, which is actually running this example so we can actually see what it does and how it works. So let's actually generate a podcast finally, right? So I'm going to open this side and I'm going to have side by side to show you what happens on here as well, what gets generated as we follow along in this process. So what we need to do is just run Python podcast, podcast generator, and then enter, and it's going to start the process. So it's going to take a minute. And it's going to kick off. This is using CrewAI. If you're not familiar with CrewAI, you can go to docs.crewai.com and you'll see all the docs that you need. And if you see this warning error, audio loop is deprecated and slated for removal in Python 3.13. I use 3.12 right now. That's just a warning. Ignore that. It's not relevant. So it's already started. So you can see the research agent, the research analyst that started working. And this is just the job description printing out right now. And then it's just going to get to the work. Now, if you see on the directory side, you can see outputs folder has already been generated and all the folders that we needed have been generated. So you can see the data and then you can see the podcast and then the segments. So in the data here, we should get— okay, now it's flowing pretty fast. So we have the paper summary already in and you can track the changes as it happens here in the terminal. But also we We're already now into the research agent. It's already working. So we can track the changes there, but also here we have the paper summary. You can actually look at it on that side. So paper summary is already there. If you want to format this correctly, because it's in JSON and it's just one single straight line, if you're on Mac, you can do Option+Shift+F and it's going to format the file into a readable format. For us, so you can see here we have the title, and it says assessing the impact of artificial intelligence tools on employee productivity insights from a comprehensive survey analysis. And it just gives you all the stuff that we wanted to do. We wanted it to grab the title, grab the main findings of that paper methodology that was used to you know generate this paper key implications in the paper limitations in the paper future work that's been and then the summary date which is. I just wanted to add that timestamp there to show when did we actually generate this summary. And then now it's also generated the supporting research here. So the Next Agent has generated supporting. So this was supposed to go to the web, do research based on that paper, and then generate more of an updated version of what's out there that refers to that paper that we could add as context. So it's already gone out there, found some supporting examples. So number 1 here, we have recent research and findings. And Harvard Business Review 2004 represents— presents contrasting findings showing that while AI increases efficiency, it can negatively impact employees' well-being by increasing feelings of loneliness and isolation. Well, that's pretty sad. Then Forbes, all that. So that's pretty cool context to have there. So awesome. Now it's gone ahead and generated a bunch of stuff. And you can see here we have a podcast script. This is the first podcast script. Again, Option+Shift+F, and we'll see the first script here. This is the first script, first pass of the script from the first agent. And it's not pretty long. It's pretty small size, but you can tell it's already gone and done that. And then we have the enhanced version now that should be the one that we will get at the end. And so this is the enhanced version of the first script. So pretty good. Now you can tell here it's already generating the individual segments. It's essentially taking this enhanced podcast section. So it's taking, for example, this one, speaker Julia and the text, passing it to ElevenLabs. The ElevenLabs then generates audio of this one specific chunk and then it outputs and puts it here in the segments. So it's going to go through each one of them and do that all the way. And you see it already adding here. And once it's done, it's going to squish all of them into one podcast. And that podcast is going to show up here under podcast.mp3 there. Take one here, for example. This is the first one from Julia, and Julia has already been generated. It's going to take like 16 seconds. And hey everyone, I'm not sure if you can hear this today. Yeah, I'm not sure you can hear that, but I'll replay this as well on the main podcast when that plays. But looks pretty good. So it's generated a bunch of them so far. You can see all this. It's still going, and let's see how far it's going to get. So we're already on number 14. Generation. And once it's finished generating all the individual segments, it's going to go ahead and squish all of them into one, um, of course, podcast. And while that's still going, let's go ahead and look at our tools. I just noticed we didn't go over tools. So if you go tools.py here, we have at the same time here, uh, let me just do this. We have, um, audio segment by PyDub. PyDub really just allows you to play around with audio a little bit, tune it, make it sound the way you want. And then we're importing ElevenLabs there. And then voice configuration is essentially like the knobs we'll use to tune the voice to make it sound how we want to. And that's also part of ElevenLabs. They have that. So we're going to use that as well. And then there's another— so that's voice config. And then we have audio config that we can use that as well. And we have dialogue. And this is the one between the 2 speakers. And then here we have just dialogue as well. And then podcast enhanced podcast audio generator. And then we just have extra information here that we'll need down here as well to generate. And then here we're creating the first super init and we are just passing in the API key from ElevenLabs. And then we add the voice. This is where we just will add the voices, individual ones as we go to make sure that we just generate it. And then on a run here, first of all, we start with creating the folder, make sure it's created. And then it's going to take the audio files. And this is the audio file instantiation where it's going to place them first before it puts it to the main folder. And then we'll start with the index. And it's going to enumerate all the speaker dialogue. Essentially, we have our entire script generated in the JSON folder. We'll go ahead and generate each one of them. In this case here, what it's doing is it's going through individual one of them. And then what it does on that side is it's going to take each of that and pass it to ElevenLabs API so that way you can generate that individual ones. So if there's none, it's just going to skip. That's just extra code that we're having in there. And then what it's going to do is just going to pass it to ElevenLabs, assign the— so it's going to give it the text, the voice ID of the individual that we want to talk, and then the model ID of it. And then the output format that we wanted to output, and then the voice settings also that we wanted to tune it to, which we've set up there. And then it's just going to generate it. That's what it's going to do. That's what all this is doing. And then finally putting it in the right folder. And we have the podcast mixer, and it enhances the voices that we've generated into one to make it sound really better in a sense. And that's exactly what it does on down here. If you come down here, We just have the silent sections. It trims out the silent sections and adds some crossfade a little bit and just tries to make it really professional sounding in a sense. And that's it. And we are done with the tools. Let's go back and check if our code is finished. And if you also follow here on the terminal, you can see how far we've gotten. And let me just scroll all the way down. So it's finished. It's finished. It seems like it finished everything and it was finished. Let's go ahead and check the output folder and let's go to podcast. So here's the podcast. It's 4 minutes and 9 seconds of our full podcast that we can listen to and do stuff with it. We can post it on Spotify. Actually, I have a Spotify file that you guys can listen to. I have a podcast called Paper Podcast. It's just one that I created to put some of these examples that I generate, and I'm going to share that with you all after this. And I'm going to play this and you guys can hear what it sounds like. I don't think you can hear it from now, but I'm going to replay it in a second here. All right. So I tried playing it on the Cursor IDE that I was using and it couldn't take the audio that was playing from the system. So I went ahead and uploaded it on Spotify Podcast and I'm going to share the link as well in the description section so you can go listen to it. But I uploaded on there so I can actually play and we can hear what we just generated. In this demo. So this is it, AI at Work and YouTube demo. So let's play it and listen what a little bit of it.
Hey everyone, welcome back to Tech Talk. Today we're diving into something that affects pretty much all of us, AI in the workplace. We've got this fascinating research paper that shows how AI tools are changing the game for employee productivity.
You know, Julia, it's funny, just yesterday I was struggling with my email inbox and my new AI assistant sorted everything in seconds. But I have to admit, part of me felt a bit obsolete.
That's such a relatable concern, Guido. Actually, the research addresses this. They found that AI isn't about replacing humans; it's about enhancing our capabilities. Think of it like having a really efficient personal assistant who handles the tedious stuff so you can focus on what humans do best— creative thinking, and complex decision-making.
Wait, so it's like having a sous chef who does all the prep work so you can focus on creating the actual dish?
Exactly! And here's where it gets really interesting. The study found that AI systems can actually adapt to your working style. They use machine learning and biometric feedback to figure out when you're most productive and help minimize distractions during those peak times.
Biometric feedback. That sounds a bit Black Mirror-ish. Are we talking about robots watching our every move?
No.
Yeah, that is pretty cool with a reference to Black Mirror. But yeah, anyways, this has been really awesome and I hope you really enjoyed and found some value in this. And again, I want to reiterate, you can find all the code in the description in my GitHub. And if you have any questions, please feel free to create an issue on GitHub or just comment on the chat of this YouTube video. I'm pretty responsive on my YouTube videos. So yeah, feel free to say hi, connect with me on LinkedIn, X, and all that information is also within the description. And don't forget to subscribe for all this awesomeness. I'm going to be posting more this year. So thank you and see you on the other side. Bye.
More from Tony

Summarize Videos and Research Companies with CrewAI + Gemini Models [Quickstart Guide]

How to Make Your AI Agents More Reliable with CrewAI Task Guardrails (Step-by-Step Tutorial)








