Skip to main content

YAML Configuration Formats

English | 简体中文

This document provides detailed explanations of the YAML configuration formats for each core concept in the Wegent platform. Each definition follows Kubernetes-style declarative API design patterns.

Table of Contents


👻 Ghost

Ghost defines the "soul" of an agent, including personality, capabilities, and behavior patterns.

Complete Configuration Example

apiVersion: agent.wecode.io/v1
kind: Ghost
metadata:
name: developer-ghost
namespace: default
spec:
systemPrompt: |
You are a senior software engineer, proficient in Git, GitHub MCP, branch management, and code submission workflows. You will use the specified programming language to generate executable code and complete the branch submission and MR (Merge Request) process.
mcpServers:
github:
env:
GITHUB_PERSONAL_ACCESS_TOKEN: ghp_xxxxx
args:
- run
- -i
- --rm
- -e
- GITHUB_PERSONAL_ACCESS_TOKEN
- -e
- GITHUB_TOOLSETS
- -e
- GITHUB_READ_ONLY
- ghcr.io/github/github-mcp-server
command: docker

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Ghost
metadata.namespacestringYesNamespace, typically default
spec.systemPromptstringYesSystem prompt defining agent personality and capabilities
spec.mcpServersobjectNoMCP server configuration defining agent's tool capabilities
spec.skillsarrayNoList of Skill names to associate with this Ghost, e.g., ["skill-1", "skill-2"]

✨ Skill

Skill is a Claude Code capability extension package containing executable code and configuration. Skills are uploaded as ZIP packages and deployed to ~/.claude/skills/ when tasks start.

Complete Configuration Example

apiVersion: agent.wecode.io/v1
kind: Skill
metadata:
name: python-debugger
namespace: default
spec:
description: "Python debugging tool with breakpoint and variable inspection support"
version: "1.0.0"
author: "WeCode Team"
tags: ["python", "debugging", "development"]
status:
state: "Available"
fileSize: 2048576
fileHash: "abc123def456..."

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Skill (used in Ghost spec.skills field)
metadata.namespacestringYesNamespace, typically default
spec.descriptionstringYesSkill功能描述 (extracted from SKILL.md frontmatter)
spec.versionstringNoVersion number (semantic versioning recommended)
spec.authorstringNoAuthor name or organization
spec.tagsarrayNoTags for categorization, e.g., ["python", "debugging"]
status.statestringYesSkill status: Available or Unavailable
status.fileSizeintegerNoZIP package size in bytes
status.fileHashstringNoSHA256 hash of the ZIP package

ZIP Package Requirements

Skills must be uploaded as ZIP packages containing:

  1. SKILL.md (required): Skill documentation with YAML frontmatter
  2. Other files: Scripts, configurations, assets, etc.

SKILL.md Format:

---
description: "Your skill description here"
version: "1.0.0"
author: "Your Name"
tags: ["tag1", "tag2"]
---

# Skill Documentation

Detailed description of what this skill does...

Using Skills in Ghosts

Associate skills with a Ghost by adding them to the spec.skills array:

apiVersion: agent.wecode.io/v1
kind: Ghost
metadata:
name: developer-ghost
namespace: default
spec:
systemPrompt: "You are a senior developer..."
mcpServers: { ... }
skills:
- python-debugger
- code-formatter

When a task starts with this Ghost, the Executor automatically downloads and deploys these skills to ~/.claude/skills/.

🧠 Model

Model defines the AI model configuration, including environment variables and model parameters.

Complete Configuration ClaudeCode Example

apiVersion: agent.wecode.io/v1
kind: Model
metadata:
name: ClaudeSonnet4
namespace: default
spec:
modelGroup: "Primary"
modelSubGroup: "Fast"
modelConfig:
env:
ANTHROPIC_MODEL: "openrouter,anthropic/claude-sonnet-4"
ANTHROPIC_BASE_URL: "http://xxxxx"
ANTHROPIC_AUTH_TOKEN: "sk-xxxxxx"
ANTHROPIC_DEFAULT_HAIKU_MODEL: "openrouter,anthropic/claude-haiku-4.5"

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Model
metadata.namespacestringYesNamespace, typically default
spec.modelGroupstringNoFirst-level display group used by model selectors
spec.modelSubGroupstringNoSecond-level display group under spec.modelGroup
spec.modelConfigobjectYesModel configuration object
spec.modelConfig.envobjectYesEnvironment variables configuration
spec.protocolstringNoUpstream protocol (openai, openai-responses, claude, ...). Inferred from env.model when omitted.
spec.apiFormatstringNoUpstream API format (responses, chat/completions, ...). Derived from spec.protocol when omitted.
spec.isWeworkAvailablebooleanNoWhether the model is distributed to the wework desktop client.

