Deep Agents JS

LangChain · Beginner ·🧠 Large Language Models ·10mo ago

Key Takeaways

The video demonstrates how to create a research deep agent in TypeScript using the Deep Agents JS package, which can perform tasks such as web searches and synthesizing information into a cohesive report. The agent is built on top of the React agent structure and utilizes a planning tool, file system, sub-agents, and a detailed system prompt.

Full Transcript

Deep agents are a type of agent that complete tasks over longer time horizons. This is the architecture that agents like Claude Code, Manis, and Deep Research use to complete their task. In this video, we'll be creating a research deep agent in Typescript. One that can go out, do web searches, and synthesize that information in a cohesive report. All done through our new deep research typescript library. And so in this video we will be creating a TypeScriptbased research agent and connect it to this deep agent UI. We will see the agent populate with tools, tasks and different sub aents as well. Before we start jumping into the code, I want to talk about how deep agents are different from the agent structures that you've seen in the past. So deep agents are built on top of the React agent structure that you've probably heard about in the past. In a React agent, an LLM performs an action on an input and uses the observation to reason and act again in a loop. Now this works brilliantly when you have a short execution sessions. But as context and planning gets larger, we need a different framework. Now this is where deep agents come into play. Deep agents are different due to four primary components. The first is that they have a planning tool. They have an overall tool that helps them plan and understand what needs to happen next. The next is that they have access to a file system to offload context and information at an organized manner. It prevents the agent from accumulating too much information in its context window. We saw that earlier in our deep agents UI. And the last two is that the first is that it has access to sub aents. Sub agents are specialized agents that can carry out a specific task. So, as shown earlier, a sub agent could be a research sub agent or a critique sub agent. And the last is that it has a very detailed system prompt that you'll see later in this video. Let's dive into the code. So, we can start by heading over to the deep agents.js repository and cloning it locally. Now that we're in the terminal, we can clone the repository that we've fetched earlier. We can head into it and in the repository we've created an examples folder. In the examples folder we can head into research where we have our langraph.json file which will be used to run our langraph server later on. Now the first thing we want to do is we want to create a environment file. In the environment file we need to add two things for our example. We need to add a Tilli API key which is our web search provider and we need to add the LM provider which is the anthropic API key. Now add your own keys there. And once that's done, exit. And now what you're ready to do is actually install and build. So let's yarn install and yarn build. And you are ready to go. So let's dive into the code. This is the research agent.ts file that I mentioned in the examples research folder earlier. Now everything in this file is built around the create deep agent function. This is what instantiates the deep agent which you can then either invoke or start the langraph server and connect to. Now when you create a deep agent you need to provide it a list of tools, a list of instructions and optionally a list of sub aents. Now the instructions is what I had mentioned earlier about the detailed research instructions that guide all of the agents and sub aents. So in it we obviously have the description. So we are telling it that it's an expert researcher and then we have guidelines about creating that overall research brief and we even have ways to answer questions and list topics. Now above it what we have is we have the list of sub aents. So the research sub aent can be found here and what you need to create any sub aent is a name, a description, a prompt and a list of tools it has access to. So this is a prompt for the researcher sub aent which is a dedicated researcher and has access to the internet search tool to use to villi. Now beneath it we have the subcritique prompt which is the prompt that is given to the sub agent in order to go and critique that final report once it has been created. So now now that you have this structure we're ready to run the langraph server. So we can come over here to our terminal and we can run the command to run our langraph server which is npx langchain langraph cli dev. Now once we run it, the langraph server is running and we are ready to create the deep agents UI. We can head over to the deep agents UI GitHub package and get the link to clone here as well. So back in the terminal, we can start by cloning the repository for the deep agents UI. We can head into the repo here. And the first thing we want to do is we actually want a yard install. So we can install all of the required dependencies. After this what we're going to do is that we are going to create a environment file and in that environment file we need to specify two different things. We need to specify where our langraph server is and we also need to specify the name of the agent that we're creating. So let's create that environment file right there. And let's get go into the environment file and let's do next public deployment URL so our next.js package can use it. For me that was on localhost 2024. And then we can also do next public agent ID which is the name of the agent that we created which is the research agent. Now that we've done that we can do npm rundev and our server will now be running on localhost 3000 ready for us to use. So now we have this running on localhost 3000 and this is the deep agents UI. So we can come and type that message. So, can you compare New York City in San Francisco? And we can send that message. So, now it's communicating to our Langraph server. Um, and what it's doing is it's writing a file. And so, it's using that file system to write what our actual question is. It's writing to-dos to list out the different tasks that needs to accomplish. And then it's creating these sub agents. Now, it's, as you can see, it's spun up that research sub agent that does a set of internal searches that goes out, finds different information and synthesizes that information that will eventually be critiqued by that critique sub agent. And so, yeah, that's it. Just to recap, what you need to do to get this up and running is you need to clone the deep agents JS repo, run the research agent example, clone the deep agents UI, run that UI, connect them together using the environmental variables, and you should be ready to go. Cool. I'll see you later.

