Okay. So in the last video, we looked
at building, a sort of email reply system with CrewAI Llama 3 and Groq. And I mentioned at the end that I
do something like this in LangGraph. So in this video, I'm going to go into
sort of rebuilding and actually making us a more advanced version of what
we had in CrewAI, but in LangGraph. Okay. So first off it's important to
understand where does LangGraph actually fit in this sort of ecosystem. So most people know LangChain. so on one side of things, you've got
LangChain, which deals with the chains and the prompts and stuff like that on the other side, you've got fully
autonomous agents, which are things kind of like, I guess, AutoGPT. the idea is that the fully autonomous
thing can basically do all its planning, do all its, tool choice,
doing everything like that without you giving it, anything in there. And sort of in between these two
extremes, you've got LangGraph. so what LangGraph basically does
is it gives structure and state. so that we can create agents, but
in a way that we've got them so we can monitor what's going on. we can basically control their next steps. We can control the whole flow engineering
Elements that are going on here. And I'll talk about that as we go through. So where does CrewAI fit in? so if we look at CrewAI, it's probably
somewhere between sort of LangGraph and fully autonomous agents in that
the agents in CrewAI can make more sort of independent decisions at
times, even though CrewAI is written, basically on LangGraph and LangChain. but you lose a lot of
the control for this. So, many people have asked me like, okay,
would I put CrewAI stuff into production? And the answer is no, I would use
CrewAI for basically testing ideas out for getting things going. and then I would convert it to
something that's more stable, something more where I've basically
got control over the next steps. And I can monitor that and I can guide
that so that I know that, okay, I'm not going to be wasting lots of calls doing
the same thing over stuff like that I can write in the conditional logic that
I want to guide and control the flow engineering as it's going through here. Okay. So I've done a whole video
about LangGraph before. They have made some changes
to the API since then it's developed quite a bit more. but there's some key concepts that I
want to go through here, just cause we're going to be talking about these a lot. So you're going to have, your chains,
which, basically the LangChain chains. These are, just stringing prompts
together, that kind of thing. also including things like output
parsers, choosing your language model that kind of stuff there. You're going to have nodes, which are
going to be functions that run chains. You can think of them literary is
running chains or running tools, so they can be running things like
search doing things like that. we're going to have edges. the sort of represented here by
the, this red line, which will basically connect nodes together. So that we've going from one, set
of calls to another set of calls. and then we're going to have these
conditional edges which in some ways operate a little bit more, like nodes
in that they're a function that kind of decides, okay, which no do we go to next? So you'll see that I use these
things for deciding, are we going to basically do some research or
we're not going to do some research? Are we going to rewrite an email or
we're not going to rewrite an email. These are done with the
sort of conditional edges. So the idea here is that we're
building a graph of nodes and connecting them via edges. And we've got hardwired edges where
this node must go to this next node. And then the other way is we've got
conditional edges where, from this node it might go to 1, 2, 3, 4, or variety
of number of different nodes in here .
Now the other key thing to
understand is the idea of the state. So the state graph, they call it in here. You can think of all of this as kind of
like being a big state machine that you're guiding this sort of flow around a graph. but we're we're maintaining this state of
variables of what's going on, of what's being updated , that kind of thing. so you'll see in the example that I'm
going to go through, I'm going to have a draft email that we're going to save
to that state, and then we'll be able to pull it out and access that from
other nodes that didn't create that. So your state is what gets passed
around from node to conditional edge to node, as it goes through. Now, it's really just your set of
variables that you've got in there. And there are a number of different
tricks that you can do with that. I'm not going to go too in depth to those
in this video, I've kept it really simple and just made it so that we're going
to access these variables from this. and then from this, we can look at
adding more advanced things over time So what we're going to build here. is very similar to what we
built with CrewAI last time. we're going to start off with
an initial email as an input. we're going to then categorize that email. We're then going to go
to a conditional edge. So I've represented these conditional
edges here with like diamonds, where it will decide, Hey, do we need to do
some research for this email or not? Now in this case, we're going to the
web to do some research, but you could imagine that this is going to be a
RAG system or something like that. And maybe in a future video, We can
actually swap this out for a RAG system and look at how that goes, from, there. Now if we don't use the search,
either way, we're going to end up at doing this draft email here. So we're either going to go from the
conditional edge , deciding no, we don't need research and just going to the draft
or we're going to go through doing the research and then we're going to basically
automatically go to the draft here. the draft we'll check to see
if there's any research or any documents that it needs to basically
write the draft, et cetera. And if they're there, it will use them. If they're not there, it
doesn't need to use them. And the way it's going to access all
of that is through the state graph. So for example, as we do the email
category that gets saved back to the state graph as we go through. As we do research that gets saved back
to the state graph as we come to do the draft, it will load up the email
category and the research use that. and then save the draft back
to the state graph in there. From there, we basically got a
simple, again, another conditional edge and this is kind of doing
a little bit of reflection here. So the idea here is that it's
going to basically decide if it needs to rewrite this. and actually if it decides
that yes, it probably should. It then goes off to sort of like an
analyzer node where the node here is going to basically just look at it and make
some recommendations for rewriting it. Pass those on to rewriting. and then we come up to the final, email. If it decides that it doesn't need to
be rewritten, it'll just go straight to actually a little node that goes in here. which will basically take the
draft email and convert it to the, be the final email here. So the idea here is that we've got
this kind of reflection thing going on. Now, the way I've done
it here is very simple. All right . You can certainly
play around with this a lot more. You could imagine in this conditional
edge here, that it checks the email for brand standards or, is it mentioning
any other competitors' names or anything that wrong that it shouldn't
be mentioning that kind of thing. Now, the way that we're doing this, these
can actually be a language model calls, like I'm going to show here, but they
could also just be like a Regex function or something like that in there as well. So you've got a lot of opportunities
here of how you guide this flow. And this is the whole sort of
idea here is that we're building a flow of how everything should go. And this is often where you'll spend a
lot of time sort of thinking through, okay, I want it to do this step. And then this step. And then you gradually go through all
the steps to get your final output here. Now I will say that in some ways,
this is probably overly complicated for just, rewriting a simple email. the idea here is I want to basically show
you the different sort of examples of conditional edges, show you, connecting
the nodes together and putting all these things together as we go through this. but it's certainly something that
you could take, and make much more complicated agents where they've got the
variety of different decision points. Now, one of the cool things that you
can think about with this is that at any point, it's very limited what it can do. So even though it's like an agent
here, and it's making decisions. It's not like those decisions
can be just totally wild. When it gets to this rewrite part, it
can't decide to go back to the researcher. It can't get in this sort of loop of
where you've got things just going on again and again, because it gets
tricked or something like that. Where we've basically conditioned
the flow in a way that it can only go in the directions that
we're allowing it to go here. And this is one of the big advantages
of LangGraph over the sort of like fully autonomous ideas of
where you're setting things up. And they just go into,
loops and stuff like that. those kinds of examples, you
end up debugging by rewriting your prompts a lot, rather than
rewriting the structure of the flow. So the reason why I like LangGraph
probably more than CrewAI, even though it's going to take a lot more code is that
at any point you can log things out here. You've got full control
of what's going on here. and you don't have to worry about
getting the exact right prompt to get it to go to the next step. It can only go through flow
that you've allowed it to do. Now I could. come here and add in some nodes that
go back and recategorize I could, of course I can always do that. But that's my choice to do it, rather
than just leaving it up to an LLM to decide all these sorts of things. All right. Let's jump into the code
and get started with this. All right, so let's jump into the code. So you can see that I'm basically
just bringing in some of the standard imports or like before actually I'm not
going to use duck duck go this time. We're going to use to Tavily search. but I'm bringing in
basically langchain.groq. which we're going to use for Llama 3. And then we've got the various
LangChain, imports and LangGraph in here. all right. So the goal here is kind of
similar to what we had before. we're going to take an email as input. we're then going to
basically categorize it. We're then going to basically pass
that category and the initial email to a sort of decider or a router. Which is going to decide whether
it needs to do some search for it. It will then basically the search
nodes will look at the email, work out the best keywords for the search that
relate to that email, do the search, bring all the data back store that. then use that and the categorized
email and the email category to write a draft reply. And then we're going to have another
sort of checker which is going to basically check, you know, does it,
the draft reply need a rewrite or not. So this is kind of a reflection
or recursive improvement sort of step in there. So we didn't have that
in the CrewAI version. but we're, we're putting that in here. All right. So, you'll see that most of
the, imports and stuff like that here are pretty standard. we're setting up Llama 3
70 billion on Groq again. same, like we did before. We're going to be using
that as a chat model. So to get that to play nicely,
we're going to basically using, you know, the chat prompt templates,
et cetera that I've got in here. And we're also going to
have some output passes. So a lot of the calls we're going
to use are going to be JSON. so we want to pass those back as JSON. and some of them are going to be strings. So we're going to pass those
back as strings in here. All right. Got a little utility
function just to ride out. Some of the outputs as we
go through to mark down. It's not really needed. It's more just as be able to see
later on what actually happened in your agent as it ran through. Right. So, I talked about in the previous
part that you've got chains, you've got nodes, you've got, you know, edges,
you've got conditional edges in here. The first thing that you want
to set up is your chains. So you can see here, I'm going to
have a variety of different chains. So I'm going to have a chain
to categorize the email. I'm going to have a chain to sort of
decide whether we do some research or not. I'm going to have a chain for
doing the keywords for finding the keywords for the research. I'm going to have a chain
for writing a draft email. And I'm going to have a chain
for checking that email. So that's going to be basically
deciding whether we do a rewrite or not. And then if we are going to do some
kind of rewrite, we're actually going to have like a self-reflection step. So this is sort of like a draft
email analysis step in here. so there's chain for that and
then rewriting the actual email. There's a chain for that as well. So there are quite a number of chains
in here you know, For doing this. Now, like I mentioned earlier on, this is
probably overkill for writing us an email reply to a customer when you come back. Right. That's not the sort of main
thing I'm trying to show here. I'm trying to show how you can basically
put all these things together to actually, you know, build something. So let's go through the
change pretty quickly. you can see that basically just
got the chains set up for Llama 3. a lot of these are going
to be quite similar. Where I could have basically copied
kind of what we were using in CrewAI and brought that across here. So you should see a lot of them will
be in a kind of similar in here. And then for each chain, the way I do
it is basically we set up the chain then we're going to use lane chain
expression language to actually take the chain, join it to the LLM and then
join it to the output parser in here. so this is basically the email
category generator kind of thing. And then I'll test it out, you
know, each time I make one of the chains that basically tested out. So you can see here I've
just made a little, email. we run that through and we can see
that this email has been categorized as customer feedback in here. Right. The next sort of one is a research,
the research router, right. Deciding whether we're going to
basically, you know, Just write the draft email straight away, or we're
going to do some web search and do some search and that through this. Again, we can kind of try this out. here, obviously we're now parsing in. If you look at it, our input variables. We're passing in the initial
email and the email category. Whereas up here, we were just
passing in the initial email. Right. and you'll see that as we go
through, we're going to pass in, you know, more and more things. Alright. The search keywords. So here, we're starting to pass in again,
the initial email and the category. and we're going to be basically using this
to Generate keywords, which are then going to be used to do the search in there. All right. The next chain up, is the
actual drafting of the email. So in here, we're going to be passing in
the initial email, the email category, the research info is going to go into this. the key thing here is that we've got,
you know, just some things talking about how to sort of use the category. And you could totally
customize all of this. I haven't put a huge amount of
effort into the prompting here. I've been more sort of setting up
the flow and the structure of the whole thing as it goes through here. but can see that, okay, we're
going to be basically taking this. Now, on this particular one, you
can see we're passing JSON back and we can see this because we've
got our draft, writer there. But we're going to be passing back JSON,
we're going to use the JSON output parser. So to do this, you want to make sure
that you've got something like, you know, return the email, a JSON with single, key. no preamble or explanation. the parser is actually pretty good
at sort of filtering out things like that anyway, as you go through. And you can see that, okay, given my
sort of initial, email that I had above. And the category I've now got this
sort of email draft back, in JSON. And it turns out that the emails that
had come back with a pretty good, right. So most of the time it's not
going to do a rewrite for this. It's not going to need to do a rewrite. The email will sort of answer
everything that was in the initial email and stuff like that. So much so that I'll sort of have
to fake a bad email to show you, you know, getting it to do the rewrite. Okay. So the next step is basically the
rewriter or the conditional edge prompt, for doing the rewriter. So this is deciding here
whether it does a rewrite or whether it doesn't do a rewrite. So you can see here, it's going
to give a binary choice back of rewrites or no rewrite, in here. and can see that if we run this with
a bad email, Then it will say rewrite. but you'll see for most of the
time when it's generated the draft email, it set itself. you're going to find that it actually is
usually not going to want to rewrite it. It's going to be fine with it in here. So this is sort of like, you know, this
is a conditional edge to decide if you go into some kind of reflexion step. I could've just automatically gone
in there and gotten the analysis back and done a rewrite that, you know,
that's something I could have wanted to show you another example, though,
of using this conditional edge because the conditional edges are really sort
of what makes the agent, you know, very different from the chains, right? The chains are just linked step
by step by step kind of thing. These conditional edges are deciding,
do I go, you know, this path? Or do I go this path in here. So here I've got like binary choices
in these ones, but you could have like, you know, more than two choices in here. This is certainly something you could do. All right. if it does do a rewrite, it will basically
do a, some analysis, of working out okay what needs to be changed and you'll see
that actually that will return back. JSON. you'll get, some issues
and stuff like that here. I haven't put a lot of
time into doing this. I could actually specify. I've basically specified that it should
come back as draft analysis here. but you could actually tell it,
you know, what you want the, internal parts of that to be. Whether it's, you know, Stuff related
to the company, stuff related to the customer, that kind of thing in here. And don't forget even in these things
we could actually, before this. look up the customer's user number
and then bring in other information about them and pass that to, something
like this if we want it to as well. don't forget with this, where
we're running on the Lama, 70 B. So this is a model that you could
run on prem if you want it to run, if you were doing something like that
we've then got basically the rewrite prompt for just rewriting the email. like I said, most of the time you're
going to find this actually doesn't even use this right going through here. All right. setting up the tool for
the Tivally search in here. So this is just basically
taking LangChains tool. I'm just returning one example here to
keep it nice and short, but you could certainly change this to three or to five. , and use that as well as
you've got that in here. All right. So that's all about, sort
of prompts taking care of. Now, the next thing that we want to
sort of look at is actually setting up, the LangGraph part of this. So the language part of
this is three things. We've got the nodes. We've got the edges, both of the
normal edges and the conditional edges. And we've got the state. So the state is normally the thing
you sort of set up first here. So you can see here, we're
basically setting up this state. And you can think about these as being the
variables that you pass around in here. So we've got like the initial email,
email category, draft, email, final email research info, actually info needed. I ended up not using
that, number of steps. I wanted to sort of track the number of
steps through, often find that's useful in agents to just get a sense of like, if it
got into a loop, you know, if I expect it to be eight steps in my agent and suddenly
I saw like 26 or something, I know that something is going wrong in there. And then we've got some feedback, you
know, if we do the feedback in there. All right. so that our state that's what's
gonna get passed around everywhere. So this is just sort of
setting up the class. Later on we'll instantiate this
and you'll see that we pass this in to all the nodes as we go through. so let's look at the nodes. We're going to have a
categorized email node. we're going to research info node, we're
going to have a draft, email writer node. In fact, we're going to have nodes For almost all of the chains
that we created before. Now there are a couple of chains that
we're going to use this conditional edges. And there are a couple of nodes to that. I'll talk about that. You know, the actually
not using, a prompt. So I'll talk about those
as we go through them. So you'll see that, like this categorize
email is kind of, you know, an, a good example you take in the state. You then extract out what you
want to use from that state. So at the first off, we're just
using the initial email, right. That gets passed into the
agent at the start here. Now I've put a lot of print
statements around here, so you can sort of go through and sort of see. You know, I think at the start. It often can be confusing if you
sort of see like, okay, this is being fired when that kind of thing. Is helpful. I've got my number of steps,
just being triggered in there. I've then basically got where
I'm firing off the chain. Right? So I've got my initial email. I'm passing that into the
chain for the email category generator that we saw above. and then in this case, I'm basically
printing that out and I'm also writing that to a file so that we can check it
later, but obviously the printing and the writing and stuff like that is not needed. It could make each of these
things smaller in that way. Alright, next up we've
got the, search stuff. so this is basically just bringing in,
the email, the email category, et cetera, sending those off to get keywords. using, you know, those keywords. And then for each of those keywords, we're
going to run a search and we're just going to combine all of these into documents. So if you wanted to swap
out, Sort of a rag system. This is where you could basically, you. Swap out and put your rag system in here. to get things back as well. But you can see that each
time we've basically done this query and stuff like that. it's gone through, and then we
basically just put them all back into this sort of full searches. And we save that into the state, but
as the research info, so every time you return something like this, it's
actually going into the state dict. that we had before and that we set
up before, so that when another node, gets called, like this next, you
know, The email draft writer here. it gets passed in the state there and
can see it again, like I'm popping off the number of steps and adding
to it so that we're sort of keeping a tally as we go through, but it's also,
then now gotten the initial email, the email category and this research,
and we can pass all of that into. Our chain. and we could do a lot more fancy stuff
with this as well, if we wanted to, you know, before we pass it into the chain. But, he would basically just
go into, I'm just taking it. I'm passing them into the chain. we get the draft email back, right. Or this email draft back. I write it to a file, but I
also then pass it onto the dict. Right. So that on the state, the
state dict is now going to basically have the draft email. As well as the other things that we've
put in there as well, right next up, we've got, you know, the analyzing the draft. This is going to be doing the same and
pulls out what it needs, calls the chain. it brings things back in this case,
writing to a file, but then more importantly, returning it and writing
it to the state dict, in here. So you've got a bunch of
them that are like that, The two ones that are different
is that if we don't do a rewrite. we've only got the state. dict basically saved the draft email. We don't have a final email. So this one is literally just to
basically take the draft email and then save it out to the final email, so
that we can get, get it off that way. And I'm just putting in it. that it's another step. It's not really, I guess, a
step of an LLM call in there. And then the other one
that I've put in here. Again, more for just debugging. Is this idea of a state printer. So that when you're sort of building
these things, you kind of want to know as you're going along. Okay. Am I. I'm actually putting the right
things into the right places on the state dictionary or not. Right. so I can sort of put this at various
places and then, see the outputs. It will print out the outputs in here. So you'll see, I'll show you some
examples of this and I'll talk about sort of like, as I'm building it,
I'm kind of using this quite a bit. as like the end point to just sort
of see like, okay, did the last step do what I thought it's going to do? Okay. That's working now. Let's move on to the
next node kind of thing. All right. The conditional edges
aware you've got this. Idea of it's now going to it's finished
in this case with the email category. and it's now going to basically
do a decision, whether it routes it to, the research. Or just straight to the draft,
that email kind of thing. So the way to do this is we're passing
these two things into that chain. Which is the research router. And it will return back, adjacent
objects, which we can look at the, the routed decision in there. And that relative decision is
either going to be research info or draft email in here. Now, if you were using, If you were using a model, that's
not as good as this model, then you probably want to do some more checking
and just make sure that you're only getting these two responses back. And if you get an error,
perhaps recall the chain, right. for this but in this case, we're either
going to get back research info. We're going to get back draft each
email, and then you'll see that that's going to then determine what
we go to next, the same with this. conditional edge for routing. whether we do a rewrite or
don't do a rewrite in a year. so you can see that. To get it, to do a rewrite. I've actually put in like a sort of fake
draft email, that sort of is so bad that it causes it to do a rewrite, in here. Otherwise most of the time, it's
going to be quite happy with the actual, email that you know, that
it wrote at the start in there. All right. So, those are our nodes
and our conditional edges. Now we need to start
assembling all of this. So to assemble this, you basically
instantiate the state graph. Right. So that's gonna, you know, th that's gonna
hold everything and most importantly, it's holding your variables in, in there, but
we're also gonna add all the nodes to it. And we're going to add
the edges to it as well. So you can see here once we've
instantiated this, we add each node and we've basically got the name of the node. And then the function that it
actually, you know, points to. so we've defined all those above. We've got the names of each of these,
and then just defining, you know, where they actually point to up here. All right. And then for edges. edges, we generally. let me look at just the sort
of standard edge first is where this is like a hard wired edge,
meaning that analyze draft email. After that always has
to go to rewrite email, You know, it can't go somewhere else. This is what we talk about. Sort of controlling the flow. All right. The flow engineering here
of engineering that, okay. It's only going to go from here to here. Right now. So that's like a standard edge. Now there's the, there's an entry
edge where you just put the first node that you're going to start off at. And then the ones that are actually more
complicated are these conditional edges. So the conditional
edges, you can see here. We're taking the, you
know, we're going to go. You know, we start at categorize
email, but then we're going to go from categorize email. To a conditional edge. And what that is, is just telling us
that, okay, this categorized email is going to go to this conditional
edge, which is the function. Is that the route to research or not? Right. So it's making a decision. And if the decision comes
back, research info. It will then go to the
research info search at. node, right? Which is the, this here. And we can see them that one is
hardwired to draft email writer there. If it doesn't come back research
info, if it comes back, draft email, then it will just automatically
just go to draft email writer, and then this edge is not even used. So this is a conditional
edge that you need to set up. So you basically take the
node that it was coming from. And you've got the conditional
edge, which will make the decision, which node it goes to next in here. So I've got two conditional
edges, one for deciding about the research and one for deciding
about doing the rewriting in here. so that's the one that
we've got going on here. Now you'll see that, I basically come
out of this sort of, we end up with either the writing, the analyze the
draft email and do a rewrite, and then from rewrite to the state printer, or
we go out with no rewrites and from no rewrite, we go to the state printer. So they both converge back in on the
sort of state printer, which is just there, for us to be able to see, you
know, what the actual variables were, When you're building this, you might
first just start off with like two nodes. And so you want to define that like,
It goes from node one to node two. And then from node two, to the end,
or this is why I put the state printer in there, just so that you can then
easily see, did everything get set the way you, you know, you thought it was
going to get set so that you can sort of look at that as it's coming out there. finally, you want to come
to an end node, in here. So here, no matter what we end up going
to the state printer, and then the state printer is hardwired to go to the
end node, which basically just stops everything that we've got in there. All right. once we've got this workflow sort of set
up, which is basically set up our entire sort of graph now, we can just compile
that, as an app and now we can use it. So here you can see,
I'm passing in an email. If I say, okay, my inputs are
going to be the initial email. and then I'm just going to pass
in the number of steps equals zero and research info equals none. So, you know, you want to,
anything that you need to set at the start, you basically set
here and you then invoke this. Now here is doing a stream version of it,
but let me, if I come down here, you can see this is doing it just the invoke way. Now, if we just invoke it
and we look at the outputs. we're going to get, you know, output
back and we want to see the final email, we can see, there you go. It's that's our final email that
we're going to get out in here. If we actually print this as we're
going through it, look what's happening. All right, let's come in here. And so I'm just going to take this email. let's start off. And run it. And you'll see it starting
off and first off it's doing the categorization of email. It's then basically doing the
decision that it needs to do. Making the decision that
needs to do some research. We can then see that it
does the research in here. And then we can see that. Okay. It's basically drafted a reply back. and here it's then decided that
it doesn't need to do a rewrite. and so it goes through,
it finishes that off. and then finally it basically just
allocates in this no rewrite part, just allocates that to the final email. and we go to the state printer where
in the state printer, we actually just see everything printed out. So we've got our initial email there. we've got the email category
this was a customer complaint. we've got the draft email there,
and then we've got the final email. Now in this case, both of them
the same, because there was no rewriting done in there. And if we look in here, we can
see, all the data that came from the search that we got before. in this case, we can see that,
okay, number of steps was 4, here. All right. If we come up here and just make it. So we were going to overwrite the
draft email they get sent in there. And we remake the graph. This time, we should see it
actually go through the rewriting, as well, because that email is,
you know, is not good enough. We can see, okay. That this is, you know, we can
see it's done the categorization. We can see it's done the draft here. we can see that. Okay. So the draft email here was actually
the good one that it wrote, but we kind of overwrote that whereas we
pass that into the rewriting one. So let's see. did it do a re rewrite? Yes, we can see up here that, okay, it's
done it's decided to rewrite that email. because it didn't like it. remember that that's,
I've overwritten this one. It's not this one that's being rewritten. It's the one that I've just
commented there that got rewritten. You see, then it basically went
through the draft email analyzer. It used that to rewrite the email. If we come down and look at the final
email out you'll see that it actually they often end up being kind of similar. So here the, the, the good draft
email that right was hi, George, thank you for reaching out to us
about the weather at the resort. I'm sorry to hear it. Didn't meet your expectations here. The final one is hi, George. I'm sorry to hear that the
weather at the resort didn't meet your expectations right. so it is kind of funny that
like they end up being, you know, sort of the same things. So it does show that like the
actual draft emails that it's writing a you know, pretty good. so most of the time, it's not going
to need the rewriting part in here. And obviously the only reason we've got
it is cause I uncommented, this line. All right. So where do you go from here? You can see that basically we had
these, you know, initial email category we've gone through, we've
had each of these are being nodes. And these diamonds are
being the conditional edges. that we've got in there. so You could come through and customize
this whole thing and build something, you know, totally different with this. And try out, you know, a bunch of the
things, as long as you remember you know, first write your sort of prompts
or your chains in there working out. In fact, actually first, you should
probably write your flow, right? Diagram out exactly what
you want to do here. Now we could have had
loops going back in here. You know, that's something
that we certainly can do. Uh, with, with this, just be careful
though, that if you've got a loop, you want to make sure that you're not
going to get stuck in that loop and it just goes round and round and round,
especially if you're paying for those API calls or something you don't want
to be in that scenario but the key thing here is you can take it and customize
it to do a whole bunch of things And So like I said before, if you've got
any comments or questions, please put them in the comments below. If you found the video useful, please
click like and subscribe and I will talk to you in the next video. Bye for now.