Creating Templates
Create and contribute your own templates to share with the Xagent community.Template Structure
Templates are defined as YAML files with the following structure:Template Fields
Metadata
id (Required)- Unique identifier for the template
- Use kebab-case (e.g.,
customer-support-agent) - Must be unique across all templates
- Display name shown in the template library
- Use clear, descriptive names
- Maximum 200 characters
- Template category for organization
- Common categories:
- Customer Service
- General & Productivity
- Finance, LMS & Ops
- Healthcare & Fitness
- Security
- List of searchable tags
- Help users discover your template
- Use lowercase, hyphenated tags
- Multi-language descriptions
- en (English) is required
- zh (Chinese) is recommended
- Keep descriptions concise and clear
- Set to
truefor highlighted templates - Default:
false - Featured templates are shown prominently
- Template author or organization
- Default: “Xagent”
- Template version
- Follow semantic versioning (e.g., “1.0”, “1.1”, “2.0”)
- Default: “1.0”
Agent Configuration
instructions (Required)- System prompt defining the agent’s role and behavior
- Be specific about what the agent should do
- Include guidelines for tone, approach, and constraints
- List of pre-built skill IDs
- Leave empty if no skills needed
- Default:
[]
- List of tool categories to enable:
basic- Basic tools (web search, calculator)file- File upload and managementvision- Image understandingimage- Image generation and editingknowledge- Knowledge base operationsmcp- MCP protocol toolsbrowser- Browser automationppt- PowerPoint processingoffice- Office document processingspecial_image- Special image processing
- Default:
[]
react- ReAct loop (reasoning → acting)graph- DAG planning-execution- Default:
"react"
Creating a Template
Step 1: Design Your Template
Before writing the YAML, plan your template:- Identify the use case - What problem does it solve?
- Define the agent’s role - What should it do?
- Determine required tools - What tools does it need?
- Choose execution mode - React or Graph?
Step 2: Create the YAML File
Create a new YAML file with your template definition:Step 3: Test Your Template
Before contributing, test your template:-
Local Testing
- Add your YAML file to the templates directory
- Restart Xagent
- Create an agent from your template
- Test with various inputs
- Verify behavior matches expectations
-
Validation Checklist
- YAML syntax is valid
- All required fields are present
- Instructions are clear and specific
- Tools work as expected
- Template solves the intended problem
Contributing Templates
Templates are maintained in the Xagent repository. To contribute your template:Step 1: Fork the Repository
Step 2: Add Your Template
Place your YAML file in the templates directory:Step 3: Test Locally
Test your template in your local Xagent instance:- Start Xagent
- Go to Build page
- Click New Agent
- Find your template in the library
- Create an agent and test it
Step 4: Submit a Pull Request
PR Guidelines
Title Format- Maintainers will review your template
- Feedback will be provided if changes are needed
- Once approved, your template will be merged
- Templates are released with Xagent updates
Best Practices
Instructions
- Be Specific - Clearly define the agent’s role and behavior
- Include Guidelines - Specify tone, approach, and constraints
- Set Boundaries - Explain what the agent should not do
- Provide Examples - Include example behaviors in instructions
Tool Selection
- Minimal Tools - Only enable tools the template needs
- Clear Purpose - Each tool should have a clear use case
- Test Tools - Verify tools work as expected
Categories and Tags
- Choose Appropriate Category - Match existing categories when possible
- Use Descriptive Tags - Help users discover your template
- Avoid Over-tagging - 3-5 relevant tags are sufficient
Documentation
- Clear Descriptions - Explain what the template does
- Multi-language - Include both English and Chinese
- Concise - Keep descriptions brief but informative
Template Examples
Simple Template
Advanced Template
Resources
- Xagent Repository - Source code
- Built-in Templates - Example templates
- Building Agents - Agent configuration guide
- Contributing Guidelines - Contribution guidelines
Next Steps
- Templates - Browse available templates
- Building Agents - Learn about agent configuration
- Xagent GitHub - Contribute to the project