Scheduled AI in practice: turning telemetry into a daily health report
How I integrate existing tools within the AI context to turn Application Insights telemetry into an actionable daily health report on a schedule. The report highlights what needs attention and starts a conversation I can continue, while I stay responsible for the next steps.
AI tools are gaining features quickly, including the ability to automate recurring tasks on a set schedule. While this sounded useful at first, I did not have a particular use case in mind to put this into practice.
Then I realized that these tasks are not limited to executing a prompt in isolation. They can also use other tools, which makes it possible to build a more complete workflow that tackles a real task. In my case, I wanted to automate the creation of a daily application health report with a summary of frequent failures, slow requests, and notable exceptions.
To know how my application was doing, I frequently looked at data in Azure Application Insights via the Azure portal when I had some spare time and when I thought about it. Then, during a run, it struck me that this was a perfect use case for a scheduled task. So I decided to immediately try it out. It was quickly set up, and the results were surprisingly good with the first run.
To achieve this, I used a combination of the following tools:
- the Azure CLI to query the telemetry data
- an AI model to summarize the results and highlight the most important insights
- the scheduling feature of the AI tool to run the task automatically every day
The result is a structured daily report containing only the key numbers I care about. It is a simple example of combining several smaller pieces into one workflow.
Once the telemetry connection is in place, the workflow is useful beyond the scheduled report. I can query the same application health data on demand, ask what changed during a specific time window, or investigate a reported problem by requesting the relevant metrics.
Because the task runs within the context of the application, it can point to the relevant code when it finds a problem. It can even suggest a possible solution.
Why a scheduled task?
On their own, none of the pieces are new. We could already query the telemetry via the Azure portal or using the Azure CLI, and we could already paste the results into a chat window to ask for a summary (you can easily copy a trace within Azure using the copy button). The missing piece was the schedule. It allows the task to run automatically on a set schedule. Of course, a schedule can also be created separately in a custom application, but it's nice to have it integrated into the AI tool itself, e.g. in Claude, Codex, or Copilot.
What makes the scheduled task interesting is how the pieces reinforce each other:
- the CLI tools give the task reliable and repeatable access to the data; the query result should still be treated as untrusted input because telemetry fields can contain user-controlled values
- the language model turns that data into something valuable and human-readable, which is the part that is hard to do manually
- the schedule makes sure this happens on the given cadence, so we don't have to remember to do it ourselves
The daily application health report is a good example because it brings all three pieces together, and for me, it automates the work I was already doing manually.
What
The idea is simple: run a prompt on a schedule, grant the agent access to the tools it requires to do its job, and turn this into an actionable report with key insights.
In my case, the prompt is a request to create a daily application health report using the Azure Application Insights telemetry from the last 24 hours. Some tools, including Codex, can schedule the task inside an existing chat so each run can use the previous report as context. A standalone task instead needs to query an explicit baseline window or store the previous result somewhere durable. Comparing reports can be helpful to validate that a bugfix actually improved the situation, or to see if a new deployment caused a regression.
I have been experimenting with the scheduling features in Claude Code Routines and Codex Scheduled tasks. GitHub Copilot also has the same capability with Copilot automations. The names and exact setup differ, but overall they act very similarly.
The task can run locally or in the cloud. A local task is useful when it needs access to existing credentials and configuration, while a cloud task can run when your machine is off. However, a cloud execution requires its own credentials and network access, and this is not always possible yet.
For my use case, the task runs locally. This makes it easy to use the existing Azure CLI login and the local configuration that is already available on my machine.
How
Task creation
Creating a new recurring task is straightforward. You can manually create the task, or you can start from a chat window and ask the agent to create the task including the prompt.
Depending on the AI tool, you can configure the schedule using a preset or a product-specific recurrence rule, such as a cron expression. You can also configure the tools it has access to and the model to use.
During the creation of the task, you need to provide the prompt that defines the process the task should perform.
After the task has been created, it can also be run on demand.
The prompt
Just as with a normal prompt, the prompt is the most important part of the task. It defines what the task does, and does not do. It is important to be explicit about the boundaries of the task, especially when it has access to tools.
You can either write the prompt manually, or you can let the agent write a draft version of the prompt that you can then refine. I prefer the latter, because it is often easier to start from a draft than from scratch. Because the agent already has knowledge of the CLI tools and commands, it often can create a first version of the prompt that is already close to what I want.
The prompt should specify what data the task operates on, and how it should summarize and report the results back to you. As a safety measure, keep in mind that the boundary should be enforced by the task configuration and Azure permissions, not only by the prompt. Use a least-privileged identity and expose only the query tools the report needs. Treat telemetry as untrusted input because fields such as request paths, exception messages, traces, and custom dimensions can contain user-controlled values. The prompt should also require sensitive data to be redacted from every section of the report.
Querying the telemetry
The prompt needs to define how it accesses the telemetry data.
In my case, the data comes from Azure Application Insights.
I'm using the Azure CLI to retrieve the telemetry data.
In all fairness, the exact retrieval method doesn't matter much to me, as long as the task can get the data it needs to do its job. The CLI can either invoke a REST endpoint, or use the monitor app-insights commands to execute a query directly against an Application Insights resource.
Instead of the CLI, you could use the Azure MCP Server tools. I prefer the CLI here because it gives me direct control over the query, and the CLI is already familiar to AI models. When using the MCP server, you will need to grant the agent access to the required MCP tools.
Because the task runs locally, it reuses my existing Azure CLI login. For a cloud setup you will need to provide the right permissions.
Receiving the report
When the task has finished, the report appears in the run's chat or session. In Codex, a standalone scheduled task starts a new chat for each run, while a task scheduled inside an existing chat returns to that chat and preserves the previous reports as context. Either way, I can continue the conversation with the AI model, ask follow-up questions, and explore the results further.
Example
Here's the version Claude Code and Codex produced for me.
##Authentication and access-----``##Data handling and safety---##Production triage checklist (last 24h vs previous 7 days)1.2.3.4.5.6.##Output----
----1.2.3.4.
Conclusion
I hope this example inspires you to think about similar use cases. Integrating existing CLI or MCP tools, and using an LLM to do something with the data/output, can be applied to many other scenarios. The scheduling feature allows you to automate the process and get a report on a regular basis, without having to remember to do it manually.
The use case mentioned in this article applies this to create a daily Application Health Report. The biggest benefit for me is not just the report itself, but the ability to continue the conversation with the AI model. I can ask follow-up questions, explore the results, decide on next steps, and get suggestions to resolve a problem. This can also be automated: the task could produce a proposal for each finding, and even create a pull request for it.
Because this process involves a lot of data, it is a good candidate to use AI to summarize the results. Instead of just data points, the report contains a summary of the most important findings, and it highlights the items that require attention. The report is structured in a way that makes it easy to read and understand, and it provides clear actionable insights.
We use AI here as a tool to highlight existing problems, not as a replacement for our own judgment. The agent does not take full control of the process, but it helps me to focus on the most important issues. The output is a starting point for further investigation, and it helps me prioritize work while I'm still responsible for the next steps.
This automation has already saved me time by helping me notice issues such as excessive logging and slow endpoints, and by letting me track the impact of a bugfix.
Even if you don't create an automation, I want you to take away the idea that you can integrate existing tools into your prompt instead of copy-pasting data from one context to the prompt. In the end, this allows you to create a workflow that is more than just a single prompt, or remove the manual steps entirely.
Related articles
Feel free to update this blog post on GitHub, thanks in advance!
Enjoying the blog?
Support my work
If you enjoyed this post and found it useful, consider supporting my work. It helps me keep creating and sharing content like this. Thank you!