Tag Archives: agents

Kagent Agents Tools

Welcome to the NZRT Wiki Podcast. Today we’re looking at Kagent Agents & Tools.

This page covers the built-in tools available inside Kagent, some real example agents configured for NZRT, and how you actually talk to those agents once they’re running.

Let’s start with the built-in Kubernetes tools. These come from something called the kagent-tool-server, and there are eight of them. Think of each one as a kubectl command wrapped up so an AI agent can use it. The first lets an agent list all available resource types in the cluster — similar to running kubectl api-resources yourself. Next there’s a tool for describing a specific resource, giving you the same detail as kubectl describe. There’s one for fetching pod logs, one for listing cluster events, and one for testing service connectivity from inside the cluster — similar to running curl internally. On the write side, you have a tool for applying a YAML manifest, a tool for patching a specific field on a resource, and finally a tool for deleting resources — though the docs flag that last one as something you should leave out of most agents.

Beyond the core Kubernetes tools, there are four extended MCP servers you can bolt on. Helm gives you install, upgrade, and rollback capabilities, enabled by setting a helm flag during install. Prometheus lets you run metric queries but requires Prometheus to already be running in your cluster. Argo CD adds GitOps sync, diff, and rollback and needs Argo CD installed. And Istio gives you service mesh configuration and traffic management, which requires Istio.

Now let’s look at three example agents NZRT has defined.

The first is the SRE Agent, built for read-only diagnostics. Its configuration marks it as a Declarative agent living in the kagent namespace. The system message tells it it’s a read-only SRE agent covering the nzrt-prod, nzrt-staging, nzrt-dev, monitoring, and kagent namespaces. It’s instructed to diagnose issues, explain pod failures, recommend fixes, never apply changes, and never expose Secret values in responses. The tools it gets are all read-only — resource listing, pod logs, describe, events, and service connectivity. You’d use this agent by asking things like why a pod is crashing in production, checking service connectivity for Nextcloud, or reviewing what events happened in staging over the last hour.

The second is the Staging Deployment Agent, which has controlled write access. Its system message scopes it strictly to the nzrt-staging namespace — it can apply and patch Deployments and Services there, but is explicitly told never to touch production and never to delete resources. It also has a rule to confirm with you before applying anything. On top of the read-only tools, it gets the apply manifest and patch resource tools as well. This is the agent you’d use for rolling out a new WordPress image to staging, scaling the Nextcloud deployment to two replicas, or pushing an updated ConfigMap.

The third is the Monitoring Agent, which combines Kubernetes logs and events with Prometheus metrics. Its system message tells it to query Prometheus and pod logs, identify performance issues, and deliver plain-English summaries flagging anomalies. It pulls tools from two MCP servers — the standard kagent-tool-server for pod logs and events, and a separate Prometheus MCP server that adds two more tools: one for instant metric queries and one for querying metrics across a time range.

Finally, let’s cover how you actually reach these agents once they’re deployed. There are three options. The first is the dashboard — you run the kagent dashboard command, open your browser to localhost on port 8082, select an agent, and start chatting. The second is the command-line interface, where you run a kagent chat command and specify the agent name and namespace — for example, targeting the nzrt-sre-agent in the kagent namespace. The third is a direct HTTP API call, where you post a JSON request to a local endpoint that includes the agent name in the URL path. The message body just contains the text of your question, such as asking it to list all pods in nzrt-prod.

That’s it for this episode of the NZRT Wiki Podcast. Thanks for listening.

Tool Use Agents

Welcome to the NZRT Wiki Podcast. Today we’re looking at Tool Use & Agents.

Let’s start with the concept of tool use, sometimes called function calling. At its core, this is the ability for a large language model to reach out and interact with the world beyond its own knowledge. When you send a prompt to an AI, rather than just generating a text answer, the model can recognise that it needs to call an external tool to get the job done. It does this by producing a structured piece of data, essentially a description of what tool it wants to use and what inputs it needs. Your application picks that up, runs the actual tool, whether that’s an API call, a database query, or a file read, and then passes the result back to the model, which uses it to form its final response.

To make that concrete, imagine Claude deciding it needs to check the weather. It would output something that says: call the get weather function, with Auckland, New Zealand as the location. Your app runs that, gets the forecast, hands it back, and Claude says something sensible like “It looks like it’ll be cloudy in Auckland today.” The model never directly calls anything itself. It generates the instruction, and your host application does the actual work.

Next up is Retrieval-Augmented Generation, or RAG. This is a technique for grounding a model’s responses in real, up-to-date information rather than relying purely on what it learned during training. The idea is that when you ask a question, your system first converts that question into a mathematical representation called an embedding, then searches a database of similarly encoded document chunks to find the most relevant pieces of content. Those chunks get inserted into the prompt as context, and the model generates its answer based on that retrieved material rather than guessing.

There are a few moving parts to know about here. First, chunking: your source documents get split into overlapping segments, typically somewhere between two hundred and five hundred tokens each, so they’re a manageable size for retrieval. Second, an embedding model converts both your query and your document chunks into vectors, which are essentially lists of numbers that capture meaning. Models like text-embedding-3-small are commonly used for this. Third, a vector store holds all those embeddings and lets you search them by similarity. Popular options include Pinecone, Chroma, pgvector, Qdrant, and Meilisearch. And finally, a reranker can take the top results from that search and re-score them more carefully before they go into the prompt, improving quality even further.

Now let’s talk about agents. An agent is a large language model running in what’s called an agentic loop: it perceives a goal, reasons about what to do, takes an action using a tool, observes the result, and then repeats that cycle until the task is complete or it hands off to something else. This is what separates an agent from a simple chatbot. It’s not just answering your question once, it’s working through a problem across multiple steps.

There are several common patterns for how agents are designed. The ReAct pattern, short for Reason and Act, has the model interleave its thinking with its tool calls, reasoning out loud before each action. Plan-and-Execute agents generate a full plan upfront and then carry out each step in sequence. Reflection agents go a step further and critique their own output, retrying if something doesn’t look right. Multi-agent setups have an orchestrator model delegating subtasks to specialist subagents, each with their own focus area. And Human-in-the-Loop agents pause at key decision points and wait for a human to approve before continuing. Each pattern suits different use cases depending on how much autonomy and reliability you need.

One important standard in this space is MCP, the Model Context Protocol, released by Anthropic in 2024. MCP provides a unified way for language models to connect to tools and data sources. Think of it as a common language that lets Claude talk to a wide range of external systems without needing custom integration code for each one. In an MCP setup, you have the model itself, then an MCP host like Claude Code or Claude Desktop, and then MCP servers that expose the actual capabilities. Those servers can provide access to filesystems, databases, APIs, browsers, and more. MCP supports two transport modes: stdio for running things locally, and server-sent events over HTTP for remote connections. The things MCP servers can expose fall into three categories: tools, which are functions the model can call; resources, which are data the model can read like files or database rows; and prompts, which are reusable templates. MCP servers can be written in Python or TypeScript using the official SDK.

Finally, a quick word on memory. Language models are stateless by default, meaning each new conversation starts completely fresh. But there are patterns to work around this. You can keep prior turns or summaries in the prompt itself. You can store facts in a database and retrieve them by key. You can use semantic memory, embedding past interactions and retrieving them by similarity. You can log full conversation histories and summarise them on demand. Or you can encode persistent rules and persona directly into the system prompt, which is called procedural memory. Each approach has trade-offs in cost, speed, and fidelity, and many real-world systems combine several of them.

That’s it for this episode of the NZRT Wiki Podcast. Thanks for listening.