all right we are back with another master class this one is about prompting and prompting specifically for AI agents this course is designed to take you from a complete beginner to almost an expert in creating effective prompts specifically for AI agents by the end of this you'll be able to design prompts to make your agents handle complex tasks autonomously confidently and reliably wanted to start off with showing a quick agenda of what we're going to be going over in the master class today that way you can see what you're in for and see how each
module is sort of going to build on the last one but if you're not a complete beginner feel free to skip around if you want to go towards the end because we're going to start off with the basics and sort of build our way up from there but anyways five total modules today with a bonus module at the end the end is just going to talk about some emerging Trends and some of my thoughts about the prompt Engineering in the AI space and anyways module one is sort of an introduction to prompt engineering for AI
agents module two we get into Core Concepts of prompt engineering three essential prompting techniques four mastering structured prompt Frameworks and then five Advanced tools and techniques for prompt optimization real quick just wanted to mention if you guys like this type of content please feel free to join my free school Community the link is down in the description um we have a great community of people that like to talk about NN primarily but just all things sort of AI automation related I also post all of the resources I use in my YouTube videos on this school
Community for free so workflows and end and end and stuff like that then if you want to take your a automation skills one step further I've got a paid community that you can join as well great Community great network of people in this space we have multiple live weekly calls as well well as uh monthly competition with real prizes we've got a classroom of different modules that are going to be continuously updated every week and expanded as the space rapidly changes so I'd love to see you guys in either of these communities get the chance
to meet you and definitely just reach out okay so welcome to module one which is Introduction to prompt engineering for AI agents in this module we'll introduce you to the concept of prompt engineering and explore why it's critical for working with AI agents so let's just Dive Right In here so what is prompt engineering simply put prompt engineering is the process of creating inst instructions called prompts that guide an agent to perform a task exactly the way that you want it to so sort of like programming but instead of using Code you're using natural language
so almost as if you're talking to someone you're basically just telling the AI what to do in plain simple terms but prompt engineering is more than just writing instructions it's about thinking carefully how you phrase things to get the right output every time so think of it like you're giving directions to someone who can only listen to you one time there's no back and forth conversation you're not able to clarify things you need to be precise from the very beginning so here's a simple example let's say you're using an AI to help with scheduling a
clear prompt might be something like create a meeting for Thursday at 3 p.m. with John and include a video link that prompt you know it's very specific it's very actionable and it leaves almost no room for misunderstanding so why is prompt engineering important this is because it makes your agent more reliable so when when your prompts are clear well structured the agent is going to perform tasks accurately and consistently and this is obviously important for things like um things that are going to happen repeatedly or things that involve a lot of data like customer support
data processing or scheduling so in this master class you'll learn how to design prompts that are precise efficient and optimized specifically for AI agents you know mastering prompt engineering will allow you to create prompts that make your agents handle more complex workflows on their own which which is sort of you know the whole goal of AI agents so now let's talk about why prompting AI agents is different and also important than just prompting you know a large language model or chat gbt so when you're talking to chat gbt it can be very conversational it's like
you're asking them to answer questions and you can sort of follow up so you can go back and forth like I said you can follow up you can clarify you can fix errors as you go but with an AI agent you pretty much put that prompt in there when you're building out your your workflow and that's it they have to understand and execute what you want your instructions in just one single try so imagine the scenario you're running a business and an AI agent is set up to manage hundreds of customer inqueries every day it
has to answer each question or request correctly timely without needing extra clarification and you also don't have the time to go check and make sure that every single response is correct the agent just has to work and you have to trust that it's going to work so that's why prompt engineering for agents is so important because it's all about getting it right that first time so this becomes even more critical when you're using an agent for you know tasks like data entry or lead qualification that kind of stuff they need to be accurate they need
to be reliable and if they're vague or unclear the agent is going to produce inconsistent results which could lead in errors which could lead to errors in customer interactions or within your internal business processes which is obviously what we're trying to avoid so you know basically it's all about precision and Clarity and by the end of this course you'll be able to know exactly how to design these prompts to empower your agents to do their jobs autonomously okay already on to module 2 which is Core Concepts of prompt engineering so in this module we're going
to dive into the essential building blocks of every good prompt we're going to understand that these core components will give you the tools that you need to craft effective prompts for any task let's talk about the key components of a prompt so each component plays an important role in telling your agent what to do think of these components as sort of like a checklist to make sure that your prompts are clear structured and you know set up you and your agent for Success the first component is background so you want to give your agent background
information so it has a basic understanding of the task or context that it's working in this can include details about the subject the company or the specific context that might influence how the agent is going to respond so here's an example if the agent is helping with customer support you might include you are a customer support assistant for a tech company that values quick and empathetic service so obviously it's a very simple example but that's sort of the kind of stuff we'd be looking at here next is context this is all about narrowing down the
focus for the agent so you want to give it specific information on how it needs to handle the tasks accurately so if your agent is scheduling a meeting you might add the calendar should prioritize meetings with department heads and limit meeting times to no more than an hour this way the agent has a much better understanding of the conditions to actually work within and how to go about its tasks then we have instructions so this is kind of the heart of the prompt this is where you tell the agent exactly what to do instructions here
need to be you know obviously clear and specific so for example you want to write you want an agent to write a product description you could say write a 100w description for a smartwatch highlighting its Battery Life Fitness tracking and water resistance so as you can see here not much room for misinterpretation there it's very clear very specific then we have tools so obviously when you're working with an AI agent you're going to give them different tools so that they can actually take action on your behalf and you need to be able to define the
tools and when to use each tool so that it knows what to do and that it's not um you know calling an email tool when it really should be getting information from a database so the agent's going to have multiple tools usually so that's why you need to Define it very clearly so obviously you would like list out here are the tools you have access to and then you put calendar tool and a bunch of other tools and then for each tool you wanted to find it like use this to find free time slots for
scheduling meetings this is also interesting because in a multi-step workflow you could say like let's say you have a tool to get contact data you have a tool to um make an appointment and then you have a tool to send an email you could bake in the steps when you're defining each tool for example with a contact database or with emails in one of those steps you can say like you must call the contact database tool first so that you know the email address to send in the email tool so you can sort of make
like a flow by defining how the tools work in conjunction with each other and then finally in this section what we're talking about as far as components um we have examples examples are incredibly valuable they show the agent what kind of response that you expecting so this is going to help the agent understand tone format um details flow so for example if the agent needs to get contact information from a vector database then use that email to reach out and then schedule a calender event you would want to give an example of the query the
agent would get and then the actions that the agent needs to take so like I said just giving an example of what it should expect and then what you should expect type of thing but anyways each of these components these five components are going to help the agent understand exactly what you're looking for using these in your prompts makes it more likely that your AI agent agent is going to deliver the results you want every time but there's also a fine line because you don't want to just pack it full of information and we'll get
into you know how you make your your prompts effective without just info dumping basically so yeah next we're going to talk about tokens understanding tokens and cost efficiency when it comes to tokens um so a token is a term that's Central to understanding how prompts work and how a i processes them in the simplest terms possible a token is just a piece of language a unit of data that the AI is going to read and understand um what you're asking for so think of a token like a chunk of text so in this example AI
is amazing each part of this sentence may be its own token even punctuation so this could have four tokens right here AI is one of them is is one of them amazing is one of them and then the exclamation mark would be the fourth token there so you have different options of how you want to split up your tokens that sort of thing but just in general think of it as the way your text is being split up and um it doesn't have to just be text but the way something's being split up and put
into um a way that the AI can understand what you're asking for why do tokens matter so the more tokens you use in a prompt the more computational power and cost that it's going to take for the agent to process so this is especially important if you're using AI for tasks that happen frequently or involve a lot of data because those tokens will start to add up you know they directly impact how much your agent interaction will cost cost if you're using an API that charges by the token like open AIS so if you have
a 500 token prompt it's going to cost more obviously than like a 200 token prompt so that's why learning to write very lean but still very efficient and clear prompts is a very important skill which obviously this is kind of why I wanted to make this course and so why do tokens matter obviously it's about saving money but efficiency isn't just about saving money it's also about getting the AI to respond faster and in a more streamlined way so for instance if you have a prompt that's way too long and complex it's going to slow
down the response times which you know how long your agent takes to respond and get the job done but also it's going to increase the likelihood of error within your workflow so whenever you're crafting a prompt think about the tokens you're using and um you know think about if they're all necessary could you make your prompt more concise without losing you know the context and the clarity without losing the information you already have in the prompt this is where the skill of promp compression comes into play we'll cover this more in depth in module 5
but you know prompt compression really going to come in handy here when you're going over your prompts but just wanted you guys to understand tokens and the aim for cost efficiency which is going to help you make smarter choices when you're creating your prompts as far as keeping them clear and um budget friendly at the end of the day now that we have an understanding of the main components of prompt and we understand tokens let's introduce a concept that's at the core of prompt engineering for AI agents which is structured prompting and this is just
basically a way of organizing your prompt in a clear logical format unlike a casual conversation where you can sort of be vague or backtrack a little bit structured prompting make sure the agent has all the information it needs upfront in a specific order so why does this structure matter it's because it guides the AI through the prompts like a set of instructions it's going to tell the agent what's most important what to pay attention to and how to proceed step by step structured prompting is especially valuable for AI agents because a lot of times they
need to handle complex tasks autonomously so imagine you're giving instructions to someone who can only listen once without the chance to answer questions this is going to help you be precise so that the agent doesn't misunderstand or Overlook important details you know each part of the prompt has a purpose and a place sort of like a recipe with um specific steps to follow in the correct order let's break this down with a quick example so suppose you're designing a prompt to get an AI to draft an email a structured prompt could look like this so
we've got the roll object or sorry role objective context instructions and example the role is that you're a professional assistant writing an email on behalf of an executive the objective is the goal of the email is to thank a partner company for their recent collaboration context the partner company helped with a recent event that was a success and we want to emphasize our appreciation and hopes for future projects So the instructions are to start with a greeting mention the success of the event thank them for their contributions and close with a line about looking forward
to Future collaborations and then as far as an example we want to outline sort of the input that the agent's going to get and then the way that it should respond so the user here would say draft an email to thank ABC Corp for their partnership on the recent marketing event the AI agent would then respond with um dear ABC Corp I wanted to extend a heartfelt thank you on behalf of our entire team for your invaluable support in making the recent marketing event of success your expertise and dedication truly made a difference and we
appreciate all the hard work blah blah blah signs it off as email so as you can see because it had all of you know the background information about its role and its objective and its context um it knew sort of how to structure that email and then this is going to give us consistent time consistent results every time we ask this agent to sort of make an email for us obviously each part um guides the AI in a very logical flow and it's going to proove the accuracy consistency and all that good stuff before we
finish module two there's an important concept I wanted to talk about real quick that you may have heard about in regards to AI agents which is AI hallucination AI Hallucination is the term used when an AI generates a response that seems plausible but it's actually like completely made up or incorrect and this happens when the agent fills in gaps in knowledge with information that it just invented it sort of hallucinated and gave you that response it's going to be common in very complex or ambiguous prompts where the agent might not have clear guidance on what
to do next what to say and so this happens when the agent doesn't know information in the way that we do so instead they predict the most likely next word sort of based on their training data or based on the model and sometimes they will overreach and they try to provide information that they weren't trained on yet or that they don't you know know so this leads to them making up details so for example if you ask an agent about a specific but fun but fictional event it's going to create details around that event to
give you a coherent answer even if these details aren't accurate so like on the one hand it's super cool that we're at this point in technology where we have generative AI that can be creative and that can make things up and help you with ideas but at the end of the day we need to make sure that we're structuring our prompts efficiently and effectively so that they don't you know go to this space where they hallucinate and make up information especially in you know a use case where like let's say you were in you know
the healthcare world and you needed help with the medicine and they just start making up answers that is Bad News Bears then the question is how do we actually reduce AI hallucination using our prompts so I I don't know if it can be like completely eliminated you can definitely reduce it to a bare minimum and mitigate that risk by having clear concise prompts so here are my tips for doing so obviously you want to be specific the more precise that you are the less likely it is that the agent will stray away from the facts
that it has so avoid ambiguous questions or leaving too much room for interpretation so like instead of saying um explain the causes of recent business Trend you would say like list three specific factors that contributed to the increase in um online shopping during Co 2020s so that sort of thing very specific and now it's going to it knows what to zero in on rather than just you know making up things next we have providing context and constraints so include background information that guides the agent and sort of sets limits on the type of information it
should give so you know tell me about climate Solutions is going to leave it up very vaguely that's why again with same same thing the last example you want to say like list only three solutions that were backed by science for climate you know that sort of thing I'm no scientist um anyways request known information only so if it's possible ask the agent to only provide responses based on widely accepted knowledge rather than hypothetical um scenarios and then finally check for consistency so when you're working with the agent for complex tasks it is good practice
to verify the output especially if the agent is used in situations where accuracy is crucial like customer support or decision- making or um like medicine like I previously talked about that sort of stuff but those four tips are you know they'll definitely put you down the right path as far as you know making sure your agent is not hallucinating and making up stuff quick recap of module 2 we talked about prompt components we talked about tokens and understanding the cost efficiency and then we talked about structured prompting and AI hallucination so now that you've got
these Concepts under your belt have a solid foundation to start creating effective prompts so we're going to go into that next module where we talk about essential techniques so let's just move on to module three okay module three is essential prompting techniques in this one we're going to dive into the essential prompting techniques to make your prompts more precise and effective for AI agents role prompting we have briefly talked about it in that previous section with structured prompting we talked about outlining the role at first but basically role prompting is just defining a specific role
or you might hear persona for the agent to adopt in order to align its responses with a specific tone specific expertise and a specific um focus so for example you wanted the agent to handle customer service queries you would assign it the role of a customer service representative and that helps the agent you know be friendly and professional in the way that uh customer service rep would be so here's why role prompting matters when you define the role it's going to understand you know the language and the level of expertise and the approach that it
should use so yeah pretty self-explanatory let's let's get into it quick example suppose you want the AI to explain a complex product feature you could prompt it like saying you are a technical expert explaining explaining this feature to a customer with basic knowledge you simp simple language but provide detailed insights into how the feature works so this is going to be super helpful as we move into more advanced tasks where you need to make sure that you and your agent are both aligned on the type of tone and focus that it's going to be taking
on then you might have heard of few shot prompting so this is a technique where you provide the agent with a few examples of inputs and outputs this helps guide the agent's response style format flow and even sort of helps them categorize decisions so I'll show an example of categorization in a sec but by showing the the agent examples you sort of set the standard for its responses and it's going to make them a lot more reliable and consistent so here's an example where let's say you're using an agent to classify customer feedback and it
can be positive neutral or negative and then you can prompt it by showing these examples of what a positive feedback looks like what a negative feedback looks like and what a neutral feedback looks like um which is going to you know just help the consistency of the agent's responses coming back then we have Chain of Thought in which is especially useful for tasks that involve multiple steps or sort of logical reasoning to go through to take place with this type of technique you can ask the agent to Think Through tasks step by step and that's
going to help it process information in a logical order and it's going to improve the accuracy of sort of the final result so like I said IDE deal for complex tasks you know with like calculations or comparisons or you know multi-steps within a step so this is when you'd want the AI to make sure it's following a sequence of instructions let's say you want the agent to calculate total cost of an order with a bulk discount and a shipping fee if you just told it that I don't know if I I don't think it would
do it correctly um so anyways the prompt you could say you calculate the total of total cost of 100 units price at $10 each you would apply a 20% discount and um for anything over 50 orders you would add a $25 shipping fee so your Chain of Thought prompting you can show the actual steps multiplying the units by the price and applying the discount and then the shipping fee and then you get to your final answer so this obviously just shows an example for the AI agent of breaking down the tasks making fewer errors and
probably producing a more reliable answer and just super crucial when you're working with um multi-step tasks but it's always you know a lot of times you don't have to just know exactly what to do when to do it and later we'll talk about sort of the way that you can provide feedback and you can like test but a lot of times it's just like playing around seeing seeing if it did it correctly or incorrectly seeing why adding something in running it again taking things out running it again so you it's definitely something that you just
sort of get the hang of but these are good Concepts to know um at a high level and then I think just to close off this module we'll talk about markdown formatting real quick um if you don't know what it is it's just basically the way you can add structure and organization to text it's not even specific for prompting or AI agents I think it's just a thing but um it makes it easier for both humans and agents to read things and understand importance in certain things so you can use headers bold text bullet points
stuff like that so I'll just fly through this section because it's not too complicated but um you know the first one we'd have headings so obviously allows you to organize information into settings it helps the AI recognize that things are separate which is helpful for multi-steps or topics and you would do this by using um the pound sign so this symbol the hashtag the pound whatever you want to call it this is you know like you can do one for a top level heading two for second level and three for third level heading and just
kind of break stuff down then we've got bold text obviously we all know what bold is and we all know how we want to use this to highlight importance in markdown you would do um double asterisk you could also just do one asterisk but double is going to be like more important so as you can see these examples let's say we wanted to say please make sure to double check all data points that's super important you have to double check just throw that in bold and we got bullet points um this is pretty self-explanatory too
but you use a dash or you could use asteris too um just at the beginning obviously but you could I pretty much always just use dashes and then the agent knows it's like okay these things sort of all relate because they're all like a list or instructions that sort of thing then we've got horizontal lines which are good just to separate actions to create a very visual break in a prompt or in you know some sort of information so when you're when a prompt gets pretty long and you just want to break things up throw
in a line it's just a simple as throwing in a line then here's just a quick example just to show it all sort of piece it all together we've got a header up top and a header at the bottom so that we know these are like sections we've got a numbered list 1 through four and each of those numbered lists um are bolded like the actual information and then within each of those sort of numbered lists we've got bullet points within those two so that lets me easily see like what I'm looking at and also
the agent is able to interpret that too I didn't throw in horizontal lines here but let's say at the bottom after the conclusion you could throw in a horizontal line and then below that line you could have just like extra notes in case you wanted to just highlight a few extra things but that's sort of you know how it looks just to finish off this module real quick we've got a section about emotional manipulation and importance so kind of similar to the idea of markdown with like making things bold and making things look more important
but this technique involves using language that adds a sense of urgency or importance or even emotional weight in some cases so it sounds dramatic but adding urgency can really help ensure that the agent prioritizes certain parts of a task so you know by using strong language the agent will understand what's non-negotiable and what is like particularly more important than the rest of the prompt quick example let's say you're using an agent to send a reminder email for an urgent deadline you could prompt it like saying draft an email reminder to the client about their upcoming
deadline it is absolutely essential that the client understands the urgency of submitting their materials by the deadline missing this deadline will ruin the project timeline so words like essential urgency ruin ruin in all caps um you could even make some of those words bold if you want but it adds you know an emotional weight to the task and single signals the agent that the message needs to convey some sort of urgency and it can be very effective when you're when you need to prioritize certain details or you have you know deadlines or safety hazards or
you know anything critical you can definitely use some emotional manipulation there quick recap of module 3 we covered role prompting few shot prompting Chain of Thought prompting markdown and emotional manipulation and importance all of these techniques you can sort of bake into your prompts which are going to make them more reliable and sort of help you align your agent with your goals so now we're going to get into module 4 which we're going to talk about some structured Frameworks for organizing prompts that are really going to help you take them to the next level all
right module 4 we have mastering structured prompt Frameworks in this module we're going to explore structured Frameworks to help you organize your prompts effectively using these Frameworks can help you make your prompts once again the common theme making them more accurate and reliable so let's get into this module so when you're prompting an agent there's usually two sort of structured Frameworks you want to use it's either long structured or short structured or at the end we'll talk about a more agent specific one but either way long structured you have the key components of roll objective
context instructions examples and notes when you combine these elements the agent is going to have all the information it needs to generate a comprehensive accurate response these long structured ones are usually better for tasks where there's multiple steps obviously and things are critical like generating a report or analyzing data or providing some sort of detailed summary and it has to grab information from somewhere else and then the short structured is kind of just like a streamlined version of the long structured prompt because sometimes you don't want to overwhelm your agent that'll actually just confuse it
and once again you know like a lot of times I'll start off with sort of a long structured and then test it a few times and then take things out and see if it's still working and it obviously is more efficient and then it's going to be cheaper with your tokens but it doesn't need much context or detail in this version it's going to be more straightforward tasks like quick responses or summaries or even classifications where the AI doesn't really need a ton of background information it's just something that it could do right away because
it's a task if that makes sense but here you're just going to give it an objective what it needs to do how it does it and then if you even need to you can give an example so a lot of times I'll use like a long structured one in like an agent that has multiple tools to call or multiple workflows to call and then a short structure you could use use for something like a message and model node or even like one of those sub agents in a larger agent workflow where it only has access
to just email actions or something like that so you kind of got to play around with it but it's important to understand the two different Frameworks or of course the third framework we have a more agent specific one and I think that this one I like to think is more when you've got an agent with multiple tools or multiple agents that it has access to but anyways this is tailored towards the a agents because they need to make decisions inter act with more tools um handle tests that are a higher degree of autonomy basically so
in this framework we incorporate some extra components that help the agent understand sort of its its standard operating procedures and all the available tools so we're telling it its role objective it's sop tools and sub agents so that's sort of why this one's more specific for agents and then obviously instructions with examples at the end so by including you know like an sop and Tool descriptions it's going to give this agent more guid and give it the information it needs to act autonomously which is kind of the goal of AI agents obviously so it's ideal
for you know self-guided agents that want to operate within a specific set of guidelines and responsibilities and when you do this right it can be super super effective as far as the agent being able to just completely be like a virtual assistant basically so module 4 was really quick just want to recap we did long structured short structured agent specific and like I said you kind of want to play around but these are good Frameworks to help you approach crafting your prompts and testing them and um you know making changes as necessary but let's move
on to module 5 this module is all about Advanced tools and techniques for prompt optimization we're going to explore some other tools you can look at not go too in depth but just kind of open your eyes as to how you can get more advanced and you know like refine manage test and give feedback to the AI so let's get into this module so just a high level overview of two tools we'll talk about which is prompts layer and using cost calculators and I'm not going to dive too deep into these tools but obviously just
wanted to give you a sense of how you could optimize but prompts layer is a tool that's going to help you track test and manage multiple versions of a prompt so that's how it really comes into play where you can you know store this one and test out this one and document responses and all this kind of stuff but yeah like I said it's going to allow you to sort of run a a andb tests compare different versions see what works best you can track your history you can measure changes for accuracy and performance so
this is going to help you choose the most effective prompt for your specific task and um it's it's cool you can kind of store these and look back at them and then later when you have a similar use case or a complete different use case you know sort of what to do what not to do and then we've got cost calculators which I think are super cool especially you know earlier we talked about tokens and cost and efficiency but when you're working with large language models you know obviously we have our tokens and they impact
the cost so you can use a cost calculator like this one I think I just typed in open aai cost calculator pops up or no open Ai tokenizer and then you can put in prompt so in this example we have super simple prompt about acting as customer support for small online clothing store and it shows us that it was 35 tokens 223 characters and you can choose a different model that you're going to be running it through but they'll tell you exactly how much you know you how many tokens so that you can kind of
control the cost and adjust your prompts to reduce your token count which is pretty cool so this kind of stuff like I said it's going to allow you to streamline the process of your testing and your cost estimation which is going to be super big when you start running agents at scale and you just you know running them over and over multiple times a day jumping off of that wanted to talk about prompt compression and how you actually make them smaller and save money um you know this is obviously all about reducing unnecessary tokens without
sacrificing the quality which is the most important part because you still need the actual content of your prompt to get through to the agent so after this module if you want to know more about the technical details behind prompt compression and how you actually get in there and really do it um go check out Mark cf's Channel I I just watched a video from him about um promp compression and that's where you know these next slides two methods that he talks about is that's what I'm going to talk about but he goes way more in
depth and great video so go check that out but anyways he talks about two methods to actually compress your prompts the lazy method and the technical method and I completely understand why it's called that because I definitely use the lazy method but this one just involves manually removing redundant or unnecessary words from a prompt using like chat gbt or using AI to make your AI type of thing so you know there's also custom prompt compressing gpts but basically you just want to tell it that the goal is to keep the core elements and communicate the
same information but just get rid of the unnecessary wording so in this example we have an original prompt um which is I would like you to please generate a detailed summary of this report focusing especially on the areas that are most important but you could also just compress this down to summarize the key areas of this report and pretty much gets the same message across so obviously it's just like the same concept of like when you're writing an email or when you're writing a draft or a report like you just want your wording to be
concise so same concept here and then the technical method uses um you know algorithms or different Tools in order to identify which specific tokens are high value and then which ones can just be taken out and this method is really interesting because these tools analyze the prompts and identify specific words that don't actually impact the response so it'll take them out and it's obviously very useful when you're working with long prompts and sort of a high volume um environment as far as your workflow because it's going to maintain the consistency but keep your cost down
and it's interesting because the outputs don't always make sense to us because it'll take out some you know filler words that are you know important for gramar and for like flow of conversation in our head but the AI can still understand what's going on because it has those high value tokens in there and they're you know placed in a specific order so just to recap efficient promp compression will significantly reduce your cost over time and um you can do that in a couple methods and if you want to check out technical method definitely go check
out Mark's Channel now let's talk about iterative refinement and feedback loops so in prompt engineering it's rare to create the perfect prompt on the first try that would be pretty impressive but you often have to test refine and adjust your prompts based on the performance and based on the output you're getting from your agent so this process is known as iterative refinement and so there's sort of three ways to use iterative refinement first one is testing and adjusting you'll run your initial prompt you'll assess the agent's output if it doesn't meet your expectations which it
probably won't always exactly the first time then you'll identify what parts of the prompt might be confusing or unnecessary or too loaded or not loaded enough and then obviously you'll adjust your prompt add Specific Instructions or remove specific details and then you'll try again and adjust and also you can document your changes so when you make the changes you document The Prompt and then you note what you did and then you can note like how it came out and that way you can compare different versions and see what worked best so something like prompt layer
obviously makes that really easy for you to do storing your versions and allowing you to track what changes led to Improvement and then you have example based learning which is providing specific examples within your prompt to guide your agent so we talked about this a little bit but these examples are going to help reinforce the desired output so easier to understand the context and requirements for your agent super quick example of iterative refinement initial prompt Is Write a brief summary of the feedback report covering all areas where customers mentioned concerns and then you would adjust
it to summarize the feedback report focusing on the top three customer concerns as you can see in this example the initial prompt was vague so we refined it by saying top three customer concerns to make it more focused and then through iterative refinement we also had guided the AI to produce responses that better match our expectations finally let's explore creating and managing feedback loops a feedback loop is a way to continuously improve the agent's accuracy over time especially in a high volume environment so you want to provide feedback based on past resp responses that will
help your agent learn from previous interactions which will make the future responses more reliable trustable so there's three things again here we have first providing clear feedback when the agent produces an output that's of Target you want to correct it in a um very you know in a helpful way directly in the prompt or through your instructions so for example if the agent consistently includes unnecessary details add a note that says Focus only on the main points avoid extra details so one example of doing something like this is if you've watched some of those email
videos i' done maybe in end end a lot of times the agent would sign off with um like square brackets your name your company name and we would just directly go in there and say like never never include square brackets with a variable like always fill it in with Nate herkelman or something like that then you want to establish a standard operating procedure so if you're using an agent for repetitive task tasks establish an sop um for feedback so this could involve steps like documenting common errors noting improvements um setting reminders that sort of stuff
and then obviously you want to use itative testing we just talked about that but run different versions see how they adapt and then rinse and repeat so to recap this module covered you know Advanced tools for testing and optimization we talked about cost savings as far as prompt compression talked about iterative refinement and feedback loops and then also creating and managing those feedback loops um within your your environment all right and now bonus module just some stuff I thought that would also be important to include but I didn't really know exactly where to put it
but the space is obviously changing so fast so you have to understand that like prompting may also change and have to adjust a little bit and like when you have an agent workflow is running consistently in a month it may stop running consistently and you need to go in and fix the prompting but anyways we've covered you know Core Concepts core Frameworks um and techniques but AI is going to continue to advance and new trends are going to emerge so I just thought we'd briefly talk about you know like these Trends and what's give a
sense of what's on the horizon okay so advancements in AI models one of the biggest drivers of change in prompt engineering is the rapid advancement of AI models like I just mentioned like gbt turbo 01 and then the anticipated 5 but each new generation of models comes with many different things it comes with refine capabilities um you know could have greater accuracy greater understanding greater efficiency but you never know sort of how that's going to affect your current prompts these advancements mean that these future models could require less handholding they could be better understanding context
with fewer examples and they could be more Adept at following your structured instructions or they actually may need more prompting in certain areas and you know Less in some as well but as these models grow more complex they will also probably become better at picking up subtle nuances that may require more advanced prompts like I said to fully utilize their capabilities so some prompts may include more refined role assignments or Specific Instructions to help a model act more like an expert within you know a specific field then also tools within AI agents so this is
you know something that we're doing right now but I could just see it this space changing a little bit in the sense of the way tools work but that's one of the most exciting things right now is Agents can have tools and take action on many different things so because they're being continuously integrated with different tools that allow them to access different things calendar email calculations databases whatever it may be this is going to shift prompt engineering strategies because you have to make sure you're always outlining these tools and how they're going to work so
this may require a new approach to prompts like specific instructions on how to handle them and I know we talked about this but just something that um I wanted to bring up because as tools get more complex and you know we're already getting to the place where you have agents that manage multiple agents and then those agents manage more agents so just something to sort of keep in the back of your mind as far as prompting them and then finally the last thing I had was just a specialization and advanced customization so you know models
are becoming more specialized and we're seeing that Trend towards customizable agents so they can perform tasks within specific domains you know Finance Healthcare customer support and they're going to start to be able to understand probably like industry specific jargon and like Advanced metrics of you know like if they're in finance they'll have Advanced Financial metrics and finance specific jargon stuff like that um so this trend is going to allow prompt Engineers to customize these prompts further and really integrate like a domain specific instructions and terminology into their agent workflows and so really the point of
these last couple slides was just to remind you of like just to to always be looking ahead in the space because you'll get something set in stone and like that doesn't mean it's going to work like things will things will change and things will break but that's like kind of the beauty of it is because everything's so new and like we're we're we're on the front end of this curve right now we get to do a lot of experimenting and just understanding what works and what doesn't and specifically what works for you and what doesn't
work for you because you know everyone operates a little different but just sort of a reminder to always stay looking ahead but that is going to be it for this master class where we talked about prompting specifically for prompting AI agents um you know if if there's any doubts still I know we started to get a little more advanced at the end but there's definitely still a lot of room for learning more about prompting so any doubts um feel free to join my free school community the link for that is down in the description um
you can hop in there and shoot me a DM and I'll I'll get back to you as soon as I can I love to help you guys out and I love to meet you guys so yeah um I really appreciate you guys making it to the end of this video if you did and I'll see you in the next one so thanks guys