---
title: "Content Create Agent"
video_id: WnZ6GgmYI4c
url: https://www.youtube.com/watch?v=WnZ6GgmYI4c
workflow_page: https://workflows-of-ai.com/workflow/content-create-agent
language: en
captions: generated
---

0:00 This video is sponsored by freely give.
0:03 Uh if you need help with group or any
0:05 please get in contact with us. Uh I'm
0:08 going to showcase a very simple agent
0:13 but uh I'm going to showcase some of the
0:17 most maybe important tools that you can
0:20 be using in Drupal to actually create
0:22 content. So what we're going to do is
0:24 create a agent that can create one
0:27 specific content type
0:30 um and also has access to actually
0:32 reading PDFs. So we're going to have
0:34 like a PDF like this title some
0:37 information and we're just going to run
0:40 an agent where we say could you look at
0:42 the restaurant Tim on the PDF of the
0:44 file this and we just show you here
0:47 there's many uh restaurant then but it's
0:50 going to be able to you know select it
0:52 run it and actually create a version of
0:56 the content for this.
0:59 So, if we go to the content and reload,
1:02 we're going to see there is a Tim Raw
1:04 here that has set up the correct phone
1:07 address, uh, pricing, description, and
1:11 so on. So, let's go.
1:14 Hey everyone, it's been a while. Um,
1:17 I've been busy with one or two
1:19 preparations, but now I should hopefully
1:21 be able to start creating videos all the
1:23 time. Um today we will show
1:27 uh a simple agent that can take a PDF
1:31 and generate content from it. Um
1:34 it will be based on uh on modules that
1:39 doesn't require infrastructure. So we're
1:41 going to use something called AI simple
1:42 PDF to text. Um this has two things. Uh
1:47 so it can create automated rules. Um I'm
1:50 going to showcase this in a second uh in
1:52 some video later where you you know can
1:55 create a chatbot talk to your PDF
1:57 content. Uh but it also then has a
2:00 function call uh that you can use. I'm
2:04 also going to show uh the tool API. So
2:07 this is the first time I show the tool
2:09 API. I will say that the tool API is the
2:13 way uh to solve things going forward for
2:17 functioning calling as well. If you want
2:19 to create a function call, you should
2:21 always consider using tool API instead
2:24 for the simple reason that it creates a
2:26 function call. But whatever you do will
2:29 also in the future be available in ECA.
2:31 You see Eurogen is one of the
2:33 maintainers there. Uh
2:36 uh view bulk operations
2:39 and it's it's it's a more structured way
2:42 of uh doing tools. also solves uh the
2:46 problem with security of creating
2:50 generic tools. So my recommendations
2:52 going
2:54 uh so far has been basically create a
2:57 function call that solves your issue
3:00 because that will make the agent more
3:02 reliable
3:04 uh and it will be more secure. But of
3:06 course you might end up with uh hundreds
3:09 of function calls then and a lot of
3:11 function calls that are basically just
3:14 iterations of other function calls. So
3:16 the idea is here to create more generic
3:19 tools that you can reuse over and over
3:22 and that's not saying you can use tool
3:23 API to solve your specific uh uh u
3:28 problem anyway.
3:31 uh of course so the it's a plug-in
3:33 system if you know how to write function
3:35 calls you will know how to write tool
3:37 API it's not that different uh I also
3:40 want to just give a huge shout out so
3:43 Michael is the main maintainer he has
3:45 done like 99% of the work on tool API uh
3:50 or even 100% maybe uh and he's actually
3:55 uh looking for a position right now uh
3:58 if you want someone someone who knows
4:00 Drupal and AI that combination and is
4:03 has a much stronger Drupal knowledge
4:05 than me. I would recommend him uh highly
4:09 recommended.
4:11 So
4:13 I will just show the modules I have
4:15 installed. So what I have installed
4:16 already is the agent framework AI
4:18 module. I've set up OpenAI in this case
4:21 but use any provider you want. uh uh uh
4:25 uh I mean if you if you use smaller
4:27 models you might not get the same result
4:29 of course. Uh then I have installed the
4:32 tool uh tool AI connector and for the
4:35 1.0 uh 1.x X branch in AI you're going
4:39 to have to use AI connector for two it
4:41 might just work without it let's see
4:44 that's a decision still to be taken you
4:46 can look in the issue if you have uh
4:48 opinions about this and tool content and
4:50 tool entity and then I have also
4:53 installed the AI simple PDF to text all
4:56 these modules you just have to install
4:58 and that's it they're going to be
5:00 available I have created a content type
5:03 that has address description phone price
5:05 website and a title and it's called
5:08 restaurant and I'm going to showcase
5:09 this is the PDF then that I have and the
5:12 idea is that I can tell it hey look at
5:14 this PDF
5:17 uh and import burgermeister for instance
5:21 create a content around burgermeister
5:23 but not the other ones
5:25 uh oh I oh wait I added that we need to
5:30 install media module as well so it is a
5:33 little bit clunky now we're trying to
5:35 solve how you can actually upload non-im
5:37 images into an agent and assistant. Uh
5:41 for now, the tool takes a URL URI or a
5:46 file ID.
5:48 Uh so we're going to use file ID in this
5:50 case. So we're just going to add a
5:53 document here.
5:55 Uh
5:57 which we have here.
6:00 So we're just saving this restaurant. Uh
6:03 uh so we know
6:05 can look in the files and this has a
6:08 file ID here that is 25. We can just use
6:13 this when we're uh talking. So we go to
6:17 configuration AI AI agent. That's where
6:19 you can add a agent. And we're just
6:21 going to uh create then the uh rest
6:26 creator agent.
6:29 Um
6:31 this agent can create notes on type
6:36 restaurant.
6:39 Um
6:40 we set like 10 loops. Now we can say 20
6:43 loops. Maybe you want want to import
6:45 like I don't know you want to import 20
6:50 restaurant setup in one go. Then you
6:53 might need a lot of loops actually.
6:56 uh agent instruction. We're going to
6:59 improve this as we go along. Uh but we
7:02 just start with you are agent
7:07 that is expert
7:10 on creating
7:16 creating content on the node type
7:20 restaurant in football.
7:24 Um
7:26 let's just start there.
7:30 Uh um
7:32 and
7:34 going to add more things as we go along.
7:38 Uh the next thing we need to do is add
7:41 tools
7:43 and these then the tool API comes with a
7:46 lot of tools. Uh what we need to add
7:50 here are
7:52 um
7:54 we need to add
7:59 see here uh
8:04 we need to add save entity.
8:07 We need to say set get fields values
8:13 uh and we need to create the entity as
8:18 well.
8:20 Where is it?
8:24 Create
8:26 create unsaved entity. Right? This is
8:29 what we want to do. So how this works is
8:31 it's creating an unsaved entity.
8:34 Uh
8:35 so that just becomes a placeholder. So
8:38 that you can think of that similar to
8:39 how you open the no creation form. Uh
8:43 oh, get field values is important if we
8:46 want to update this actually set field
8:48 values. So get field values would be
8:50 important if we want to create so the
8:52 agent also can update one of the nodes
8:55 then if we want to uh maybe we can add
8:57 that right away just to showcase that as
8:59 well. Uh so what's happening is going to
9:01 do the create unsaved entity. Then it's
9:04 going to start adding field values
9:05 similar to how you add the field values
9:07 on the form. But it's not until you
9:10 actually save the entity it actually
9:12 saves it. Right?
9:14 Uh and the important thing here is of
9:18 course it needs to be able to see how to
9:21 create this.
9:22 So what is the actual structure for
9:24 this? And this is uh uh what we need
9:27 here is get field information. we can
9:29 just test the tool. So if you have the
9:31 API explorer uh enabled, you can just
9:34 test it. So we can just test node
9:36 restaurant just to see this is what the
9:40 uh uh agent is going to see. But what we
9:43 can do in this case is that we don't
9:45 necessarily actually need uh to
9:50 uh uh we don't necessarily need to uh
9:56 you know run this in a loop because we
9:58 know we always need to get the field
10:00 information about the how to save our
10:03 restaurant because the only thing this
10:05 is going to be concerned with is
10:06 actually creating restaurants and
10:09 because of this we're going to use then
10:10 the default information to us. Um, and
10:16 this is something where I mean the whole
10:18 thing here we're we're working on
10:20 improving how it's working. There's a UX
10:23 group uh uh for this. If you're
10:26 interested in joining those
10:27 conversations if you know like um how
10:30 this can be worked then just you know
10:33 there is AIUX channel in Slack or you
10:36 know contact us. We need all the help we
10:38 can get how to make those stuff better.
10:41 So, we're going to say get restaurant
10:44 information.
10:46 Uh, this is just a unique key. Doesn't
10:49 matter. The AI is not aware of it. What
10:51 it is aware of is this
10:55 um field information
10:59 restaurant.
11:01 Uh, and a description. This is the
11:04 information about
11:07 how you create the fields for the rest
11:13 of node types and the tool AI we can get
11:18 tool ID we can get here then so it's
11:21 this you see it's URL encoded colon
11:25 there but is this and the parameters you
11:28 can also get here that's this so we just
11:32 set this to node
11:35 uh and
11:38 bundle should be
11:40 restaurant
11:42 and then this whole thing is going to be
11:46 uh saved into memory. So the agent is
11:49 always aware of that it's always part of
11:51 the memo. So we don't need to tell it to
11:54 use this. The other things are of course
11:57 dynamic because if a if you
12:01 uh tell it to um tell it to
12:07 I I don't know create uh create an
12:11 article
12:12 shouldn't really use all of this. It
12:14 should just tell you that that won't
12:16 work. Oh, I realized we also need to be
12:19 able to load
12:21 uh uh load entity by ID
12:26 because if we're going to be able to
12:27 edit, we also need to load a entity that
12:30 exists. So the important things now
12:34 before this is built into tool API is
12:36 that we need to constrain this.
12:39 So it's very important that you say say
12:42 that the entity that can be saved should
12:45 have a forced value of node. You should
12:49 just be able to so save nodes with this.
12:52 Uh
12:54 it would be very very bad especially
12:57 load and save if it could load a key
13:00 instance for instance your API keys or
13:02 something and save those right. So we
13:04 need to constrain the same thing here.
13:08 Uh and here we can go e uh
13:12 no we just set the entity type ID entity
13:15 ID it should be choose itself of course.
13:18 So what you're saying here is basically
13:20 some of these things we don't really
13:23 want
13:24 um the AI to take a decision about. Uh
13:30 it should just uh uh always be node in
13:34 this case.
13:36 uh
13:38 and in this case we're also going to set
13:42 node.
13:44 So set the field value
13:48 and you should just be able to create uh
13:55 uh oh sorry this should be restaurant of
13:58 course. So you should just be able to
14:00 create a restaurant. Save this. This is
14:03 not going to work, I think, yet because
14:05 we didn't give it any instructions.
14:09 Uh, and we Oh, I forgot the tool. Of
14:12 course, if we're going to read a PDF,
14:15 well, we can try this first
14:18 just to see if it's anywhere close to
14:20 actually being able to create something.
14:23 Uh, could you create a new restaurant
14:30 title? Hello. and the description
14:35 cool
14:37 because no uh nothing except title was
14:40 required I think. So this should in
14:42 theory maybe actually work.
14:45 So it creates tool entity stuff then is
14:47 that it actually creates a version. It
14:49 sets a value. Oh so okay save tells it
14:53 it saved it and if we go to content it
14:55 actually probably just worked. Yeah we
14:58 created a hello restaurant with a
15:01 description. Cool.
15:03 That was actually
15:06 worked better than I thought. Um, so
15:10 anyway,
15:12 let's let's see how much we actually
15:14 need to shape it. So, what we're going
15:15 to do here is we're going to add uh then
15:18 the simple PDF reader. So, simple PDF to
15:22 text.
15:25 Okay, just try it just for fun to see if
15:28 we might not actually need to write such
15:30 a big system pump. So now I have of
15:34 course forgotten the uh uh 25 it is.
15:38 Could you look at the rest
15:43 burger meister in the PDF of file ID 25
15:50 and generate it? Let's see. I think the
15:54 address field the address field might be
15:56 so complex that it actually needs some
15:58 help there but it will still be
16:00 interesting to see just to try it out
16:02 without actually writing something.
16:05 So, it seems to actually
16:09 incredibly enough
16:12 uh
16:14 work. Well, it's seems like it's failing
16:18 when it's trying to save
16:21 the
16:23 website.
16:25 I wonder why it doesn't allow it to
16:27 save. So, you see it's trying to resave
16:30 and resave until it can set it
16:32 correctly. So, here it worked.
16:35 So, it actually probably need uh some
16:38 system prompt to how to save the URL URI
16:41 at least if we're going to make it uh
16:44 work better. But let's just start with
16:46 checking here if this actually work. No,
16:49 this didn't work.
16:53 Uh
16:56 okay, it can't solve the link.
17:01 Requires that the link title not be
17:03 null.
17:04 Okay, I'm just going to see how we set
17:06 this up first. I actually thought I said
17:09 that the link title is not needed on
17:12 this case.
17:15 Uh, it's disabled, so it should not be
17:18 needed.
17:20 Uh, let's see here. UI
17:26 can see it's actually trying everything
17:28 here to try to figure out how to fill it
17:30 in. But this might be uh I mean this
17:35 might be a problem in the
17:39 actual tool
17:42 rather than the agent being wrong
17:44 because what but I can see it's actually
17:46 doing
17:48 everything correct. I know it you
17:50 shouldn't be able to save a title so
17:52 that shouldn't work but this should
17:54 work.
17:56 Um
17:58 just to see so everything else works
18:00 first.
18:01 uh do not include the link.
18:08 So, uh while we're doing this, I'm just
18:12 going to showcase uh a module here
18:16 that's super important when you're doing
18:18 this because
18:20 uh you know, I talked a lot about the
18:22 automators and the automators kind of
18:24 just works when you have a feeling that
18:26 it works.
18:27 uh when you feel like I mean if you run
18:29 it like 50 times it just works it kind
18:33 of works and you know there might be
18:35 edge cases that you run into when you go
18:37 into production that you have to fix but
18:40 mostly it works this is not true for
18:42 agents and this is something we saw when
18:44 we created the Drupal CMS agents that
18:48 it's very hard to test them because
18:52 you can be as expressive as you want
18:54 it's a free text field where you write
18:57 anything to them.
18:59 So you you have to try to think of all
19:02 the use cases people will use them for,
19:04 but you will not be able to think of all
19:06 of them. So you're going to have to
19:07 improve them. So we have this module AI
19:10 agents test and you should install it.
19:13 Basically what you can do there is you
19:15 can uh run tests against your agents
19:19 over and over and over and over to see
19:22 that they are doing the right decision
19:25 based on instructions memory. So you
19:29 might have a long chat history and so
19:31 on. Um because of this I I would just
19:35 recommend using it. That's the only way
19:36 you can get something that's you know
19:38 getting close that is like production
19:41 ready that solves most of the things. Of
19:44 course you can talk about a restaurant
19:46 creator agent for your use case. You
19:49 could maybe even you know do this do not
19:51 include link. Uh so
19:55 let's see if this worked better. Okay,
19:58 so now it worked because it didn't have
20:00 to create the website then. Uh,
20:05 and it did fill in. Okay, we have first
20:07 name, last name there, but it was smart
20:10 enough to actually figure out that it
20:12 shouldn't uh fill that in. Janalia 45
20:18 10435 Berlin one star.
20:23 Uh
20:26 this description they copied
20:29 phone worked. So it's working now
20:32 actually except for the link and this
20:35 might uh might be something that we have
20:38 to create an issue for actually to be
20:41 honest. Um
20:43 let's see. Um yeah, I will end this uh
20:50 video cast here because I think I have
20:52 shown the most important things. I will
20:55 just do a heads up here because this is
20:58 the first time I showcase
21:02 how you can create I mean with
21:04 automators of course you can create
21:06 content and you can extrapolate stuff
21:10 uh so you know start from a small title
21:13 and write a long description or
21:15 something for that AI just creates lot
21:17 from this this is super important
21:20 uh and I know you know there's there's
21:24 just going to be people that's using it
21:26 for this and that will you know it's a
21:30 race to the bottom because all the tools
21:32 that has AI will do this but I would
21:35 just urge you use this to interpolate
21:40 take a lot of big content and summarize
21:43 this this is something AI is actually
21:45 good at it creates good content from
21:48 this anytime you try to extrapolate when
21:51 where the AI is the one that actually
21:53 write the content
21:54 It's crap. It's crap. Don't use this.
21:57 This becomes AI slop. This is the dead
21:59 internet where, you know, we're just
22:02 flooding the internet with too much
22:04 information
22:06 that no one will read. It will just be
22:08 AIS that reads this in the future.
22:10 That's just a waste of resources. So,
22:13 please don't do it for the this. There
22:15 are hundreds of use cases where this is
22:18 useful
22:20 but you know creating another sloppy
22:23 website where you didn't write anything
22:25 is not one of them. So please don't use
22:27 it for this. Um
22:30 yeah, thank you for watching.
