The Rules Management API enables you to create, manage, and apply reusable behavior rules across your AI assistants, users, models, and other entities in the Freddy platform.
Rules are reusable instructions or guidelines that define how AI models should behave, respond, or process information. They can be attached to multiple entities and applied with configurable priority and character limits.
Apply the same professional communication standards to all customer-facing assistants in your organization.
Enforce safety guidelines and compliance requirements across all AI interactions.
Maintain consistent brand voice, tone, and formatting across different AI applications.
Apply different rules based on the entity type (assistant, user, model) with priority-based ordering.
Share rules with team members using three-tier access control (owner, edit, view).
- Safety: Safety and compliance rules
- Professional: Professional conduct and tone
- Creative: Creative writing and style
- Technical: Technical guidelines and constraints
- Custom: Organization-specific rules
- Behavior: Behavioral guidelines
- Guardrails: Safety and boundary rules
- Formatting: Formatting and style rules
- Context: Context-specific rules
- Content Policy: Content policy rules
- Constraint: Constraint rules
Rules can be attached to multiple entity types:
- assistant - Apply rules to specific AI assistants
- vector_store - Apply rules to vector stores for RAG contexts
- user - Apply rules to individual users
- model - Apply rules to specific AI models
- organization - Apply rules organization-wide
Each attachment is independent and can have its own priority and character limit settings.
Rules are applied in priority order (1-100 scale, higher first):
- 90-100: Critical safety rules (applied first)
- 70-89: High priority (compliance, security)
- 50-69: Standard priority (default range)
- 30-49: Low priority
- 1-29: Optional/supplementary rules
When multiple rules have the same priority, they are ordered by attachment timestamp.
Each attachment can have a character limit (100-50,000) to control how much rule content is included in the context. This helps manage:
- Token usage and costs
- Context window size
- Performance optimization
Rules and attachments can be toggled active/inactive without deletion:
- Temporarily disable rules for testing
- Seasonal or conditional rule activation
- A/B testing different rule configurations
Owner
- Full control including delete
- Manage access rights
- Modify content and settings
Edit
- View and modify rule content
- Update rule settings
- Cannot delete or manage access
View
- Read-only access
- Cannot modify or delete
- Organization-specific
- Only accessible to organization members
- Default setting
- Discoverable by all authenticated users
- Can be used across organizations
- Great for sharing best practices
The fastest way to deploy a rule is to create it with attachments in a single request:
curl -X POST https://api.aitronos.com/v1/organizations/org_123/rules \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Professional Communication",
"content": "Always maintain a professional and courteous tone in all communications. Use formal language and avoid slang.",
"description": "Ensures professional communication standards",
"category": "professional",
"rule_type": "behavior",
"scope": "organization",
"is_active": true,
"attachments": [
{
"entity_type": "assistant",
"entity_id": "asst_abc123",
"priority": 80,
"character_limit": 1000
},
{
"entity_type": "vector_store",
"entity_id": "vs_def456",
"priority": 70
}
]
}'This creates the rule and attaches it to multiple entities atomically in a single transaction.
curl -X POST https://api.aitronos.com/v1/organizations/org_123/rules \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Safety Guidelines",
"content": "Never share customer personal information. Always verify identity before discussing account details.",
"category": "safety",
"rule_type": "guardrails"
}'curl -X POST https://api.aitronos.com/v1/rules/rule_abc/attachments \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"entity_type": "assistant",
"entity_id": "asst_123",
"priority": 80,
"character_limit": 2000
}'curl -X POST https://api.aitronos.com/v1/rules/rule_abc/access \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_id": "usr_teammate",
"access_level": "edit"
}'curl https://api.aitronos.com/v1/rules/entities/assistant/asst_123/rules \
-H "X-API-Key: $FREDDY_API_KEY"Create a rule and attach it to multiple assistants in one request:
curl -X POST https://api.aitronos.com/v1/organizations/org_123/rules \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Service Standards",
"content": "Be empathetic, professional, and solution-focused...",
"category": "professional",
"attachments": [
{"entity_type": "assistant", "entity_id": "asst_support", "priority": 80},
{"entity_type": "assistant", "entity_id": "asst_sales", "priority": 75},
{"entity_type": "assistant", "entity_id": "asst_billing", "priority": 80}
]
}'Update rule content (increments version automatically):
curl -X PUT https://api.aitronos.com/v1/organizations/org_123/rules/rule_abc \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Updated rule content with new guidelines..."
}'Disable without deleting:
curl -X PUT https://api.aitronos.com/v1/organizations/org_123/rules/rule_abc \
-H "X-API-Key: $FREDDY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"is_active": false}'curl https://api.aitronos.com/v1/rules/entities/assistant/asst_123/rules \
-H "X-API-Key: $FREDDY_API_KEY"curl "https://api.aitronos.com/v1/organizations/org_123/rules?category=safety&is_active=true" \
-H "X-API-Key: $FREDDY_API_KEY"- Keep rules focused and specific (single responsibility)
- Use descriptive names that indicate purpose
- Add detailed descriptions for team collaboration
- Set appropriate categories and types for filtering
- Keep content under 10,000 characters for optimal performance
- 90-100: Critical safety and compliance rules
- 70-89: High priority behavior and guardrails
- 50-69: Standard guidelines and formatting
- 30-49: Optional style preferences
- 1-29: Supplementary context
- Use character limits to control token usage
- Attach rules during creation for atomic deployment
- Use entity-specific priorities for fine-grained control
- Toggle inactive for temporary changes
- Grant minimum necessary access level
- Maintain at least one owner per rule
- Use edit access for content collaborators
- Use view access for stakeholders
- Regularly audit access rights
- Use character limits to manage context size
- Filter by category/type to reduce list sizes
- Use pagination for large rule sets
- Toggle inactive instead of deleting
- Monitor usage statistics
- Document changes in description field
- Test updates in staging before production
- Use duplicate feature for major changes
- Monitor version numbers for tracking
For detailed API documentation, see:
- 100 requests per minute per user
- 1000 requests per hour per organization
For questions or issues with Rules Management:
- Visit Freddy Hub
- Check the API Reference