transcribe

Managed Deep Agents - Skills

LangChain · 8m · transcribed 14d ago
More from LangChain Business
𝕏 Share ▶ YouTube 📥 PDF 🤖 .md

Section Insights

# 0:00

Introduction to Skills in Managed Deep Agents

What are skills in managed deep agents and how do they work?

Skills are dynamic contexts and scripts that agents can read and execute as needed, allowing for more flexible interactions without overwhelming the agent with constant information.

  • Skills allow agents to access additional context dynamically.
  • They are loaded through progressive disclosure, providing only essential information initially.
  • Skills are structured in a specific folder format with required fields in markdown files.
# 1:41

Creating a New Skill for Question Asking

How do you create a new skill for an agent?

To create a new skill, you need to set up a directory structure and create a skill.md file with a name and description, detailing how the skill should function.

  • Skills are organized in directories, each containing a skill.md file.
  • The skill.md file must include a name and description for the skill's functionality.
  • This example skill is designed to ask follow-up questions when user input is vague.
# 3:23

Testing the Question Asking Skill

How does the agent utilize the newly created question asking skill?

When prompted with a vague question, the agent reads the skill file and follows the instructions to ask clarifying follow-up questions.

  • The agent reads the skill file to determine how to respond to vague questions.
  • The process involves model calls and reading the skills library to inform its behavior.
  • Skills enhance the agent's ability to interact effectively with users.
# 5:05

Adding a Script-Based Skill

What is the process for adding a skill that includes a script?

To add a script-based skill, you still create a skill.md file and include a script file, ensuring the agent can execute the script when prompted.

  • Script-based skills require both a skill.md file and the actual script file.
  • The agent can execute scripts, expanding its capabilities beyond markdown instructions.
  • This example demonstrates how to create a simple script that outputs 'Hello World'.
# 6:47

Deploying Skills to Context Hub

How are skills deployed and managed in Context Hub?

Skills are deployed to Context Hub, allowing for easy updates and modifications without needing to redeploy the entire codebase.

  • Deploying skills syncs them to Context Hub for centralized management.
  • Changes made in Context Hub can be reflected in the deployed version without code redeployment.
  • Context Hub provides a user-friendly interface for managing skills and instructions.

Transcript

0:00 In this video, we're going to cover how to add skills to your managed deep agents. Skills are basically contexts and scripts that your agent can run and read dynamically as it's running. So, instructions, and if you haven't seen the instruction video, go watch that, but instructions are always added into the agent context. So, anything in instructions the agent will always see. That's great for influencing how it acts, but sometimes there's a ton of context that you don't want the agent to always have, but you want it to be able to read it or even run some scripts or run code as it needs to. And that's what skills are.

0:34 They're loaded through what is called progressive disclosure. So, not all of the information is given to the agent ahead of time, only the basic information about what that skill is, and then the agent can choose to read more about that skill and use that skill further if it wants to. So, skills themselves, they live in the skills folder right here, and they're nothing more than a folder with a particular structure. So, each skill under skills will have a folder, and let's say that's research, and then there has to be this one core skill.md file.

1:09 This is This is a file with a particular structure. In particular, it's going to have two fields that are required, and this is going to be in the front matter of this markdown file. It's going to have a name, and this is the name of the skill, and then it's going to have a description, and this is the description of skill. And this is what is shown to the LLM. So, only the information here is shown automatically to the LLM. All of the other information here, this is loaded only when the LLM chooses to read it or chooses to load it. And so, that's what progressive disclosure means.

1:41 So, let's add an example to our agent. Let's go here. Let's add a new directory. Let's call this skills. Let's add a new directory under this. Let's call it QA. And then let's add our skill.md file. So, in here, let's add some front matter. So, we'll use three dashes, and then we'll call it name, and we'll call it question asking. And then let's give it a description.

2:12 And let's say, "Use this skill to ask follow-up questions when the user's initial question is vague." And then let's add some details. When the user's initial question is vague, ask a series of follow-up questions to get more info. Ask one at a time.

2:43 Always don't ask more than three total. Don't be too annoying. Great. So, this is a skill that we'll give to this agent so that it can run this question asking skill when it needs more information. So, let's try out the agent with this skill. So, if we go here, let's run MDA dev and spin up our agent so that we can interact with it.

3:25 And so, now let's ask it a purposely vague question so we can see how it handles it. What's in the newest version? We can see that it's running. We can see that it's reading a file, and then it asks a follow-up question. So, let's see what file it read. So, it read this skills file. So, it read skills qa skill.md. And remember, that's the exact file path that lives here. Awesome. That makes sense so far.

