Creating Templates
Beyond using the built-in templates, you can author your own and contribute them to the Xagent community. A template is a YAML file describing an agent's configuration.
Template Structure
id: marketing-content-creator
name: Marketing Content Creator
category: Marketing
featured: false
descriptions:
en: Create marketing content for various channels
zh: 为不同渠道创建营销内容
features:
en:
- Drafts engaging, on-brand copy for social, email, and web
- Adapts tone and style to the target audience
zh:
- 为社交媒体、电子邮件和网站起草引人入胜的品牌文案
- 根据目标受众调整语气和风格
agent_config:
instructions: |
You are a marketing content creator. Create engaging,
on-brand copy for social, email, and web; adapt tone to
the audience; and follow marketing best practices.
skills: []
tool_categories:
- basic
- knowledge
execution_mode: balancedKey Fields
| Field | Notes |
|---|---|
id | Required. Unique, kebab-case identifier. |
name, category | Required. Display name and library category (e.g. Marketing, Sales, Support). |
descriptions.en | Required. English description (zh recommended). |
features | Optional. Per-language bullet lists (en/zh) highlighting what the agent does, shown on the template card. |
instructions | Required. The agent's system prompt — be specific about role, tone, and constraints. |
tool_categories | Optional. Valid values: basic, file, vision, image, audio, knowledge, browser, ppt, agent, mcp, database, skill. Web search tools live under basic. |
execution_mode | Optional. flash, balanced, think, or auto — how aggressively the agent plans and spends compute. Default balanced. |
Test Locally
Drop your YAML file into the templates directory, restart Xagent, then create an agent from it via Build → New Agent and test it against realistic inputs. Confirm the YAML is valid, all required fields are present, and the tools behave as expected.
Contributing
Built-in templates live in the Xagent repository under src/xagent/templates/built_in. To contribute, fork the repo, add your YAML file, test it locally, and open a pull request titled Add template: [Name].
git clone https://github.com/YOUR_USERNAME/xagent.git
cd xagent
# add src/xagent/templates/built_in/my-template.yaml
git add src/xagent/templates/built_in/my-template.yaml
git commit -m "Add template: My Template Name"
git push origin main # then open a PRKeep it focused
Enable only the tools your template needs, write specific instructions with clear boundaries, and use 3–5 descriptive tags so users can discover it.
Next Steps
- Templates → — browse the built-in library
- Building Agents →
- Xagent on GitHub →