Skip to content

Agents

LingXiao’s Agent system is based on the Leader-Worker architecture, where roles (Role) define Agent capabilities, tools, and knowledge.

The Leader is responsible for:

  • Interpreting user goals
  • Maintaining the plan/task DAG
  • Creating and dispatching tasks
  • Supervising worker execution
  • Resolving plan review and user questions
  • Coordinating tool usage and permissions
  • Reacting to health/idle/stall signals

Workers execute assigned tasks. Each worker has:

  • agent_id: unique identifier
  • agent_name: name
  • Role/system prompt
  • Task ID
  • Status
  • Iteration count
  • Conversation history

Workers run through the AgentPool/runtime path. Task execution is worker-owned.

LingXiao includes 13 preset roles:

RoleDescription
architectArchitect, responsible for task decomposition and design
backendBackend developer
frontendFrontend developer
fullstackFull-stack developer
exploreExploration researcher
verifyVerification engineer
docDocumentation engineer
testTest engineer
devopsDevOps engineer
dataData engineer
securitySecurity engineer
ui-designUI designer
refactorRefactoring engineer

Roles are defined via RoleCapabilityModel, containing key fields:

FieldDescription
nameRole name
descriptionRole description
systemPromptSystem prompt
allowedToolsList of allowed tools
requestedToolsList of requested tools
skillNamesBound skill names
suggestedModelSuggested model

Roles come from three sources:

  1. Built-in roles: defined in src/agents/leader/builtinRoles.ts
  2. Dynamic roles: created via define_agent_role at runtime
  3. Web config: overridden via Web roles routes

Steps to add a role:

  1. Define responsibilities
  2. Define system prompt
  3. Define allowed/requested tools
  4. Optionally define skills
  5. Optionally define suggested model

Define custom roles in ~/.lingxiao/settings.json or project-level config:

{
"roles": {
"custom-role": {
"description": "Custom role",
"systemPrompt": "You are an engineer focused on performance optimization",
"allowedTools": ["file_read", "code_search", "shell"],
"skillNames": ["performance-optimization"]
}
}
}

The Leader can dynamically create roles at runtime via define_agent_role:

{
"name": "performance-engineer",
"description": "Performance Engineer",
"systemPrompt": "Focused on code performance analysis and optimization",
"allowedTools": ["file_read", "code_search", "shell", "python_exec"]
}

The role’s allowedTools and requestedTools control tool access:

  • allowedTools: tools the role is explicitly permitted to use
  • requestedTools: tools the role requests but requires Leader approval

Tool permissions are also governed by the permission system (security.permission_mode).

Tasks are stored in the tasks table and managed through TaskBoard:

FieldDescription
idTask ID (e.g., T-1)
session_idSession ID
subjectTask subject
descriptionTask description
statusTask status
blocked_byDependencies
assigned_agentAssigned agent

Worker execution is surfaced through the team runtime:

  • Workers are registered through roles and task bindings
  • Each task is dispatched to one worker owner at a time
  • Worker state, logs, conversations, and completion reports flow through normal agent channels
  • Supervision and intervention use Leader orchestration tools