AgentDefinition YAML Reference

The AgentDefinition YAML is hive’s portable agent format — a single, self-contained document (kind: AgentDefinition) that describes whole agent: its identity, its engine, its behavior, and even its work prompt. This is the file the dashboard’s + agent → Import from URL overlay points you at, and it is exactly the schema that overlay reads. This page documents every field, grouped to match the file’s structure.

If you clicked + agent in the dashboard and were sent to v2/examples/agents/customized-agent.yaml for an example, this is the reference for that file. For the other way agents are configured — inline entries under agents: in hive.yaml, using snake_case keys — see Agent Configuration. The two describe the same underlying agent; they differ in shape and casing (see How this maps to hive.yaml below).

Which Hive does this document? This page tracks the Hive v2 line — the same line the dashboard, the + agent overlay, and the example YAML come from. Hive’s docs site currently publishes a single main (Latest) channel; there is no separate v2 entry in the version selector even though the example file lives on the repo’s v2 branch. If a dashboard link sends you to .../blob/v2/v2/examples/..., that doubled v2 is branch v2 plus the in-repo path v2/examples/..., not a typo — it is the current, supported example.

The document envelope

Every AgentDefinition starts with the same four top-level keys:

apiVersion: hive.kubestellar.io/v1
kind: AgentDefinition
metadata:
  # identity & presentation
spec:
  # engine, behavior, triggers, tools, connections
FieldTypeRequiredDefaultMeaning
apiVersionstringrecommendedSchema group/version. Use hive.kubestellar.io/v1.
kindstringrequiredMust be exactly AgentDefinition, or the import is rejected.
metadatamaprequiredIdentity and dashboard presentation. metadata.name is required.
specmaprequired in practiceEverything the agent does — engine, behavior, triggers.

metadata — identity and presentation

metadata:
  name: customized-agent
  displayName: "Customized Agent"
  description: "A template agent that demonstrates the portable agent definition format."
  emoji: "🛠"
  color: "#e67e22"