Model Selector Grouping

Model selectors display models as modelGroupmodelSubGroup → model. These fields are stored in spec, not metadata.labels, so grouping is part of the Model resource definition. Models without these fields are shown under the default ungrouped/uncategorized buckets. Grouping only affects display and search behavior; it does not change model protocol, credentials, permissions, or runtime selection.

Common Environment Variables for ClaudeCode

Variable NameDescriptionExample Value
ANTHROPIC_MODELMain model configurationopenrouter,anthropic/claude-sonnet-4
ANTHROPIC_BASE_URLAPI base URLhttp://xxxxx
ANTHROPIC_AUTH_TOKENAuthentication tokensk-xxxxxx
ANTHROPIC_DEFAULT_HAIKU_MODELFast model configurationopenrouter,anthropic/claude-haiku-4.5

🐚 Shell

Shell defines the agent's runtime environment, specifying the runtime type, base image, and supported models.

Complete Configuration Example

apiVersion: agent.wecode.io/v1
kind: Shell
metadata:
name: ClaudeCode
namespace: default
labels:
type: local_engine
spec:
shellType: ClaudeCode
supportModel: []
baseImage: ghcr.io/wecode-ai/wegent-base-python3.12:1.0.1
status:
state: Available

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Shell
metadata.namespacestringYesNamespace, typically default
metadata.labelsobjectNoLabels for categorization, e.g., type: local_engine or type: external_api
spec.shellTypestringYesShell type, such as ClaudeCode, Agno, Dify
spec.supportModelarrayNoList of supported model types
spec.baseImagestringNoDocker base image for local engine shells (required for local_engine type)
status.statestringNoShell status: Available or Unavailable

Shell Types

TypeLabelDescription
ClaudeCodelocal_engineClaude Code runtime, requires baseImage
Agnolocal_engineAgno runtime, requires baseImage
Difyexternal_apiDify external API runtime, no baseImage needed

Labels

LabelValuesDescription
typelocal_engine, external_apiIndicates whether the shell runs locally or connects to external API

🖥 Device

Device defines an execution device. Device records are usually created automatically by the local executor, cloud device service, or remote Docker device entrypoint. Users normally should not create them by hand.

Remote Docker Device Example

apiVersion: agent.wecode.io/v1
kind: Device
metadata:
name: 7b7c9d64-xxxx-xxxx-xxxx-3f70c6f4a931
namespace: default
displayName: alice-remote-a931
spec:
deviceId: 7b7c9d64-xxxx-xxxx-xxxx-3f70c6f4a931
displayName: alice-remote-a931
deviceType: remote
connectionMode: websocket
bindShell: claudecode
isDefault: false
capabilities: null
remoteConfig:
provider: docker
image: ghcr.io/wecode-ai/wegent-device:latest
deviceId: 7b7c9d64-xxxx-xxxx-xxxx-3f70c6f4a931
deviceName: alice-remote-a931
backendUrl: https://backend.example.com
publicBaseUrl: http://localhost:17888
createdAt: "2026-06-17T10:00:00"
status:
state: Available

Field Description

FieldTypeRequiredDescription
metadata.namestringYesDevice resource name, usually the same as spec.deviceId
metadata.namespacestringYesNamespace, typically default
spec.deviceIdstringYesDevice ID used by executor registration and heartbeat
spec.displayNamestringNoDisplay name in the frontend
spec.deviceTypelocal, cloud, remoteYesDevice type; remote means a user-managed Docker container or remote host
spec.connectionModewebsocketYesHow the device connects to the backend
spec.bindShellclaudecode, openclawNoShell runtime bound to the device
spec.isDefaultbooleanNoWhether this is the default device for its type
spec.capabilitiesarray or nullNoDevice capability tags
spec.cloudConfigobjectNoCloud device metadata, used only by cloud devices
spec.remoteConfigobjectNoRemote device metadata, used only by remote devices

