Build a scheduled agent
Build an agent that writes a cluster health report every day, without being asked.
About this tutorial
Build an agent that works on a timer. Every day, it reads the cluster, writes a short health report, and leaves the report in a conversation for you to read. Nobody has to ask.
The agent gets only tools that read, because nobody watches it while it runs. A schedule starts a new Session with the agent each time it fires. For how schedules work, see Scheduled runs.
Time: about 15 minutes.
Before you begin
If kagent already runs in your cluster, skip these steps.
Create a local kind cluster. To use a Kubernetes cluster that you already run, at version 1.37 or later, skip this step.
kind create cluster --name kagent --image kindest/node:v1.37.0Set the API key of your model provider, then install the kagent CLI and run it.
kagent installsets up the CRDs, Agent Substrate, a development PostgreSQL database, and kagent, and takes a few minutes.export OPENAI_API_KEY="your-api-key-here" curl -sL https://kagent.dev/install | bash && kagent installCheck that the kagent pods run. Every pod reports
Running.kubectl get pods -n kagent
Build the reporting agent
Build the agent step by step in the kagent UI, or apply the same resources as YAML and talk to the agent with the kagent CLI.
Open the kagent UI
kagent dashboardThe command forwards the UI to http://localhost:8082 and opens it in your browser. Leave it running while you work.
Create the agent

In the sidebar, click Agents, and then click New Agent.
In the Name field, enter
cluster-reporter. Leave the Namespace askagent, and leave Shared harness set tokagent-default.In the Template section, select Inline, and fill in the template.
Field Value Model configuration kagent/default-model-configDescription Writes a short cluster health reportIn the System prompt field, enter the following prompt.
You write a short health report for a Kubernetes cluster. List pods that are not Running or Ready, and recent Warning events. Keep the report under ten lines. If everything is healthy, say so in one line.Under Tools from MCP servers, click Add an MCP server, and choose
kagent/kagent-tool-server. From the tool list beside it, choosek8s_get_resourcesandk8s_get_events. An agent that runs unattended gets only tools that read.Click Create agent, and then click Refresh until the agent is Ready.
Schedule it
In the sidebar, click Schedules, and then click New Schedule.
From the Agent list, choose
kagent/cluster-reporter.In the Name field, enter
nightly-health-report.Leave Repeat set to Daily, and set At time and Time zone to when you want the report.
In the Prompt field, enter
Write the health report for all namespaces.Leave Enable Schedule on, and click Create schedule.
Read the reports
The page of the schedule shows the next execution and an Execution history table. To get the first report without waiting, click Run. Each row of the table links to the conversation of that run, which holds the report.
Verify the agent
Check that the agent is ready.
kubectl get agent cluster-reporter -n kagentExample output:
NAME READY AGE cluster-reporter True 5mIn the kagent UI, click Schedules, and open
nightly-health-report. The page shows the next execution time. After you click Run, or after the first scheduled time, the Execution history lists the run.Click the run’s conversation link, and check that it holds a report of ten lines or fewer.
What you built
An agent that writes a cluster health report every day without being asked. Along the way, you used these features:
| Feature | What you did | Read more |
|---|---|---|
| Scheduled runs | Ran the agent every day with a fixed prompt | Scheduled runs |
| MCP tools | Bound only the read-only tools of the built-in kagent-tool-server | About tools, Tools ecosystem |
| Agents and inline templates | Gave the agent its report format in its system prompt | System prompts |
Clean up
In the kagent UI, click Schedules, and delete
nightly-health-report. If you created it with grpcurl, see Scheduled runs for theDeleteScheduledRuncall.Delete the agent.
kubectl delete agent cluster-reporter -n kagent