Skip to content
This documentation covers kagent while it is in development and can describe unreleased features. For the current release, see the latest docs.

About agents

Page as Markdown

Learn what an agent is in kagent, what it is made of, who runs its loop, how you talk to it, and what keeps it in bounds.

An agent is a model that works in a loop. It reads a request, decides what to do, calls tools to act or to find things out, reads the results, and repeats until it can answer. The model supplies the reasoning, and everything around it, the prompt, the tools, and the loop that runs them, makes it an agent.

In kagent, an agent is a set of Kubernetes resources. You describe the agent, and kagent runs every conversation with it in its own sandbox on Agent Substrate.

What an agent is made of

kagent splits an agent into what it does and how it runs, and then pairs the two.

ResourceDefinesFor example
AgentTemplateWhat the agent doesIts model, system prompt, tools, skills, and plugins
HarnessHow the agent runsThe engine that runs the loop, its container image, and the capacity that it runs on
AgentWhich template runs on which harnesspersonal-assistant pairs an assistant template with the kagent-default harness

The split lets you reuse each half. Many Agents can share one AgentTemplate, so a change to the template reaches all of them. An Agent can also carry its template inline, which is the shortest path to a first agent. kagent install creates a kagent-default Harness, so a first agent needs only the template half.

For the full model, including the Session and the Actor that a conversation runs on, see Core concepts.

Who runs the loop

The Harness decides what executes the agent. Pick one per Harness.

  • kagent runs kagent’s built-in engine. You describe the agent in the AgentTemplate, and kagent runs the loop. This is a declarative agent.
  • codex and claude run a coding agent, which takes its configuration from the AgentTemplate.
  • byo runs a container image of your own that exposes kagent’s A2A contract. See Bring your own agent.

Each harness supports a different set of model providers and template features. To compare them, see Choose a harness.

What an agent can use

  • A model, through a ModelConfig that names the provider and model. See Configure models.
  • A system prompt, inline or from a ConfigMap, that sets its behavior. See System prompts.
  • Tools, from Model Context Protocol (MCP) servers, and other agents bound as subagents. See About tools.
  • Skills and plugins, packaged know-how that the agent loads at run time. See Skills and Plugins.
  • Memory and context: long-term memory across conversations, and context management that keeps a long conversation within the model’s limit.
  • A structured answer that must match a JSON Schema. See Structured output.

How you talk to an agent

Each conversation with an agent is a Session. A Session keeps the transcript of its turns, so the agent answers with the earlier turns in context, and two Sessions share nothing.

  • In the kagent UI, each chat that you start is a Session.
  • From the command line, kagent agent session create starts a Session and kagent agent invoke sends it a message. See Deploy an agent.
  • Other programs and agents reach an agent over the A2A (Agent2Agent) protocol. See A2A agents.
  • MCP clients reach agents through the kagent MCP server.
  • A schedule starts a Session on its own, for example every morning.

To let another account join one conversation, see Session sharing.

What keeps an agent in bounds

An agent runs commands that a model chose, so kagent confines every Session.

  • A sandbox per Session. Each Session runs in its own sandboxed Actor, with its own filesystem. See Sandboxing.
  • Egress control. An agent reaches its model and its registered MCP servers. Any other host needs an egress policy.
  • Approval before it acts. A tool can require a person’s approval before each call. See Human in the loop.
  • Its own identity. Each Actor has a certificate that the egress gateway checks, and API keys stay out of the agent. See Identity.

When an agent is ready

When you create or change an Agent, kagent compiles the Agent, its template, and its Harness into a revision, and prepares a snapshot of the runtime. The Agent reports Ready once the revision is prepared, which usually takes less than a minute. Its other conditions, Accepted, EgressPoliciesApplied, ResolvedRefs, and Compatible, show which stage failed when it is not ready. To check them, see Check that an agent can run.

A Session keeps the revision that it started on. A change to the agent reaches only the Sessions that start after it.

Next steps