Original Description

Deep Agents is now in JavaScript! Simple tool-calling loops break down on long-horizon or intricate problems. Deep Agents, like Deep Research, Claude Code & Manus, chain reasoning, adapt plans, and juggle tools to get results. Now you can build your own using our JS package! https://github.com/langchain-ai/deepagentsjs
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LangChain · LangChain · 0 of 60

← Previous Next →
1 Chat With Your Documents Using LangChain + JavaScript
Chat With Your Documents Using LangChain + JavaScript
LangChain
2 LangChain SQL Webinar
LangChain SQL Webinar
LangChain
3 LangChain "OpenAI functions" Webinar
LangChain "OpenAI functions" Webinar
LangChain
4 LangSmith Launch
LangSmith Launch
LangChain
5 LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain x Pinecone: Supercharging Llama-2 with RAG
LangChain
6 LangChain Expression Language
LangChain Expression Language
LangChain
7 Building LLM applications with LangChain with Lance
Building LLM applications with LangChain with Lance
LangChain
8 Benchmarking Question/Answering Over CSV Data
Benchmarking Question/Answering Over CSV Data
LangChain
9 LangChain "RAG Evaluation" Webinar
LangChain "RAG Evaluation" Webinar
LangChain
10 Fine-tuning in Your Voice Webinar
Fine-tuning in Your Voice Webinar
LangChain
11 Tabular Data Retrieval
Tabular Data Retrieval
LangChain
12 Building an LLM Application with Audio by AssemblyAI
Building an LLM Application with Audio by AssemblyAI
LangChain
13 Superagent Deepdive Webinar
Superagent Deepdive Webinar
LangChain
14 Lessons from Deploying LLMs with LangSmith
Lessons from Deploying LLMs with LangSmith
LangChain
15 Shortwave Assistant Deepdive Webinar
Shortwave Assistant Deepdive Webinar
LangChain
16 Cognitive Architectures for Language Agents
Cognitive Architectures for Language Agents
LangChain
17 Effectively Building with LLMs in the Browser with Jacob
Effectively Building with LLMs in the Browser with Jacob
LangChain
18 Data Privacy for LLMs
Data Privacy for LLMs
LangChain
19 "Theory of Mind" Webinar with Plastic Labs
"Theory of Mind" Webinar with Plastic Labs
LangChain
20 LangChain Templates
LangChain Templates
LangChain
21 Using Natural Language to Query Postgres with Jacob
Using Natural Language to Query Postgres with Jacob
LangChain
22 Building a Research Assistant from Scratch
Building a Research Assistant from Scratch
LangChain
23 Benchmarking RAG over LangChain Docs
Benchmarking RAG over LangChain Docs
LangChain
24 Skeleton-of-Thought: Building a New Template from Scratch
Skeleton-of-Thought: Building a New Template from Scratch
LangChain
25 Benchmarking Methods for Semi-Structured RAG
Benchmarking Methods for Semi-Structured RAG
LangChain
26 LangSmith Highlights: Getting Started
LangSmith Highlights: Getting Started
LangChain
27 LangSmith Highlights: Debugging
LangSmith Highlights: Debugging
LangChain
28 LangSmith Highlights: Datasets
LangSmith Highlights: Datasets
LangChain
29 LangSmith Highlights: Evaluation
LangSmith Highlights: Evaluation
LangChain
30 LangSmith Highlights: Human Annotation
LangSmith Highlights: Human Annotation
LangChain
31 LangSmith Highlights: Monitoring
LangSmith Highlights: Monitoring
LangChain
32 LangSmith Highlights: Hub
LangSmith Highlights: Hub
LangChain
33 SQL Research Assistant
SQL Research Assistant
LangChain
34 Getting Started with Multi-Modal LLMs
Getting Started with Multi-Modal LLMs
LangChain
35 Build a Full Stack RAG App With TypeScript
Build a Full Stack RAG App With TypeScript
LangChain
36 Auto-Prompt Builder (with Hosted LangServe)
Auto-Prompt Builder (with Hosted LangServe)
LangChain
37 LangChain v0.1.0 Launch: Introduction
LangChain v0.1.0 Launch: Introduction
LangChain
38 LangChain v0.1.0 Launch: Observability
LangChain v0.1.0 Launch: Observability
LangChain
39 LangChain v0.1.0 Launch: Integrations
LangChain v0.1.0 Launch: Integrations
LangChain
40 LangChain v0.1.0 Launch: Composability
LangChain v0.1.0 Launch: Composability
LangChain
41 LangChain v0.1.0 Launch: Streaming
LangChain v0.1.0 Launch: Streaming
LangChain
42 LangChain v0.1.0 Launch: Output Parsing
LangChain v0.1.0 Launch: Output Parsing
LangChain
43 LangChain v0.1.0 Launch: Retrieval
LangChain v0.1.0 Launch: Retrieval
LangChain
44 LangChain v0.1.0 Launch: Agents
LangChain v0.1.0 Launch: Agents
LangChain
45 Build and Deploy a RAG app with Pinecone Serverless
Build and Deploy a RAG app with Pinecone Serverless
LangChain
46 Hosted LangServe + LangChain Templates
Hosted LangServe + LangChain Templates
LangChain
47 LangGraph: Intro
LangGraph: Intro
LangChain
48 LangGraph: Agent Executor
LangGraph: Agent Executor
LangChain
49 LangGraph: Chat Agent Executor
LangGraph: Chat Agent Executor
LangChain
50 LangGraph: Human-in-the-Loop
LangGraph: Human-in-the-Loop
LangChain
51 LangGraph: Dynamically Returning a Tool Output Directly
LangGraph: Dynamically Returning a Tool Output Directly
LangChain
52 LangGraph: Respond in a Specific Format
LangGraph: Respond in a Specific Format
LangChain
53 LangGraph: Managing Agent Steps
LangGraph: Managing Agent Steps
LangChain
54 LangGraph: Force-Calling a Tool
LangGraph: Force-Calling a Tool
LangChain
55 LangGraph: Multi-Agent Workflows
LangGraph: Multi-Agent Workflows
LangChain
56 Streaming Events: Introducing a new `stream_events` method
Streaming Events: Introducing a new `stream_events` method
LangChain
57 Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
Building a web RAG chatbot: using LangChain, Exa (prev. Metaphor), LangSmith, and Hosted Langserve
LangChain
58 OpenGPTs
OpenGPTs
LangChain
59 Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
Open Source RAG with Nomic's New Embedding Model (and ChromaDB and Ollama)
LangChain
60 LangGraph: Persistence
LangGraph: Persistence
LangChain