remoteConfig stores only non-sensitive metadata. The WEGENT_AUTH_TOKEN returned in the remote Docker startup command is a newly created remote device API key and is not written to the Device CRD. backendUrl is the URL the container uses to reach Backend and is derived from the current Backend environment; publicBaseUrl is the browser-facing URL for the device session gateway.


🤖 Bot

Bot is a complete agent instance that combines Ghost, Shell, and Model.

Complete Configuration Example

apiVersion: agent.wecode.io/v1
kind: Bot
metadata:
name: developer-bot
namespace: default
spec:
ghostRef:
name: developer-ghost
namespace: default
shellRef:
name: ClaudeCode
namespace: default
modelRef:
name: ClaudeSonnet4
namespace: default

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Bot
metadata.namespacestringYesNamespace, typically default
spec.ghostRefobjectYesGhost reference
spec.shellRefobjectYesShell reference
spec.modelRefobjectYesModel reference

Reference Format

All references follow the same format:

name: "resource-name"
namespace: "default"

👥 Team

Team defines a collaborative team of multiple Bots, specifying member roles and collaboration patterns.

Complete Configuration Example for ClaudeCode Model

apiVersion: agent.wecode.io/v1
kind: Team
metadata:
name: dev-team
namespace: default
spec:
members:
- role: "leader"
botRef:
name: developer-bot
namespace: default
prompt: ""
contextPassing: "previous_bot"
collaborationModel: "pipeline"

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Team
metadata.namespacestringYesNamespace, typically default
spec.membersarrayYesList of team members
spec.collaborationModelstringYesCollaboration model

Member Configuration

FieldTypeRequiredDescription
rolestringNoMember role, such as leader
botRefobjectYesBot reference
promptstringNoMember-specific prompt
contextPassingstringNoMessage passed to the next pipeline stage after this stage completes: none, original_user, previous_bot, original_and_previous

Collaboration Models

ModelDescription
pipelinePipeline mode, execute in sequence
routeRoute mode, route based on conditions
coordinateCoordinate mode, members coordinate
collaborateConcurrent mode, members execute simultaneously

📚 KnowledgeBase

KnowledgeBase is used to manage document knowledge bases, retrieval configuration, and summary capabilities.

Retrieval Configuration

FieldTypeRequiredDescription
spec.retrievalConfigobjectNoRAG retrieval configuration. Missing or null means the knowledge base has no RAG configuration
spec.retrievalConfig.retriever_namestringYes*Retriever name
spec.retrievalConfig.retriever_namespacestringNoNamespace where the retriever is defined, defaults to default
spec.retrievalConfig.embedding_config.model_namestringYes*Embedding model name
spec.retrievalConfig.embedding_config.model_namespacestringNoNamespace where the embedding model is defined, defaults to default
spec.retrievalConfig.retrieval_modestringNoRetrieval mode: vector, keyword, or hybrid
spec.retrievalConfig.top_kintegerNoNumber of results to return
spec.retrievalConfig.score_thresholdnumberNoMinimum relevance threshold
spec.retrievalConfig.hybrid_weightsobjectNoHybrid retrieval weights

retriever_name and embedding_config.model_name are required only when spec.retrievalConfig exists. By default, the backend automatically fills in a missing retriever and embedding model during creation; if the create request explicitly uses no-RAG mode, or if no usable defaults are available, it does not write retrievalConfig. The create request field rag_config_mode expresses creation intent only and is not persisted as a KnowledgeBase YAML field. The persisted stable states are either a complete retrievalConfig or no retrievalConfig.

FieldTypeRequiredDescription
spec.summaryEnabledbooleanNoWhether automatic summary generation is enabled
spec.summaryModelRef.namestringNoSummary model name
spec.summaryModelRef.namespacestringNoNamespace where the summary model is defined
spec.summaryModelRef.typestringNoSummary model type: public, user, or group

Runtime Summary Fields

spec.summary is maintained by the system at runtime and is not intended to be authored directly in YAML. Common fields include:

FieldDescription
short_summaryAI-generated short summary
long_summaryAI-generated long summary
manual_long_summaryManually edited knowledge base long summary; takes priority for display and context injection
topicsAI-generated topic tags
statusSummary state: pending, generating, completed, failed
manual_updated_atLast manual summary update time
manual_updated_byLast manual summary editor

Notes:

  • Manual summary does not stop AI summary generation from continuing
  • When manual_long_summary exists, the system uses it first for UI display and chat-context injection
  • After using Restore AI Summary, the system falls back to the latest long_summary