3:57 We can see that the result it gets back, this is the content of the file itself. So, it's just reading the file. There's nothing special about it. It's just reading the skill file, but this tells the agent how to behave. And so, how does it know how to do this? And what exactly is happening in even more detail under the hood? Let's click over here. Let's look at our trace. Let's open this up in a new tab, and then we can see what's going on. So, there's one model call, and then this read file tool, and then another model call. And so, let's look at the first model call.

4:26 And so, we can see that in here it has this context about skills. So, if we don't add skills, it won't actually have this in the system prompt because it doesn't know it. But now, it does have it in the system prompt. And so, what is it telling it? It's telling it has access to the skills library. It's telling it where it lives, and then it has this thing here, available skills. Question asking. This is the name of the skill. This is exactly what went there. And then description, that ends up being put right here. So, this is how the agent knows what these skills are and when to use them. It it gets from the description of the skill itself. And then it has more kind of like context on how to use skills, how to read the file, when to use them, executing skill scripts. So, we'll get to that in a little bit, and that's basically it.

5:10 So, this is how the agent can know how to use skills. It reads it basically treats it as as a file overall. Let's give it another skill that actually has a script to run. So, let's go here. Let's add another directory. Let's call this simple script. Let's add another skill. So, even though we want to add script, we still need to always have the skill.md file. Let's add front matter. Let's do name simple script.

5:43 Description contains a simple script. Script is in hello.py. Let's now add this Python file, hello. py. let's have it do something really simple like print hello world. Let's save that. Let's now go back here. And we notice that it remounts this thing, so we'll cover the internals of MDA Dev in the server it runs later on, but it basically remounts changes live.

6:19 And so let's go back here. Let's go to our agent. Let's go to chat. Let's open up a new thread. Let's say run simple script. We can see it reads a few files. And so if we take a look at what exactly is going on, we can see that it first reads this file. It reads the simple script tool. It then goes into LS, so it lists all files in this directory, and it sees skills.md and hello.py. It reads files, so it reads this hello.py file. It executes it, so it calls this command, and it actually runs Python to run this.

6:59 And then it it it gets hello world back as a result, and then the AI says that it ran the simple script successfully, and it gets this result back. So this is how skills can contain things beyond just markdown files. They can contain scripts that you can run and do things with. The last part of skills that I want to cover is Context Hub. So when you run MDA deploy, it will push these skills up to Context Hub. So previously, the only thing in Context Hub was our instructions.md.

7:26 So let's cancel this, and let's run MDA deploy and start pushing it up. When this deploy succeeds, we can see or even before it succeeds, we can see that it synced these things into Context Hub. So let's go here, and we now have these skills and so it actually pushed up these skills including the script here and they're now present in context hub and we can see the content here. If we wanted to modify it here, we totally could. So, we could say "Hello world foo." and save that and then if we go and use this in in the deployed version, it will now print out this. If I use the local version, notice that doesn't change and so this is the difference between context hub and the local thing. For more information, this is the exact same behavior that happens for instructions and so if you haven't seen our instructions video on what context hub is and how to use it, you should check it out there.

8:20 But this is a really convenient way to manage and change and update skills without actually having to redeploy the code. You can do that all through the UI.

Summary

This video explains how to add skills to managed deep agents, which are dynamic contexts and scripts that agents can access as needed. Skills allow agents to read and execute additional information without overwhelming them with context, utilizing a structure that includes a core markdown file and optional scripts.

- Skills are contexts and scripts that agents can dynamically access during operation.
- Instructions are always available to agents, while skills use progressive disclosure to limit initial context.
- Each skill is organized in a specific folder structure, requiring a core `skill.md` file with a name and description.
- Agents can read and execute scripts associated with skills, enhancing their functionality.
- Skills are deployed to Context Hub, allowing for easy updates without redeploying code.
- The video demonstrates creating a question-asking skill and a simple script that prints "Hello, World."
- Context Hub syncs skills and allows modifications through a user interface, separate from local versions.

Questions Answered

What are skills in managed deep agents and how do they work?

Skills are dynamic contexts and scripts that agents can read and execute as needed, allowing for more flexible interactions without overwhelming the agent with constant information.

How do you create a new skill for an agent?

To create a new skill, you need to set up a directory structure and create a skill.md file with a name and description, detailing how the skill should function.

How does the agent utilize the newly created question asking skill?

When prompted with a vague question, the agent reads the skill file and follows the instructions to ask clarifying follow-up questions.

What is the process for adding a skill that includes a script?

To add a script-based skill, you still create a skill.md file and include a script file, ensuring the agent can execute the script when prompted.

How are skills deployed and managed in Context Hub?

Skills are deployed to Context Hub, allowing for easy updates and modifications without needing to redeploy the entire codebase.

© transcribe · For agents Built with care and craft by Gokul Rajaram