DEV Community

Anand Sukumaran
Anand Sukumaran

Posted on • Edited on

1

How to create a Youtube video summariser agent using EnvoyJS

In this tutorial, I will explain how you can build a Youtube video summariser AI agent using EnvoyJS, a minimal agentic framework in Javascript.

The idea

We will create a youtube video summariser agent and instruct them about their job. We will supply YoutubeTranscript tool to the agent so it can fetch the transcript of a given video.

We can either use the gpt-4o model, or deep-seek for this.

Install EnvoyJS library

npm i @envoyjs/core
Enter fullscreen mode Exit fullscreen mode

Import EnvoyJS library, and Youtube Transcript tool

import { Agent, youtubeTranscriptTool } from "@envoyjs/core";
Enter fullscreen mode Exit fullscreen mode

Create the agent

Let's create our agent using the Agent class.

const agent = new Agent({
    name: "Content Summariser Agent",
    bio: "You are an expert in reading YouTube video transcripts and summarizing what the video is about.",
    steps: [
        "Read the transcript",
        "Understand the entire context",
        "Find relevant portions",
        "Summarize as text",
        "Save it as a file"
    ],
    modelConfig: {
        provider: "OPEN_AI",
        apiKey: "", // Don't forget to add your OpenAI API key
        model: "gpt-4o"
    },
    tools: [youtubeTranscriptTool, fileWriterTool] // Add tools here
});
Enter fullscreen mode Exit fullscreen mode

In this class, we're giving instructions to the agent on how to do the task. We have given a bio, and then steps instructions on how to perform!

Running the agent!

Let's prompt the agent to do the work using the print_response() function.

agent.printResponse("Summarise this youtube video - https://www.youtube.com/watch?v=QtYEPYntfL4&t=27s");
Enter fullscreen mode Exit fullscreen mode

Now sitback and see how the agent analyses the task, take decisions to use the tool to fetch the transcript and summarise the video for you!

Neon image

Set up a Neon project in seconds and connect from a Next.js application

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

Top comments (0)

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started →

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay