Ever added AI to a Drupal site and wondered which model actually ran, how slow it was, how many tokens it used and what that cost? And when an AI agent calls sub-agents, what really happened inside?
This video shows a complete, self-hosted AI observability stack for Drupal that answers all of it - built and running in one command.
Using the One Line Installer, we spin up a Drupal site wired to Grafana, Tempo, Mimir, Loki and Alloy, then watch every AI call show up live: request rate and latency, token usage, real cost priced from models.dev, and a full parent to sub-agent trace where you can read the actual prompts and responses flowing between agents.
Everything is open source, provider-agnostic (OpenAI, Anthropic, Gemini, Mistral, Fireworks and more) and self-hosted - your prompts and data never leave the box.
What's covered:
One command to build Drupal plus a full observability stack and demo AI agents. How the pieces fit together: the AI Observability module sends data over OpenTelemetry to Alloy, which routes traces to Tempo, metrics to Mimir and logs to Loki, all visualized in Grafana. The requests overview with rate, errors and latency. The token and cost dashboard with live pricing from models.dev. And the AI Agent Sessions view, with a nested agent to sub-agent tree and the prompt-and-response message flow between them.
Links:
AI Observability OpenTelemetry recipe: https://www.drupal.org/project/ai_observability_opentel_recipe
One Line Installer: https://www.drupal.org/project/one_line_installer
Drupal AI module: https://www.drupal.org/project/ai
Model pricing data: https://models.dev
0:00
This video is sponsored by FreelyGive. If you need help with Drupal and AI, just get in contact with us.
0:07
There's a lot of smart people and I This is not just something I say when I say there are smarter people around Drupal and AI. We truly have that within the company. So, if you need help with that,
0:17
please get in contact with us. So, uh today I'm going to talk It's going to be fairly short. I'm just going to talk about AI observability OpenTelemetry recipe.
0:31
So, you might have seen in Drupal uh uh in the AI module that there is AI observability module. You might have enabled it. You can see if you have like a standard Drupal, it just adds it to
0:44
your normal logging. And this is on purpose. It's using standardized PSR logging.
0:51
What makes this powerful is that you can actually use enterprise solutions for this. So, in this case, it's going to use a a recipe to actually con- uh contact a larger
1:05
stack uh of things. Uh and that then includes um It includes uh Mimir, Loki, uh Grafana, Alloy open and using like OpenTelemetry standard. So, one thing that happens
1:23
with AI observability and the OpenTelemetry module is that you can actually get uh auto spans that follows a standard that has been set up for AI. So, there is also a standard how you log AI.
1:37
Uh and to kind of understand how it works, it's like every time Drupal makes a AI call, the the AI observability module then is going to capture it and send it to OpenTelemetry as long as you have
1:50
that module, which lands in Alloy. And Alloy then is a collector. It's It's like this It's also like a um uh It enriches data uh and then can like split it three ways.
2:05
So, it creates traces uh which is like the step-by-step story of one request and this goes to Tempo.
2:15
It creates metrics, so like numbers over time aggregation, request rates uh stuff like this and goes to Mimir uh and the actual log logs then goes to Loki.
2:27
And what's sitting on top of all this is Grafana. So, that's basically where you can visualize this and this is what I'm going to showcase then.
2:38
Uh I just want to say also a huge thanks to Merge Alexey. He has been the main driver with this. He's the main uh maintainer of uh of the um OpenTelemetry app module, sorry, as well. Uh so, he has
3:00
been extremely good with uh everything around the AI observability. Uh he has also created an Adative plugin, so this uh can run then against the Adative plugin if you want to see it end-to-end
3:14
that I have built on top of his work. Uh but what I will also show is the one-line installer and this will actually show how you can go from uh having nothing on your computer, I
3:28
mean literally nothing, a new Windows, a new Mac uh new MacBook or a new Linux system and get a site up and running with this pretty complex architecture.
3:41
You might have heard about the one-line installer from Jamie. I will talk more about it when it gets more stable, but it is pretty powerful already.
3:51
So, let's get started. So, now I'm going to show you the power. Let me just close these tabs.
4:00
You see, there's nothing I can copy here. Literally, run the one-line installer and point it at the repo of this recipe.
4:12
And I will showcase how this works then. So, I will just go to where my projects are and I will run this.
4:24
And this now is going to download um uh clone this repo and look for so-called Drupal AI best practices configs.
4:34
And see, in this case, it has two. It has a base demo, and this sets up just the base. You will have to set up a provider yourself. You will have to set up modules on how to uh utilize stuff
4:47
and so on. Uh so, it's not the best thing for what I want to demo here. So, we have a demo version. What this does, it sets up like AI API Explorer. It sets up AI agents
5:00
with a parent and a sub agent, so we can visualize this. It also sets up a um uh a prompt where it starts asking you about API keys for different providers that you might need. So, we choose this.
5:13
And you see, it asks us right away uh OpenAI key. So, what it's going to do, it's going to ask for uh different keys, and it will set up all these providers. But, I'm just going
5:24
to set up OpenAI key. So, you don't see it here. You can see it's input hidden, but I have copy and paste something. And on the other questions, I'm just going to click
5:32
enter. And then we're going to have uh enter a name for the new project, and we're just going to write uh obs testing, so observability testing.
5:43
And everything else the system takes care of now. It's going to set it up from start to finish. I can While it's working, I can just show you how these um configurations looks.
5:58
So, this recipe, of course, you can utilize this as a any recipe you have used before that you just, you know, do uh um composer require and then apply the recipe, but you see also it has a dot
6:14
Drupal AIBP um uh uh directory, and this is where you find these then, base and demo. And this is basically the whole configuration that sets up everything from start to
6:28
finish. So, I will answer the sudo question here, and then I'm going to fast forward.
7:15
And there you can see we have our site, and this is will not look like anything special. It's just a Drupal standard installation.
7:24
Uh I will log in here. I will showcase a little bit how it has uh it's using admin admin, so it complains.
7:36
So, you can see, for instance, here then if we go to keys, that it has set up uh Remove this annoying thing. It has set up a environment key that is OpenAI API
7:51
key, so it has set it up correctly. It's in the environment of your DDEV. uh In this case, it should have set up AI API explorer as well.
8:02
So, we can start chatting here. Hello. Which model are you? Can just ask something like that, right?
8:15
um So, it's answering right, but if we go back to terminal now, you will see there's some information here as well.
8:23
First of all, it has jumped into OBS testing. It has installed Claude Code for me, but in a container. So, if you actually want to uh uh start developing, you can actually do
8:36
this. Uh I have chosen Claude Code. You can choose other uh uh things as well here. There's a lot of information, but you can see there's extra information here as well. Grafana
8:47
is here. So, we can click here. And we get Grafana up and running. And here I have created some dashboard then, and that's what we're going to show. So, DDEV Grafana
9:00
we have agent sessions, latency explorer, uh AI requests, and tokens and costs. So, all right, we did a We sent something, so if we click here, well, oh, it might not actually have synced.
9:16
It might need to run uh uh Drush. So, what this does is it actually fetches from models.dev uh the prices for each model, so you can actually see them here.
9:28
Uh and if we go to AI request, you can see we have done one request, no error rate, average latency, average requests per minute, and so on. We can just click here.
9:42
And it has a refresh button. So, if you want to see it in real time, you can do that. I Let's see if we refresh here.
9:57
Oh. Oh, there we are. There is some a little bit delayed. So, you get some uh data. And these are just example data.
10:11
I was basically discussing with Fable what makes sense to showcase. And this is what I uh we we came up with.
10:20
Um You can see all the actual requests. You can also get the raw requests, of course, on top of that. And then there's agent sessions. So, here you will not see
10:32
requests because this is not a request, right? So, let me see here. I think I might have to install explorer.
10:43
Oh, yeah. I should add this actually to the recipe then. Or sorry, to the demo setup.
10:50
So, we do the agent explorer. Agents explorer, maybe. Install it. Uh you should use agents debugger. So, that's probably what we should be adding to the recipe.
11:03
And if we reload we have the orchestrator that is the parent agent to the fact agent. That's just uh something to test.
11:15
Uh Can you ask the fact agent about a made-up fact? We run that, and you're going to see here then that this is calling um This is going to call the um See.
11:40
This is going to call the sub agent. There finally we see something. Oh, it literally asked a made up fact.
11:49
Uh Okay, it just comes up with some interesting thing there. And all of a sudden you can see how the flow is here from parent to sub agent to parent. You can also see
12:02
an unique ID for this session. Uh And then you can also see here some more raw data, the actual queries going in and out.
12:14
And see how they sequentially are loaded. So, these are just some examples on how you can set up Grafana. Of course, if you're going to do this, you should set it up with exactly the
12:25
measurements you want. Um This is just an example. Um so, that is showcasing how you can use the AI observability with some external capture using standard dice
12:43
OpenTelemetry uh uh um structures and also how the one-line installer works. Thank you.