Agents
Terminal Haxxor
Run any Drupal AI agent from the terminal with Drush, explain a pending config export and find the right Drush command.
Marcus Johansson
June 27, 2025 · 1 min read
I created a small module for the people who really don't like GUIs, I'm one of them myself. Terminal is just easier.
This module will let you run any agent, but also help with some other Drush stuff via terminal.
Add some stuff you want to see into the issue queue, and if you want to help maintain it, let me know.
The module is available here: https://www.drupal.org/project/ai_drush_agents
YouTube's automatic captions, lightly corrected. Click a line to jump to that moment in the video.
0:01
This video is sponsored by FreelyGive. If you need help with AI stuff, then just get in contact with us.
0:10
Uh today's video will be very short. I created a new module. Uh there should be if I update the alpha release of it. Um, so UIs and everything is super nice, but as a developer it kind of sucks because sometimes you just want to run stuff.
0:35
Uh, and that's how this started. So there is now if you install this module and you have Drush installed, you can run uh ddev drush agent. So that's short for agents run.
0:49
And basically shoot whatever agent you have. So I'm going to take the field agent and then I'm just going to ask can you add a text field called make a text on the node type art
1:04
particle and it will then go ahead and actually do this. It just runs the agent gives you back a response um that has been added uh and that's it. You can do Ctrl C to uh quit at any time. uh you can
1:26
also I have to remember it but if you remember the names it's a parameter so you can run like this uh directly and of course you can do um can ask something like this what can you do and this is now uh using chat history
1:43
as you know the or as you might know the agents are looped which means that when you reach the loop maximum it's not going to work anymore with chat history because that's basically what it says The loop is the history. Uh so you can
1:58
see it the answers and I can ask uh what did I just ask and you will see that it has uh actual chat history. So that's how you can use the agents in this case.
2:15
Um another thing um that you can do then is the config export explain. So let's just do this first. Oh, I'm running DD by the way. That's why I have to you know put DD in front of
2:34
everything. So you see it created a field now, right? So say that I uh run away from my computer now for a week or something and I come back and I see oh something changed and I don't remember anything.
2:49
What did I do? Then you can run ddev agents config export explain or it's what is it hcx and it will actually explain in pure text what it's going to do if you do a config export. So this happens to me
3:05
from time to time that I don't uh uh remember what to do actually or what what I did and then there is tr explained. So uh what we can do for instance then is uh we could ask
3:23
what does so you can ask about commands but it's actually quite more complex. This is not using chat history. Uh so let's ask something more uh a little bit harder. I
3:38
want to remove all the articles on my website and it should give back now entity delete then with yeah as you see drush entity delete node bundle article. So it
3:53
just fills it out for you. And this is this is not based then on the uh OpenAI or Anthropic's internal knowledge where it might make up stuff. This is based on it having tools where you can see every Drush command that is on your website.
4:12
That's why it could ask answer about this because this is completely new. There's no way this is in the training data. uh and it has a tool also that can actually go into the uh um PHP file of
4:25
that specific command if it can't figure out what you're asking uh just based on descriptions and name alone. So this is a perfect example where a agent makes sense.
4:38
Uh yeah and that that's the only thing I wanted to show. So, AIRS agents available under ai_drush_agents.
4:49
Uh, I will try to add a lot of stuff. If you're interested in uh being a maintainer, just get in contact with me. Uh, if you have ideas what this could actually answer, uh, get in contact with me. It's not supposed to, you know, replace Cursor or Claude Code or something like that.
5:10
I'm not going to make I don't at least I don't have that time to make something so complex but uh you know basic commands should be easy. It took me 1 hour to write this module. So uh you know whatever you can come up with that
5:27
makes sense just add into the issue queue and we start adding it here. Uh as usual thanks for watching.