Templates
Templates are reusable agent configurations that help you quickly deploy consistent AI workers across your organization.
What Are Templates?
A template captures an agent's complete configuration:
- System prompt
- Model settings
- Tool configurations
- Memory settings
- Metadata
Think of templates as blueprints for creating agents.
Creating Templates
From an Existing Agent
// Create template from a working agent
const template = await client.templates.create({
name: 'IT Support Agent',
description: 'Standard IT helpdesk agent configuration',
sourceAgentId: 'agent-123'
});
console.log(template.id); // template-abc123
From Scratch
const template = await client.templates.create({
name: 'Customer Support Agent',
description: 'Handles customer inquiries and issues',
config: {
systemPrompt: `You are a customer support agent.
Be helpful, professional, and solution-oriented.`,
model: 'claude-3-5-sonnet-20241022',
temperature: 0.7,
tools: ['memory', 'http_request'],
memory: {
userMemory: { enabled: true, retention: '90d' }
}
}
});
Via Dashboard
- Go to Templates → + Create Template
- Fill in the configuration
- Click Create
Or from an existing agent:
- Go to the agent's page
- Click Actions → Save as Template
- Name and describe the template
Using Templates
Create Agent from Template
const agent = await client.agents.createFromTemplate({
templateId: 'template-123',
name: 'IT Support - New York Office',
teamId: 'team-456',
overrides: {
// Customize the template
systemPrompt: `${template.systemPrompt}
Additional context for New York office:
- Local IT contact: it-ny@acme.com
- Office hours: 9 AM - 6 PM EST`
}
});
Preview Template
// See what the template contains before using
const preview = await client.templates.preview('template-123');
console.log(preview.systemPrompt);
console.log(preview.tools);
console.log(preview.config);
Template Versioning
Create a Version
// Update template and create new version
await client.templates.createVersion({
templateId: 'template-123',
changes: {
systemPrompt: 'Updated prompt...',
tools: ['memory', 'http_request', 'calculator']
},
versionNotes: 'Added calculator tool for pricing calculations'
});
List Versions
const versions = await client.templates.listVersions('template-123');
// [
// { version: '3.0', createdAt: '2024-01-15', notes: 'Added calculator' },
// { version: '2.0', createdAt: '2024-01-01', notes: 'Updated prompt' },
// { version: '1.0', createdAt: '2023-12-01', notes: 'Initial version' }
// ]
Use Specific Version
const agent = await client.agents.createFromTemplate({
templateId: 'template-123',
templateVersion: '2.0', // Use specific version
name: 'Agent from v2'
});
Rollback
// Revert template to previous version
await client.templates.rollback({
templateId: 'template-123',
toVersion: '2.0'
});
Template Categories
Organizing Templates
const template = await client.templates.create({
name: 'HR Onboarding Agent',
category: 'HR',
tags: ['onboarding', 'employee', 'new-hire'],
// ...
});
Browsing by Category
// List templates by category
const hrTemplates = await client.templates.list({
category: 'HR'
});
// Search by tags
const templates = await client.templates.list({
tags: ['onboarding']
});
Template Sharing
Within Organization
// Templates are visible to all workspace members by default
const template = await client.templates.create({
name: 'Shared Template',
visibility: 'workspace', // All workspace members can use
// ...
});
Private Templates
const template = await client.templates.create({
name: 'My Private Template',
visibility: 'private', // Only you can see
// ...
});
Publish to Store
// Share with the Deeployd community
await client.templates.publish({
templateId: 'template-123',
listing: {
title: 'IT Helpdesk Agent',
description: 'Complete IT support agent with common tools',
category: 'IT Support',
pricing: 'free', // or { type: 'paid', price: 9.99 }
screenshots: ['url1', 'url2'],
documentation: 'https://docs.example.com/template'
}
});
Template Variables
Defining Variables
Create templates with customizable variables:
const template = await client.templates.create({
name: 'Support Agent Template',
config: {
systemPrompt: `You are the support agent for {{company_name}}.
Company Information:
- Industry: {{industry}}
- Support Hours: {{support_hours}}
- Escalation Email: {{escalation_email}}`,
},
variables: [
{
name: 'company_name',
description: 'Your company name',
required: true
},
{
name: 'industry',
description: 'Your industry',
default: 'Technology'
},
{
name: 'support_hours',
description: 'Support availability hours',
default: '9 AM - 5 PM'
},
{
name: 'escalation_email',
description: 'Email for escalations',
required: true
}
]
});
Using Variables
const agent = await client.agents.createFromTemplate({
templateId: 'template-123',
name: 'Acme Support',
variables: {
company_name: 'Acme Corporation',
industry: 'Manufacturing',
support_hours: '24/7',
escalation_email: 'support-escalation@acme.com'
}
});
Template Best Practices
1. Clear Naming
// ✅ Good
name: 'IT Helpdesk - Tier 1 Support'
name: 'HR Onboarding Assistant'
name: 'Customer Success - Enterprise'
// ❌ Bad
name: 'Template 1'
name: 'Agent'
name: 'New Template'
2. Comprehensive Descriptions
description: `
IT Helpdesk agent for first-line support.
Capabilities:
- Answer common IT questions
- Guide password resets
- Create support tickets
Integrations Required:
- ServiceNow for ticketing
- Okta for identity verification
Best For:
- Companies with 50-500 employees
- Standard IT stack (Google/Microsoft)
`
3. Document Variables
variables: [
{
name: 'ticketing_system_url',
description: 'URL to your ticketing system (e.g., https://acme.servicenow.com)',
required: true,
example: 'https://yourcompany.servicenow.com'
}
]
4. Version Thoughtfully
// Major version: Breaking changes
await client.templates.createVersion({
templateId: 'template-123',
majorVersion: true,
versionNotes: 'Completely redesigned prompt structure'
});
// Minor version: Enhancements
await client.templates.createVersion({
templateId: 'template-123',
versionNotes: 'Added new troubleshooting steps for VPN'
});
5. Test Before Sharing
// Create test agent
const testAgent = await client.agents.createFromTemplate({
templateId: 'template-123',
name: 'Test Agent'
});
// Run test conversations
const tests = [
'Hello, I need help',
'How do I reset my password?',
'I want to speak to a human'
];
for (const message of tests) {
const response = await client.agents.chat({
agentId: testAgent.id,
message
});
console.log(`Q: ${message}\nA: ${response.content}\n`);
}
Managing Templates
Update Template
await client.templates.update({
templateId: 'template-123',
name: 'Updated Name',
description: 'Updated description',
config: {
// New configuration
}
});
Delete Template
// Soft delete (can be restored)
await client.templates.archive('template-123');
// Permanent delete
await client.templates.delete('template-123');
Export Template
// Export for backup or migration
const exported = await client.templates.export('template-123');
// Save to file
fs.writeFileSync('template-backup.json', JSON.stringify(exported));
Import Template
// Import from exported file
const data = JSON.parse(fs.readFileSync('template-backup.json'));
const template = await client.templates.import(data);
Starter Kits
Templates can be bundled into Starter Kits:
const starterKit = await client.starterKits.create({
name: 'IT Support Starter Kit',
description: 'Complete IT support team setup',
templates: [
'template-triage',
'template-password',
'template-software',
'template-escalation'
],
workflows: ['workflow-ticket-routing'],
documentation: 'https://docs.example.com/it-kit'
});
See Starter Kits for more details.
Next: Explore Digging Deeper for advanced features like tasks, workflows, and automation.