FieldTypeRequiredDefaultMeaning
namestringrequiredThe agent’s identifier and its key in the roster. Lowercase, no spaces (e.g. customized-agent).
displayNamestringoptionalfalls back to nameHuman-readable label shown in the dashboard roster.
descriptionstringoptionalempty-line summary of what the agent does; shown in the dashboard.
emojistringoptionalnone (well-known names get a default)Badge shown next to the agent in the dashboard. A single emoji.
colorstringoptionalnoneDashboard accent color as a hex string (e.g. #e67e22).
specVersionintoptionalunsetReserved for future schema evolution of the definition format. Leave unset unless a newer Hive tells you otherwise.

spec — engine, behavior, and triggers

Everything below lives under spec:.

Engine — what powers the agent

spec:
  backend: copilot
  model: claude-sonnet-4-6
FieldTypeRequiredDefaultMeaning
backendstringoptionalcopilot (applied on import)The engine that runs the agent. See the value table below.
modelstringoptionalengine-dependentModel id for that engine (e.g. claude-sonnet-4-6). Leave empty to accept the engine’s default / governor choice.

backend accepts of three kinds of value:

  1. A subscription CLI: claude, copilot, goose, codex, pi, bob, or aider. You log in per CLI from the dashboard, and every agent using that CLI shares the login. (gemini is also offered live in the dashboard; as a persisted value prefer the validated list here.)
  2. A self-hosted inference backend: vllm, llm-d, or litellm. These are OpenAI-compatible endpoints you configure with a base URL and a key reference; the agent launches the Claude CLI routed through hive’s inference translator, so there is no separate login.
  3. A configured Model Gateway name (for example openrouter). When backend names a gateway you have configured, the agent is routed through that gateway’s OpenAI-compatible endpoint. The gateway must exist in your hive configuration first; the name here simply selects it. If your hive has an OpenRouter / Model Gateway setup page, configure the gateway there before referencing it as a backend.

The engine also decides how model discovery works and how pinning behaves. For the full comparison of subscription CLIs vs. inference backends, live model discovery, and the pin/auto-switch rules, see Agent Configuration → Methods.

Identity & routing

spec:
  role: custom
  sortOrder: 50
  beadRole: worker
  aliases:
    - cu
  laneKeywords:
    - custom
    - review
  detectKeywords:
    - customized
FieldTypeRequiredDefaultMeaning
rolestringoptionalthe agent’s nameBehavioral role tag. Well-known roles (scanner, ci-maintainer, …) carry built-in presentation defaults; custom marks a bespoke agent.
sortOrderintoptional0 for supervisors, 100 otherwisePosition in the dashboard roster; lower sorts first.
beadRolestringoptionalworker (applied on import)worker (does work) or supervisor (monitors other agents and sorts first).
aliaseslist of stringoptionalnoneShort names accepted in dispatch and commands (e.g. cu).
laneKeywordslist of stringoptionalnoneIssues/PRs matching these keywords are routed into this agent’s lane.
detectKeywordslist of stringoptionalnoneAttributes GitHub activity back to this agent for stats/attribution.

Behavior — what it may do, and when

spec:
  mode: ADVISORY
  staleTimeout: 28800
  restartStrategy: immediate
  clearOnKick: true
  includeRepos: true
FieldTypeRequiredDefaultMeaning
modestringoptionalinherited from level/packGitHub interaction tier: ADVISORY | ISSUES_ONLY | ISSUES_AND_PRS | ISSUES_PRS_MERGE. Controls how far the agent may go (comment → open issues → open PRs → merge). The tools block (below) can override this.
staleTimeoutint (seconds)optionalunset (engine default)Seconds of silence before the agent counts as stale. Must exceed the agent’s longest cadence — the shipped packs use “longest cadence × 2” (e.g. 28800 = 8h).
restartStrategystringoptionalimmediate (applied on import)How a dead session is brought back. immediate reconnects as soon as the session is detected down.
clearOnKickbooloptionaltrueWhen true, the agent’s session context is cleared before each kick (fresh start). false keeps context across kicks — rare, and context bloat is real.
includeReposbooloptionaltrueWhen true, the project repo list is appended to every kick prompt.

cadences — how often the governor kicks it

spec:
  cadences:
    idle: 4h
    quiet: 4h
    busy: 2h
    surge: "off"

cadences is a map from governor mode (idle, quiet, busy, surge) to the interval at which this agent is kicked in that mode. Any interval Go’s duration parser accepts works (5m, 2h, 4h); "off" (or pause) suspends kicks for that mode without disabling the agent.

KeyTypeRequiredMeaning
idle / quiet / busy / surgestring (duration or off)optionalPer-mode kick interval for this agent.

The governor computes the mode from queue depth and kicks each agent on the cadence that mode assigns it. For the full model — evaluation cycle, thresholds, and budgets — see Governor.

promptTemplate — the agent’s work prompt

spec:
  promptTemplate: |
    # ${AGENT_DISPLAY_NAME} — Custom Agent Policy
 
    ${GH_AUTH}
 
    You are the **${AGENT_NAME}** agent for ${PROJECT_ORG}/${PROJECT_PRIMARY_REPO}.
 
    ## Your Role
    Analyze the codebase and provide recommendations based on your expertise.
 
    ## Work List
    ISSUES: ${ISSUE_LIST}
    PRs: ${PR_LIST}
 
    ${KNOWLEDGE}
FieldTypeRequiredDefaultMeaning
promptTemplatestring (multiline)optionalfalls back to the agent’s kick_template / conventionThe periodic work prompt bundled inline with the agent. On import it is written to the policies directory as <name>.md and the agent’s kick template is pointed at it.

${VAR} references are substituted on every kick (${ISSUE_LIST}, ${PR_LIST}, ${AGENT_NAME}, ${PROJECT_ORG}, ${KNOWLEDGE}, …). For the complete variable list and how to add your own, see Variable Substitution.

Bundling the prompt inline is what makes an AgentDefinition portable: config plus policy travel together in importable file.

channels — how the agent gets triggered

Channels declare how an agent is triggered. When omitted, the agent uses the default governor timer kick. Declaring channels lets you trigger on webhooks, schedules, Discord, or beads instead of (or in addition to) the timer.

spec:
  channels:
    - type: kick
    - type: webhook
      events: ["issues.opened"]
    - type: schedule
      schedule: "0 */4 * * *"
FieldTypeRequiredMeaning
typestringrequiredkick | webhook | discord | schedule | bead.
enabledbooloptionalDefaults to true; set false to declare-but-disable a channel.
eventslist of stringrequired for webhookGitHub webhook events that fire this channel (e.g. issues.opened).
patternslist of stringrequired for discordMessage patterns that fire a discord channel.
schedulestring (cron)required for scheduleCron expression (e.g. 0 */4 * * *).
matchmaprequired for beadMatch criteria that fire a bead channel.
reposlist of stringoptionalRestrict the channel to specific repositories.

Note: Channels are a current, supported v2 feature. (Older copies of the example labeled this (v3 feature); that label is being removed — treat channels as available today.)

tools — declarative tool permissions

The tools block replaces the coarse mode tier with an explicit permission preset plus per-tool overrides. When present, it governs instead of mode.

spec:
  tools:
    preset: advisory
    rules:
      - pattern: "mcp__github__create_issue"
        action: allow
        reason: "allow creating advisory issues"
FieldTypeRequiredMeaning
presetstringoptionalBaseline permission set: advisory | issues-only | issues-prs | full. Maps the mode tiers (advisory denies issue & PR creation; issues-only denies PRs; issues-prs and full deny nothing).
ruleslistoptionalPer-tool overrides applied on top of the preset.
rules[].patternstringrequiredTool pattern to match (e.g. mcp__github__create_issue).
rules[].actionstringrequiredallow or deny. An explicit allow overrides a preset deny for the same pattern.
rules[].reasonstringoptionalHuman-readable justification, shown for auditing.

Note: Tools are a current, supported v2 feature.

connections — external service integrations

Connections attach external services (MCP servers, HTTP APIs, knowledge sources) to an agent.

spec:
  connections:
    - name: github-mcp
      type: mcp
      uri: "stdio:///usr/local/bin/mcp-github"
FieldTypeRequiredMeaning
namestringrequiredUnique name for the connection within the agent.
typestringrequiredmcp | api | knowledge.
uristringrequired for mcp and apiEndpoint URI (e.g. a stdio:// MCP command or an HTTP base URL).
authmapoptionalAuthentication: auth.type, and a key referenceauth.env_var (env var name) or auth.file (key-file path). Secret values never go in YAML.
env_namestringoptionalEnvironment variable name to expose to the connection.
optionsmapoptionalFree-form string options passed to the connection.

Note: Connections are a current, supported v2 feature.

Complete annotated example

This mirrors the shipped v2/examples/agents/customized-agent.yaml. Import it from the dashboard via + agent → Import from URL, or copy it as a starting point and edit the fields above.

apiVersion: hive.kubestellar.io/v1
kind: AgentDefinition
metadata:
  name: customized-agent                # required — roster key & identifier
  displayName: "Customized Agent"        # dashboard label
  description: "A template agent that demonstrates the portable agent definition format. Customize this to create your own specialized agent."
  emoji: "🛠"                            # dashboard badge
  color: "#e67e22"                       # dashboard accent
spec:
  backend: copilot                       # engine: CLI | inference backend | gateway name
  model: claude-sonnet-4-6               # model id for that engine
  role: custom                           # behavioral role tag
  mode: ADVISORY                         # GitHub tier: ADVISORY|ISSUES_ONLY|ISSUES_AND_PRS|ISSUES_PRS_MERGE
  sortOrder: 50                          # dashboard ordering (lower first)
  beadRole: worker                       # worker | supervisor
  staleTimeout: 28800                    # seconds of silence before "stale" (> longest cadence)
  restartStrategy: immediate             # reconnect a dead session immediately
  clearOnKick: true                      # fresh context on each kick
  includeRepos: true                     # append the project repo list to each kick
  laneKeywords:                          # route matching issues/PRs into this lane
    - custom
    - review
  detectKeywords:                        # attribute GitHub activity back to this agent
    - customized
  aliases:                               # short dispatch names
    - cu
 
  # Channels — how this agent gets triggered (supported v2 feature).
  # Omit to use governor timer kicks.
  # channels:
  #   - type: kick
  #   - type: webhook
  #     events: ["issues.opened"]
  #   - type: schedule
  #     schedule: "0 */4 * * *"
 
  # Tools — declarative tool permissions (supported v2 feature).
  # Present = governs instead of `mode`.
  # tools:
  #   preset: advisory
  #   rules:
  #     - pattern: "mcp__github__create_issue"
  #       action: allow
  #       reason: "allow creating advisory issues"
 
  # Connections — external service integrations (supported v2 feature).
  # connections:
  #   - name: github-mcp
  #     type: mcp
  #     uri: "stdio:///usr/local/bin/mcp-github"
 
  cadences:                              # per-governor-mode kick intervals
    idle: 4h
    quiet: 4h
    busy: 2h
    surge: "off"                         # "off" (or pause) suspends kicks in this mode
 
  promptTemplate: |                      # inline periodic work prompt (${VAR} substituted per kick)
    # ${AGENT_DISPLAY_NAME} — Custom Agent Policy
 
    ${GH_AUTH}
 
    You are the **${AGENT_NAME}** agent for ${PROJECT_ORG}/${PROJECT_PRIMARY_REPO}.
 
    ## Your Role
    Analyze the codebase and provide recommendations based on your expertise.
    Focus on the repositories listed below and create advisory beads for your findings.
 
    ## Rules
    - work items from the kick message
    - Always sign commits with DCO: git commit -s
    - Respect hold labels
    - Write a bead for every finding
 
    ## Work List
    ISSUES: ${ISSUE_LIST}
    PRs: ${PR_LIST}
 
    ${KNOWLEDGE}

Import defaults

When you import an AgentDefinition, a few fields get default values if you leave them out:

FieldDefault applied on import
spec.backendcopilot
spec.restartStrategyimmediate
spec.beadRoleworker
enabled (not a definition field)true — the imported agent is enabled

enabled and paused are operator lifecycle state, not definition fields: they are managed from the dashboard, not from the imported YAML, so an imported definition can never silently enable or un-pause an agent behind your back.

How this maps to hive.yaml

An imported AgentDefinition becomes entry under agents: in the running config. The portable format uses apiVersion/kind/metadata/spec with camelCase keys; the inline hive.yaml form uses snake_case keys directly under the agent name. The mapping is-to-one:

AgentDefinition (portable)hive.yaml agents: (inline)
metadata.namethe agent’s map key
metadata.displayNamedisplay_name
metadata.descriptiondescription
metadata.emoji / metadata.coloremoji / color
spec.backend / spec.modelbackend / model
spec.role / spec.sortOrderrole / sort_order
spec.beadRolebead_role
spec.modemode
spec.staleTimeoutstale_timeout
spec.restartStrategyrestart_strategy
spec.clearOnKickclear_on_kick
spec.includeReposinclude_repos
spec.laneKeywords / spec.detectKeywordslane_keywords / detect_keywords
spec.aliasesaliases
spec.cadencesgovernor per-mode cadence entries
spec.promptTemplatewritten to the policies dir; sets kick_template
spec.channels / spec.tools / spec.connectionschannels / tools / connections

For the inline hive.yaml form, the smallest-agent walkthrough, ACMM packs, and the governor, start at Agent Configuration.