This video teaches how to create a research deep agent in TypeScript using the Deep Agents JS package, which can perform tasks such as web searches and synthesizing information into a cohesive report. The agent is built on top of the React agent structure and utilizes a planning tool, file system, sub-agents, and a detailed system prompt. By following the steps in this video, viewers can build their own research deep agent and connect it to a UI.

Key Takeaways
  1. Clone the Deep Agents JS repository
  2. Create a research agent in TypeScript
  3. Install and build the research agent
  4. Create a UI for the deep agent
  5. Connect the deep agent to the UI using environmental variables
💡 Deep agents are a type of agent that can complete tasks over longer time horizons by utilizing a planning tool, file system, sub-agents, and a detailed system prompt.

Related AI Lessons

Building LSTMs with PyTorch and Lightning AI Part 7: Resuming Training with Checkpoints
Learn to resume LSTM training with checkpoints using PyTorch and Lightning AI, enabling efficient model iteration and development
Dev.to · Rijul Rajesh
How AI Learns with Less Labeled Data
Learn how AI can learn with less labeled data, a crucial aspect of machine learning beyond model selection
Medium · AI
Comparing Sarvam-30B and Qwen2.5–14B on Spider Text-to-SQL: An Active-Parameter Perspective
Learn how to compare large language models like Sarvam-30B and Qwen2.5-14B on the Spider Text-to-SQL benchmark from an active-parameter perspective
Medium · LLM
Debugging Benchmark: DeepSeek V4 Pro vs MiMo V2.5 Pro
Compare the debugging capabilities of DeepSeek V4 Pro and MiMo V2.5 Pro on a real-world GitHub bug
Dev.to · Stanislav
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →