File size: 7,434 Bytes
4343907
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# =============================================================================
# SAAP - satware AI Autonomous Agent Platform v1.2.0
# Environment Configuration Template with OpenRouter Integration
# =============================================================================
# Copy this file to .env and configure your settings

# =============================================================================
# APPLICATION SETTINGS
# =============================================================================
APP_NAME="SAAP - satware AI Autonomous Agent Platform"
APP_VERSION="1.2.0"
ENVIRONMENT=production
DEBUG=false
HOST=0.0.0.0
PORT=8000
RELOAD=false

# =============================================================================
# 🚀 OPENROUTER INTEGRATION - COST-EFFICIENT MODELS
# =============================================================================

# OpenRouter API Configuration
OPENROUTER_API_KEY=test-key
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1
OPENROUTER_ENABLED=true

# Cost Optimization Settings
OPENROUTER_USE_COST_OPTIMIZATION=true
OPENROUTER_MAX_COST_PER_REQUEST=0.01
OPENROUTER_FALLBACK_TO_FREE=true

# Agent-Specific Model Configuration (Cost-Optimized)
# Jane Alesi - Coordinator & Management
JANE_ALESI_MODEL=openai/gpt-4o-mini
JANE_ALESI_MAX_TOKENS=800
JANE_ALESI_TEMPERATURE=0.7
# Cost: $0.15/1M input tokens, $0.60/1M output tokens

# John Alesi - Development & Code
JOHN_ALESI_MODEL=anthropic/claude-3-haiku
JOHN_ALESI_MAX_TOKENS=1200
JOHN_ALESI_TEMPERATURE=0.5
# Cost: $0.25/1M input tokens, $1.25/1M output tokens

# Lara Alesi - Medical & Analysis
LARA_ALESI_MODEL=openai/gpt-4o-mini
LARA_ALESI_MAX_TOKENS=1000
LARA_ALESI_TEMPERATURE=0.3
# Cost: $0.15/1M input tokens, $0.60/1M output tokens

# Free Model Fallbacks (when budget exceeded)
FALLBACK_MODEL=meta-llama/llama-3.2-3b-instruct:free
ANALYST_MODEL=meta-llama/llama-3.2-3b-instruct:free

# Cost Tracking Configuration
ENABLE_COST_TRACKING=true
COST_ALERT_THRESHOLD=5.0
LOG_PERFORMANCE_METRICS=true
SAVE_COST_ANALYTICS=true

# =============================================================================
# COLOSSUS SERVER (FREE PRIMARY PROVIDER)
# =============================================================================
COLOSSUS_API_BASE=https:
COLOSSUS_API_KEY=test-key
COLOSSUS_DEFAULT_MODEL=mistral-small3.2:24b-instruct-2506
COLOSSUS_TIMEOUT=60
COLOSSUS_MAX_RETRIES=3

# =============================================================================
# AGENT CONFIGURATION - MULTI-PROVIDER STRATEGY
# =============================================================================

# Provider Strategy
PRIMARY_PROVIDER=colossus
FALLBACK_PROVIDER=openrouter
AUTO_FALLBACK_ON_ERROR=true
FALLBACK_TIMEOUT_THRESHOLD=30

# Performance Targets
TARGET_RESPONSE_TIME=2.0
TARGET_COST_PER_REQUEST=0.002
COST_VS_SPEED_PRIORITY=balanced

# Daily Cost Budgets ($USD)
DAILY_COST_BUDGET=10.0
AGENT_COST_BUDGET=2.0
WARNING_COST_THRESHOLD=0.80

# Agent Behavior
DEFAULT_AGENT_TIMEOUT=60
MAX_CONCURRENT_AGENTS=10
AGENT_HEALTH_CHECK_INTERVAL=300

# Smart Cost Management
USE_FREE_MODELS_FIRST=false
SMART_MODEL_SELECTION=true
COST_LEARNING_ENABLED=true

# Message Management
MAX_MESSAGE_HISTORY=1000
CLEANUP_OLD_MESSAGES_DAYS=30

