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.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Build an Agent

Page as Markdown

Create a personal assistant agent in the kagent UI, then make its behavior reusable with a shared template.

Build an Agent

Create a personal assistant agent in the kagent UI, then make its behavior reusable with a shared template.

Build your first agent in the kagent UI: a personal assistant that you create from one form. Then turn its behavior into a shared template that other agents can reuse.

An agent has two halves. A template describes what the agent does: its model, its system prompt, and its tools. A harness describes where and how the agent runs. kagent install creates a kagent-default harness for you, so the first agent needs only the template half.

To build the same kind of agent from YAML and the CLI instead, see Your first agent.

Before you begin

  1. Install kagent.
  2. Open the kagent UI.
    kagent dashboard

Create a personal assistant

The kagent UI creating an agent named personal-assistant with an inline template, then opening its chat page
Figure: Creating the personal-assistant agent in the UI, sped up
  1. In the sidebar, click Agents, and then click New Agent.

  2. In the Name field, enter personal-assistant. Leave the Namespace as kagent.

  3. In the Harness section, leave Shared harness set to kagent-default.

  4. In the Template section, select Inline. An inline template belongs to this agent only, which is the shortest path to a working agent.

  5. Fill in the template.

    FieldValue
    Model configurationkagent/default-model-config, the model that the installation set up from your API key.
    DescriptionMy personal assistant
    System promptYou are my personal assistant. Be friendly and concise. Help me plan my day, draft messages, and answer questions.

    Leave the other fields as they are. You add tools in Add an MCP server.

  6. Click Create agent. The UI returns to the Agents list, where the agent shows the Preparing status while kagent builds a snapshot of its runtime.

  7. Click Refresh until the status changes to Ready. This step usually takes less than a minute.

  8. Click the agent name, personal-assistant, to open its chat page. Enter a message, such as What can you help me with?, and click Send. Each chat that you start is a Session with the agent.

Make the behavior reusable

The personal assistant keeps its behavior inline, so no other agent can use it. A shared template holds the same settings as an object of its own. Every agent that references the template gets its model, prompt, and tools, and a change to the template reaches all of them.

The kagent UI creating an agent template named assistant-template, then an agent named team-assistant that references it
Figure: Creating a shared template and an agent that references it, sped up
  1. On the Agents page, click New Template.

  2. Fill in the template, and then click Create template.

    FieldValue
    Nameassistant-template
    Model configurationkagent/default-model-config
    DescriptionA friendly, concise assistant
    System promptYou are a personal assistant. Be friendly and concise. Help plan the day, draft messages, and answer questions.

    The template is listed on the Templates tab of the Agents page.

  3. Click New Agent, and enter team-assistant in the Name field.

  4. In the Template section, leave Reference selected, and choose assistant-template from the Shared template list.

  5. Click Create agent, and then click Refresh until the agent is Ready.

The Agents list now shows both agents. The Template column reads Inline for personal-assistant and assistant-template for team-assistant.

Harnesses

Both agents run on the kagent-default harness. A harness sets the runtime that compiles and runs a template, the image, and the worker pool that the agent’s sessions are scheduled on. kagent install also creates the codex-default and claude-default harnesses, which run a template on those runtimes.

To create a harness of your own, click New Harness on the Agents page. For the options, see Agent harness.

YAML version

Everything that you did in the UI is stored as Kubernetes resources. To create the same resources from the command line, or to keep them in a Git repository, apply this YAML.

The personal-assistant agent, with its behavior inline
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: Agent
metadata:
  name: personal-assistant
  namespace: kagent
spec:
  harnessRef:
    name: kagent-default
  template:
    inline:
      description: My personal assistant
      modelConfig:
        name: default-model-config
      systemPrompt: |-
        You are my personal assistant. Be friendly and concise. Help me plan my day, draft messages, and answer questions.
EOF
The shared template, and the team-assistant agent that references it
kubectl apply -f - <<EOF
apiVersion: api.kagent.dev/v1alpha3
kind: AgentTemplate
metadata:
  name: assistant-template
  namespace: kagent
spec:
  description: A friendly, concise assistant
  modelConfig:
    name: default-model-config
  systemPrompt: You are a personal assistant. Be friendly and concise. Help plan the day, draft messages, and answer questions.
---
apiVersion: api.kagent.dev/v1alpha3
kind: Agent
metadata:
  name: team-assistant
  namespace: kagent
spec:
  harnessRef:
    name: kagent-default
  template:
    ref:
      name: assistant-template
EOF

Next steps