Code wiki fields

A knowledge base with spec.kbType = "code_wiki" is generated by an agent from a source repository. Every field below is written by the system and should not be edited by hand.

FieldTypeDescription
spec.kbTypestringnotebook, classic or code_wiki. Cannot move into or out of code_wiki
spec.source.sourceTypestringgithub, gitlab or gitea
spec.source.sourceUrlstringRepository URL, derived at creation with any credentials stripped
spec.source.projectNamestringowner/repo
spec.source.sourceDomainstringRepository host
spec.publishedGenerationIdintegerSole authority for which version is live; 0 when nothing is
spec.lastPublishedAtstringWhen that version was published, written with the pointer
spec.lastPublishedCommitstringCommit the live version documents
spec.pageOrderarrayPage paths in display order; hierarchy comes from the paths, order only from here
spec.pendingIndexCleanuparrayVector store references owed for removed pages, retried at the next publish

Invariants:

  • publishedGenerationId is the only authority. Never infer the live version from the newest completed generation: one can finish and still be refused by the publish gate.
  • Ownership is the creator, in the default namespace. Owning it is what makes the ordinary knowledge base ACL apply; repository access separately decides who may create one and who may regenerate it.
  • One repository has one wiki, enforced by the UNIQUE on wiki_projects.source_url.
  • Generated pages carry origin = generated; the projection only adds and removes those, so user content is never touched.

🤝 Collaboration

Collaboration defines the interaction patterns and workflows between Bots in a Team.

Complete Configuration Example for ClaudeCode

apiVersion: agent.wecode.io/v1
kind: Collaboration
metadata:
name: workflow-collaboration
namespace: default
spec:
type: "workflow"
config:
steps:
- name: "planning"
participants:
- "planner-bot"
- name: "development"
participants:
- "developer-bot"
- name: "review"
participants:
- "reviewer-bot"

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Collaboration
metadata.namespacestringYesNamespace, typically default
spec.typestringYesCollaboration type
spec.configobjectYesCollaboration configuration

Workflow Configuration

FieldTypeDescription
stepsarrayList of workflow steps
steps.namestringStep name
steps.participantsarrayList of participants

💼 Workspace

Workspace defines the team's working environment, including code repository and branch information.

Complete Configuration Example

apiVersion: agent.wecode.io/v1
kind: Workspace
metadata:
name: project-workspace
namespace: default
spec:
repository:
gitUrl: "https://github.com/user/repo.git"
gitRepo: "{user}/{repo}"
branchName: "main"
gitDomain: "github.com"

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Workspace
metadata.namespacestringYesNamespace, typically default
spec.repositoryobjectYesRepository configuration

Repository Configuration

FieldTypeRequiredDescription
gitUrlstringYesGit repository URL
gitRepostringYesRepository path format
branchNamestringYesDefault branch name
gitDomainstringYesGit domain

🎯 Task

Task defines the task to be executed, associating Team and Workspace.

Complete Configuration Example

apiVersion: agent.wecode.io/v1
kind: Task
metadata:
name: implement-feature
namespace: default
spec:
title: "Implement new feature"
prompt: "Task description"
teamRef:
name: dev-team
namespace: default
workspaceRef:
name: project-workspace
namespace: default
knowledgeBaseScopes:
- id: 101
namespace: default
name: Product Docs
scopeRestricted: true
folderIds: [12]
explicitDocumentIds: null
includeSubfolders: true
externalKnowledgeRefs:
- provider: ap
mode: explicit
id: kb-1
name: External Product Docs
scope: organization
target_type: document
node_id: document:node-1
document_id: node-1
target_name: api-reference.md

Field Description

FieldTypeRequiredDescription
metadata.namestringYesUnique identifier for the Task
metadata.namespacestringYesNamespace, typically default
spec.titlestringYesTask title
spec.promptstringYesTask description
spec.teamRefobjectYesTeam reference
spec.workspaceRefobjectYesWorkspace reference
spec.knowledgeBaseScopesarrayNoKnowledge-base access scopes bound by /api/v1/responses, used to inherit folder/document scope in follow-up turns
spec.externalKnowledgeRefsarrayNoTask-level external knowledge source bindings maintained by chat context selection and the task knowledge management entry

Knowledge Base Scopes

spec.knowledgeBaseScopes is maintained automatically by the OpenAPI Responses knowledge-base tool. When a folder or document scope is enabled, follow-up requests with previous_response_id inherit the scope and re-resolve folder membership for the current turn.