# =============================================================================
# DATABASE CONFIGURATION
# =============================================================================

# Primary Database URL (supports SQLite, PostgreSQL, MySQL)
DATABASE_URL=sqlite:///./saap_production.db

# For PostgreSQL (Production):
# DATABASE_URL=postgresql://username:password@localhost:5432/saap_db

# For MySQL (Alternative):
# DATABASE_URL=mysql://username:password@localhost:3306/saap_db

# Connection Pool Settings
DB_POOL_SIZE=10
DB_MAX_OVERFLOW=20
DB_POOL_TIMEOUT=30
DB_POOL_RECYCLE=3600

# SQLite Specific
SQLITE_CHECK_SAME_THREAD=false

# =============================================================================
# REDIS CONFIGURATION (MESSAGE QUEUE)
# =============================================================================
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
REDIS_MAX_CONNECTIONS=50

# =============================================================================
# SECURITY SETTINGS
# =============================================================================

# Secret Key (CHANGE IN PRODUCTION!)
SECRET_KEY=your-super-secret-key-change-this-in-production-min-32-chars

# JWT Configuration
JWT_ALGORITHM=HS256
JWT_EXPIRE_MINUTES=1440

# Rate Limiting
RATE_LIMIT_REQUESTS=1000
RATE_LIMIT_WINDOW=3600

# CORS Origins (Frontend URLs)
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:8080,http://localhost:3000,https://yourdomain.com

# =============================================================================
# 💰 COST TRACKING & PERFORMANCE LOGGING
# =============================================================================

# General Logging
LOG_LEVEL=INFO
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s

# File Logging
LOG_TO_FILE=true
LOG_FILE_PATH=logs/saap.log
LOG_FILE_MAX_SIZE=10485760
LOG_FILE_BACKUP_COUNT=5

# Cost & Performance Logging
LOG_COST_METRICS=true
COST_LOG_PATH=logs/saap_costs.log
PERFORMANCE_LOG_PATH=logs/saap_performance.log

# =============================================================================
# DEVELOPMENT OVERRIDES
# =============================================================================
# Uncomment for development mode:

# ENVIRONMENT=development
# DEBUG=true
# RELOAD=true
# DATABASE_URL=sqlite:///./saap_dev.db
# LOG_LEVEL=DEBUG

# =============================================================================
# PRODUCTION OPTIMIZATION
# =============================================================================
# For production deployment:

# ENVIRONMENT=production
# DEBUG=false
# DATABASE_URL=postgresql://username:password@localhost:5432/saap_production
# SECRET_KEY=your-production-secret-key-with-proper-randomness
# ALLOWED_ORIGINS=https://yourdomain.com,https://app.yourdomain.com
# DAILY_COST_BUDGET=50.0
# PRIMARY_PROVIDER=openrouter

# =============================================================================
# MONITORING & ANALYTICS
# =============================================================================

# Performance Monitoring
ENABLE_PROMETHEUS_METRICS=false
PROMETHEUS_PORT=9090

# Health Monitoring
HEALTH_CHECK_INTERVAL=60
ENABLE_HEALTH_NOTIFICATIONS=false

# Analytics
TRACK_USAGE_ANALYTICS=true
ANALYTICS_RETENTION_DAYS=90

# =============================================================================
# EXPERIMENTAL FEATURES
# =============================================================================

# Advanced Features (Beta)
ENABLE_AGENT_LEARNING=false
ENABLE_AUTO_SCALING=false
ENABLE_PREDICTIVE_COST_MANAGEMENT=false

# =============================================================================
# NOTES
# =============================================================================
# 1. OpenRouter API Key is pre-configured for development/testing
# 2. colossus server is FREE and used as primary provider
# 3. Daily cost budget of $10 provides ~20,000 tokens with GPT-4o-mini
# 4. Cost tracking logs all expenses with detailed analytics
# 5. Fallback to free models when budget exceeded
# 6. Database supports SQLite (dev) and PostgreSQL (production)
# 7. All sensitive data should be secured in production deployment