Working with Templates¶
This guide explains how to work with ARIA templates effectively.
What are Templates?¶
Templates are pre-defined policy configurations that help you: - Start quickly with common scenarios - Maintain consistency across policies - Follow best practices - Create both capability-based and model-based policies
Template Formats¶
ARIA supports two template formats that correspond to the two policy formats:
Capability-Based Templates¶
- Focus on specific AI capabilities
- Clear conditions and restrictions
- Simplified structure for non-technical users
- Ideal for testing and development
Model-Based Templates¶
- Focus on model types and path-specific rules
- Integration with code repositories
- More granular control over permissions
- Ideal for production environments
Available Templates¶
chat_assistant
(Capability-based)- Basic chat functionality
- Safety guardrails
- Error handling
-
Text generation capabilities
-
code_assistant
(Model-based) - Code analysis
- Generation capabilities
- Security checks
-
Path-specific permissions
-
review_assistant
(Model-based) - Code review capabilities
- Documentation generation
- Restricted modification permissions
-
Path-specific rules
-
custom_assistant
(Both formats) - Fully customizable
- Advanced features
- Special use cases
- Support for both policy formats
Using Templates¶
# List available templates
aria list-templates
# Apply a template (capability-based)
aria apply chat_assistant -o policy.yml
# Apply a template (model-based)
aria apply code_assistant -o code-policy.yml
# Apply with parameters
aria apply chat_assistant --param safety_level=high -o policy.yml
# Customize a template
aria customize chat_assistant -o custom.yml
Template Structure¶
Capability-Based Template Structure¶
name: template_name
version: 1.0.0
description: Template purpose
type: capability
parameters:
- name: param1
type: string
description: Parameter description
required: true
default: default_value
options:
- option1
- option2
capabilities:
- name: capability_name
description: Capability description
allowed: true
conditions:
- Condition text
restrictions:
- Restriction text
Model-Based Template Structure¶
name: template_name
version: 1.0.0
description: Template purpose
type: model
parameters:
- name: param1
type: string
description: Parameter description
required: true
default: default_value
model: assistant
defaults:
allow:
- review
- suggest
require:
- human_review
paths:
"src/**/*.py":
allow:
- generate
- modify
require:
- unit_tests
Customizing Templates¶
Templates can be customized in several ways:
-
Parameter Customization: Provide parameter values when applying a template
-
Template Modification: Create a modified version of an existing template
-
Template Inheritance: Create a new template that inherits from an existing one
Best Practices¶
- Choose the appropriate template format for your use case
- Capability-based for testing and human-readable policies
- Model-based for production and integration with code repositories
- Version your templates
- Document customizations
- Test before deployment
- Keep templates simple and focused
- Use parameters for customization points
- Validate templates before sharing