Whether you're new to OpenClaw or a seasoned user, these best practices will help you get the most out of your AI assistant.
Performance Optimization
1. Choose the Right Model
Don't use premium models for simple tasks:
``json
// For simple Q&A
{
"agent": {
"model": "gpt-5-3-codex"
}
}
// For complex reasoning
{
"agent": {
"model": "claude-4-5-sonnet"
}
}
`
2. Implement Caching
Reduce API calls and costs:
`json
{
"caching": {
"enabled": true,
"ttl": 3600,
"maxSize": "100MB"
}
}
`
3. Use Context Wisely
Keep system prompts focused:
Good:
`
You are a technical support assistant. Help users with code issues.
`
Avoid:
`
You are a very helpful assistant that can do many things including...
`
Cost Management
1. Set Usage Limits
Prevent unexpected costs:
`json
{
"limits": {
"messagesPerMinute": 10,
"messagesPerHour": 500,
"maxTokensPerDay": 100000,
"monthlyBudget": 50
}
}
`
2. Monitor Usage
Track spending with built-in analytics:
`bash
openclaw stats
`
3. Use Budget Alerts
`json
{
"alerts": {
"budgetWarning": 0.8,
"budgetExceeded": 1.0
}
}
`
User Experience
1. Clear Onboarding
Welcome new users:
`json
{
"onboarding": {
"welcomeMessage": "Hi! I'm your AI assistant. Ask me anything!",
"helpCommand": "Type !help for available commands"
}
}
`
2. Fallback Responses
Handle errors gracefully:
`json
{
"fallback": {
"onError": "I encountered an error. Please try again.",
"onUnknown": "I'm not sure how to help with that. Try !help."
}
}
`
3. Response Formatting
Use structured responses when helpful:
`
Summary
[AI response here]
Next Steps
- [Step 1]
- [Step 2]
`
Security
1. Environment Variables
Never hardcode secrets:
`bash
# .env file
ANTHROPIC_API_KEY=sk-ant-xxx
OPENAI_API_KEY=sk-xxx
`
2. Access Control
Restrict who can use your assistant:
`json
{
"channels": {
"telegram": {
"allowFrom": ["user_id_1", "user_id_2"]
}
}
}
`
3. Regular Updates
Stay secure:
`bash
openclaw update
`
Reliability
1. Health Checks
Monitor your assistant:
`json
{
"monitoring": {
"healthCheck": {
"enabled": true,
"interval": 60
}
}
}
`
2. Error Recovery
Configure automatic recovery:
`json
{
"recovery": {
"autoRestart": true,
"maxRetries": 3,
"retryDelay": 5000
}
}
`
3. Backups
Regularly backup configuration:
`bash
openclaw config export
``
Maintenance
Regular Tasks
- Weekly: Review usage stats
- Monthly: Analyze costs and optimize
- Quarterly: Review and update system prompts
Monitoring Checklist
- [ ] Check error rates
- [ ] Review response times
- [ ] Verify uptime
- [ ] Analyze user feedback
Conclusion
Following these best practices will help you create a reliable, cost-effective, and user-friendly AI assistant. Start implementing these today and see the difference.
Remember: The best AI assistant is one that serves your specific needs while staying within budget and maintaining security.