FieldTypeRequiredDescription
idintegerNoKnowledge base ID, preferred when present
namespacestringNoKnowledge base namespace, defaults to default
namestringYesKnowledge base name
scopeRestrictedbooleanNoWhether access is restricted to the listed folders or documents
folderIdsarrayNoAllowed folder IDs. 0 means documents directly under the root folder
explicitDocumentIdsarrayNoExplicitly allowed document IDs
includeSubfoldersbooleanNoWhether folder scope includes subfolders, defaults to true

External Knowledge Source Bindings

spec.externalKnowledgeRefs is a runtime field describing the external knowledge sources bound to the current Task. It is maintained by chat send handling and the task knowledge management APIs. It is not used for Ghost, Bot, or Team default configuration.

FieldTypeRequiredDescription
providerstringYesExternal knowledge provider id
modestringNoBinding mode, defaults to explicit; explicit requires id
idstringConditionallyStable provider-owned source ID
namestringNoSource display name
scopestringNoProvider-interpretable scope
target_typestringNoknowledge_base, folder, or document; missing values are treated as whole-source bindings
node_idstringNoProvider-neutral node ID
document_idstringNoProvider-neutral document ID
parent_idstringNoProvider-neutral parent node ID
target_namestringNoFolder or document target display name

Task Status

StatusDescription
PENDINGWaiting for execution
RUNNINGCurrently executing
COMPLETEDExecution completed
FAILEDExecution failed
CANCELLEDExecution cancelled
DELETETask deleted

🔌 ConnectorApp

ConnectorApp defines an external app connection published by administrators for Wework/Codex. Resources are stored in the kinds table, metadata.name is the app slug, and the current namespace is system. In normal operation, maintain these resources through System Administration → App Connections in Wegent Web instead of hand-writing YAML.

Complete Example

apiVersion: agent.wecode.io/v1
kind: ConnectorApp
metadata:
name: ticket-api
namespace: system
displayName: Ticket API
spec:
name: Ticket API
description: Search and read internal tickets
iconUrl: https://example.com/ticket-icon.png
enabled: true
visibility: roles
allowedRoles:
- admin
authType: none
transport: http
mcpUrl: https://tickets.example.com/api
providerHeadersEncrypted: "base64-encrypted-json"
toolAllowlist:
- get_ticket
httpTools:
- name: get_ticket
description: Get one ticket
method: GET
path: /tickets/{id}
input_schema:
type: object
properties:
id:
type: string
required:
- id
argument_locations:
id: path
timeout_seconds: 30

Field Reference

FieldTypeRequiredDescription
metadata.namestringYesUnique Connector App slug, also used as the tool-name prefix
metadata.namespacestringYesCurrently system
spec.namestringYesDisplay name
spec.descriptionstringNoApp description
spec.iconUrlstringNoIcon URL
spec.enabledbooleanYesWhether the app is enabled; disabled apps are hidden from catalogs/runtime
spec.visibilitystringYesall or roles
spec.allowedRolesarrayNoUser roles allowed when visibility: roles
spec.authTypestringYesCurrently only none is supported
spec.transportstringYesstreamable-http, sse, or http
spec.mcpUrlstringYesMCP endpoint or HTTP API base URL
spec.providerHeadersEncryptedstringNoFixed provider headers JSON encrypted with the project sensitive-data tool
spec.toolAllowlistarrayNoUpstream tool names allowed for discovery and invocation
spec.httpToolsarrayConditionallyRequired for transport: http; maps ordinary HTTP APIs to MCP tools

providerHeadersEncrypted must be an encrypted JSON string. The administrator API accepts plaintext provider_headers and encrypts them before storage; do not commit plaintext API keys, service tokens, or headers in hand-written YAML.


Best Practices

1. Naming Conventions

  • Use lowercase letters, numbers, and hyphens
  • Avoid special characters and spaces
  • Names should be descriptive

2. Namespaces

  • Use default namespace by default
  • Use different namespaces in multi-tenant environments

3. Reference Management

  • Ensure referenced resources exist
  • Use the same namespace
  • Avoid circular references

4. Status Management

  • Regularly check resource status
  • Handle unavailable resources promptly
  • Monitor task execution progress

5. Configuration Validation

  • Use YAML syntax validation tools
  • Check required fields
  • Validate reference relationships