proagents 1.6.16 → 1.6.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.claude/settings.local.json +169 -0
  2. package/COMMANDS.md +595 -0
  3. package/README.md +22 -64
  4. package/bin/proagents.js +0 -2
  5. package/lib/commands/init.js +4 -174
  6. package/package.json +2 -7
  7. package/.proagents/ai-models/README.md +0 -141
  8. package/.proagents/ai-models/cost-management.md +0 -362
  9. package/.proagents/ai-models/fallbacks.md +0 -342
  10. package/.proagents/ai-models/model-config.md +0 -318
  11. package/.proagents/ai-models/task-routing.md +0 -503
  12. package/.proagents/ai-training/README.md +0 -155
  13. package/.proagents/ai-training/continuous-learning.md +0 -413
  14. package/.proagents/ai-training/domain-knowledge.md +0 -378
  15. package/.proagents/ai-training/pattern-learning.md +0 -455
  16. package/.proagents/ai-training/training-data.md +0 -337
  17. package/.proagents/ai-training/user-preferences.md +0 -346
  18. package/.proagents/approval-workflows/README.md +0 -146
  19. package/.proagents/approval-workflows/approval-config.md +0 -332
  20. package/.proagents/approval-workflows/approval-stages.md +0 -503
  21. package/.proagents/approval-workflows/emergency-bypass.md +0 -351
  22. package/.proagents/approval-workflows/examples.md +0 -859
  23. package/.proagents/approval-workflows/notifications.md +0 -320
  24. package/.proagents/compliance/README.md +0 -206
  25. package/.proagents/compliance/access-control.md +0 -310
  26. package/.proagents/compliance/audit-logging.md +0 -444
  27. package/.proagents/compliance/compliance-frameworks.md +0 -429
  28. package/.proagents/compliance/reports.md +0 -491
  29. package/.proagents/compliance/retention-policies.md +0 -454
  30. package/.proagents/config-versioning/README.md +0 -120
  31. package/.proagents/config-versioning/changelog.md +0 -300
  32. package/.proagents/config-versioning/rollback.md +0 -283
  33. package/.proagents/config-versioning/versioning.md +0 -330
  34. package/.proagents/contract-testing/README.md +0 -223
  35. package/.proagents/contract-testing/contract-testing.md +0 -614
  36. package/.proagents/contract-testing/pact-integration.md +0 -507
  37. package/.proagents/contract-testing/schema-validation.md +0 -565
  38. package/.proagents/dependency-management/README.md +0 -140
  39. package/.proagents/dependency-management/automation.md +0 -363
  40. package/.proagents/dependency-management/compatibility.md +0 -319
  41. package/.proagents/dependency-management/security-scanning.md +0 -413
  42. package/.proagents/dependency-management/update-policies.md +0 -374
  43. package/.proagents/disaster-recovery/README.md +0 -247
  44. package/.proagents/disaster-recovery/automation.md +0 -366
  45. package/.proagents/disaster-recovery/backup-recovery.md +0 -571
  46. package/.proagents/disaster-recovery/incident-response.md +0 -565
  47. package/.proagents/disaster-recovery/rollback-procedures.md +0 -499
  48. package/.proagents/disaster-recovery/runbooks.md +0 -603
  49. package/.proagents/disaster-recovery/scenarios.md +0 -892
  50. package/.proagents/disaster-recovery/testing.md +0 -438
  51. package/.proagents/environments/README.md +0 -244
  52. package/.proagents/environments/configuration.md +0 -437
  53. package/.proagents/environments/promotion.md +0 -434
  54. package/.proagents/environments/setup.md +0 -420
  55. package/.proagents/examples/README.md +0 -55
  56. package/.proagents/examples/backend-nodejs/README.md +0 -188
  57. package/.proagents/examples/backend-nodejs/complete-conversation.md +0 -601
  58. package/.proagents/examples/backend-nodejs/proagents.config.yaml +0 -415
  59. package/.proagents/examples/backend-nodejs/workflow-example.md +0 -909
  60. package/.proagents/examples/fullstack-nextjs/README.md +0 -155
  61. package/.proagents/examples/fullstack-nextjs/complete-conversation.md +0 -604
  62. package/.proagents/examples/fullstack-nextjs/proagents.config.yaml +0 -287
  63. package/.proagents/examples/fullstack-nextjs/workflow-example.md +0 -553
  64. package/.proagents/examples/mobile-react-native/README.md +0 -171
  65. package/.proagents/examples/mobile-react-native/complete-conversation.md +0 -825
  66. package/.proagents/examples/mobile-react-native/proagents.config.yaml +0 -330
  67. package/.proagents/examples/mobile-react-native/workflow-example.md +0 -723
  68. package/.proagents/examples/web-frontend-react/README.md +0 -125
  69. package/.proagents/examples/web-frontend-react/complete-conversation.md +0 -556
  70. package/.proagents/examples/web-frontend-react/proagents.config.yaml +0 -183
  71. package/.proagents/examples/web-frontend-react/workflow-example.md +0 -603
  72. package/.proagents/existing-projects/README.md +0 -65
  73. package/.proagents/existing-projects/challenges.md +0 -861
  74. package/.proagents/existing-projects/coexistence-mode.md +0 -483
  75. package/.proagents/existing-projects/compatibility-assessment.md +0 -541
  76. package/.proagents/existing-projects/gradual-adoption.md +0 -515
  77. package/.proagents/existing-projects/migration-strategies.md +0 -788
  78. package/.proagents/existing-projects/pattern-reconciliation.md +0 -489
  79. package/.proagents/existing-projects/team-onboarding.md +0 -617
  80. package/.proagents/existing-projects/technical-debt-handling.md +0 -644
  81. package/.proagents/feature-flags/README.md +0 -263
  82. package/.proagents/feature-flags/ab-testing.md +0 -413
  83. package/.proagents/feature-flags/configuration.md +0 -420
  84. package/.proagents/feature-flags/kill-switches.md +0 -444
  85. package/.proagents/feature-flags/rollout-strategies.md +0 -392
  86. package/.proagents/history.log +0 -12
  87. package/.proagents/i18n/README.md +0 -133
  88. package/.proagents/i18n/extraction.md +0 -433
  89. package/.proagents/i18n/tms-integration.md +0 -332
  90. package/.proagents/i18n/translation-workflow.md +0 -413
  91. package/.proagents/i18n/validation.md +0 -355
  92. package/.proagents/logging/README.md +0 -276
  93. package/.proagents/logging/aggregation.md +0 -475
  94. package/.proagents/logging/log-levels.md +0 -376
  95. package/.proagents/logging/sensitive-data.md +0 -423
  96. package/.proagents/logging/structured-logging.md +0 -406
  97. package/.proagents/metrics/README.md +0 -69
  98. package/.proagents/metrics/code-quality-kpis.md +0 -461
  99. package/.proagents/metrics/deployment-metrics.md +0 -517
  100. package/.proagents/metrics/developer-productivity.md +0 -368
  101. package/.proagents/metrics/learning-effectiveness.md +0 -478
  102. package/.proagents/migrations/README.md +0 -77
  103. package/.proagents/migrations/from-claude-projects.md +0 -313
  104. package/.proagents/migrations/from-cursor-rules.md +0 -345
  105. package/.proagents/migrations/from-custom-workflows.md +0 -410
  106. package/.proagents/monitoring/README.md +0 -308
  107. package/.proagents/monitoring/alerting.md +0 -449
  108. package/.proagents/monitoring/dashboards.md +0 -454
  109. package/.proagents/monitoring/health-checks.md +0 -436
  110. package/.proagents/monitoring/metrics.md +0 -434
  111. package/.proagents/multi-project/README.md +0 -170
  112. package/.proagents/multi-project/coordinated-deploy.md +0 -510
  113. package/.proagents/multi-project/cross-project-deps.md +0 -395
  114. package/.proagents/multi-project/unified-changelog.md +0 -477
  115. package/.proagents/multi-project/walkthroughs/monorepo-setup.md +0 -787
  116. package/.proagents/multi-project/workspace-config.md +0 -408
  117. package/.proagents/notifications/README.md +0 -151
  118. package/.proagents/notifications/channels.md +0 -457
  119. package/.proagents/notifications/preferences.md +0 -415
  120. package/.proagents/notifications/routing.md +0 -449
  121. package/.proagents/notifications/scheduling.md +0 -425
  122. package/.proagents/notifications/templates.md +0 -446
  123. package/.proagents/offline-mode/README.md +0 -145
  124. package/.proagents/offline-mode/caching.md +0 -344
  125. package/.proagents/offline-mode/offline-operations.md +0 -312
  126. package/.proagents/offline-mode/queue-specifications.md +0 -679
  127. package/.proagents/offline-mode/sync.md +0 -475
  128. package/.proagents/parallel-features/README.md +0 -85
  129. package/.proagents/parallel-features/conflict-detection.md +0 -226
  130. package/.proagents/parallel-features/dependency-management.md +0 -392
  131. package/.proagents/parallel-features/merge-coordination.md +0 -506
  132. package/.proagents/parallel-features/tracking-system.md +0 -416
  133. package/.proagents/performance/README.md +0 -59
  134. package/.proagents/performance/bundle-analysis.md +0 -375
  135. package/.proagents/performance/load-testing.md +0 -563
  136. package/.proagents/performance/runtime-metrics.md +0 -489
  137. package/.proagents/performance/web-vitals.md +0 -425
  138. package/.proagents/plugins/README.md +0 -139
  139. package/.proagents/plugins/creating-plugins.md +0 -504
  140. package/.proagents/plugins/plugin-api.md +0 -467
  141. package/.proagents/plugins/plugin-registry.md +0 -276
  142. package/.proagents/reporting/README.md +0 -158
  143. package/.proagents/reporting/dashboards.md +0 -366
  144. package/.proagents/reporting/exports.md +0 -524
  145. package/.proagents/reporting/quality-metrics.md +0 -385
  146. package/.proagents/reporting/templates/README.md +0 -56
  147. package/.proagents/reporting/templates/dashboard-config.json +0 -187
  148. package/.proagents/reporting/templates/metrics-queries.md +0 -427
  149. package/.proagents/reporting/templates/react-dashboard.tsx +0 -544
  150. package/.proagents/reporting/templates/widgets.md +0 -451
  151. package/.proagents/reporting/velocity-metrics.md +0 -340
  152. package/.proagents/reverse-engineering/README.md +0 -151
  153. package/.proagents/reverse-engineering/architecture-extraction.md +0 -325
  154. package/.proagents/reverse-engineering/code-analysis.md +0 -377
  155. package/.proagents/reverse-engineering/dependency-mapping.md +0 -567
  156. package/.proagents/reverse-engineering/diagram-generation.md +0 -586
  157. package/.proagents/reverse-engineering/documentation-generation.md +0 -468
  158. package/.proagents/reverse-engineering/pattern-detection.md +0 -569
  159. package/.proagents/reverse-engineering/quality-assessment.md +0 -733
  160. package/.proagents/secrets/README.md +0 -278
  161. package/.proagents/secrets/access-control.md +0 -443
  162. package/.proagents/secrets/rotation.md +0 -403
  163. package/.proagents/secrets/scanning.md +0 -487
  164. package/.proagents/secrets/storage.md +0 -394
  165. package/.proagents/webhooks/README.md +0 -126
  166. package/.proagents/webhooks/endpoints.md +0 -298
  167. package/.proagents/webhooks/events.md +0 -316
  168. package/.proagents/webhooks/payloads.md +0 -325
  169. package/.proagents/webhooks/reliability.md +0 -363
  170. package/.proagents/webhooks/security.md +0 -380
@@ -1,362 +0,0 @@
1
- # Cost Management
2
-
3
- Manage and optimize AI model costs.
4
-
5
- ---
6
-
7
- ## Overview
8
-
9
- Track and control AI usage costs to stay within budget.
10
-
11
- ```
12
- ┌─────────────────────────────────────────────────────────────┐
13
- │ Cost Management │
14
- ├─────────────────────────────────────────────────────────────┤
15
- │ │
16
- │ Usage Tracking ──► Cost Calculation ──► Budget Control │
17
- │ │ │ │ │
18
- │ ▼ ▼ ▼ │
19
- │ Token Counting Rate Application Alerts/Limits │
20
- │ Request Logging Provider Totals Fallback Logic │
21
- │ │
22
- └─────────────────────────────────────────────────────────────┘
23
- ```
24
-
25
- ---
26
-
27
- ## Cost Configuration
28
-
29
- ### Budget Limits
30
-
31
- ```yaml
32
- ai:
33
- cost:
34
- # Daily spending limit
35
- daily_limit: 50.00
36
-
37
- # Weekly limit
38
- weekly_limit: 250.00
39
-
40
- # Monthly limit
41
- monthly_limit: 1000.00
42
-
43
- # Alert thresholds (percentage of limit)
44
- alerts:
45
- - threshold: 50
46
- action: "notify"
47
- - threshold: 80
48
- action: "notify"
49
- - threshold: 100
50
- action: "block_or_fallback"
51
-
52
- # On limit reached
53
- on_limit:
54
- action: "fallback" # or "block"
55
- fallback_model: "claude-3-haiku"
56
- ```
57
-
58
- ### Per-Team Budgets
59
-
60
- ```yaml
61
- ai:
62
- cost:
63
- team_budgets:
64
- frontend:
65
- daily: 20.00
66
- monthly: 400.00
67
-
68
- backend:
69
- daily: 25.00
70
- monthly: 500.00
71
-
72
- mobile:
73
- daily: 15.00
74
- monthly: 300.00
75
- ```
76
-
77
- ---
78
-
79
- ## Pricing Reference
80
-
81
- ### Claude Models (Anthropic)
82
-
83
- | Model | Input (/1M tokens) | Output (/1M tokens) |
84
- |-------|-------------------|---------------------|
85
- | Opus | $15.00 | $75.00 |
86
- | Sonnet | $3.00 | $15.00 |
87
- | Haiku | $0.25 | $1.25 |
88
-
89
- ### GPT Models (OpenAI)
90
-
91
- | Model | Input (/1M tokens) | Output (/1M tokens) |
92
- |-------|-------------------|---------------------|
93
- | GPT-4 Turbo | $10.00 | $30.00 |
94
- | GPT-4 | $30.00 | $60.00 |
95
- | GPT-3.5 | $0.50 | $1.50 |
96
-
97
- ### Gemini Models (Google)
98
-
99
- | Model | Input (/1M tokens) | Output (/1M tokens) |
100
- |-------|-------------------|---------------------|
101
- | Gemini Pro | $0.50 | $1.50 |
102
- | Gemini Ultra | $7.00 | $21.00 |
103
-
104
- ---
105
-
106
- ## Usage Tracking
107
-
108
- ### View Current Usage
109
-
110
- ```bash
111
- # Show today's usage
112
- proagents ai usage
113
-
114
- # Show weekly usage
115
- proagents ai usage --period week
116
-
117
- # Show by project
118
- proagents ai usage --by project
119
-
120
- # Show by model
121
- proagents ai usage --by model
122
- ```
123
-
124
- ### Usage Dashboard
125
-
126
- ```
127
- ┌─────────────────────────────────────────────────────────────┐
128
- │ AI Usage - January 2024 │
129
- ├─────────────────────────────────────────────────────────────┤
130
- │ │
131
- │ Today's Spend: $12.45 / $50.00 │
132
- │ ████████████░░░░░░░░░░░░░░ 25% │
133
- │ │
134
- │ This Month: $234.56 / $1000.00 │
135
- │ ████████░░░░░░░░░░░░░░░░░░ 23% │
136
- │ │
137
- │ By Model: │
138
- │ ├── claude-3-sonnet: $156.78 (67%) │
139
- │ ├── claude-3-opus: $45.23 (19%) │
140
- │ ├── claude-3-haiku: $18.90 (8%) │
141
- │ └── gpt-4: $13.65 (6%) │
142
- │ │
143
- │ By Task: │
144
- │ ├── Code Analysis: $89.45 │
145
- │ ├── Code Generation: $78.34 │
146
- │ ├── Documentation: $34.56 │
147
- │ └── Quick Tasks: $32.21 │
148
- │ │
149
- │ Tokens Used: │
150
- │ ├── Input: 2.3M tokens │
151
- │ └── Output: 890K tokens │
152
- │ │
153
- └─────────────────────────────────────────────────────────────┘
154
- ```
155
-
156
- ---
157
-
158
- ## Cost Optimization
159
-
160
- ### Smart Model Selection
161
-
162
- ```yaml
163
- ai:
164
- optimization:
165
- # Use cheaper models for simple tasks
166
- auto_downgrade:
167
- enabled: true
168
- rules:
169
- - task_type: "simple"
170
- prefer: "haiku"
171
- - task_type: "medium"
172
- prefer: "sonnet"
173
- - task_type: "complex"
174
- prefer: "opus"
175
-
176
- # Estimate before execution
177
- estimate_first: true
178
- confirm_expensive: true # Confirm if > $1
179
- ```
180
-
181
- ### Caching
182
-
183
- ```yaml
184
- ai:
185
- caching:
186
- enabled: true
187
- ttl: "24h"
188
-
189
- # Cache identical requests
190
- request_cache: true
191
-
192
- # Cache code analysis
193
- analysis_cache: true
194
- analysis_ttl: "7d"
195
- ```
196
-
197
- ### Token Optimization
198
-
199
- ```yaml
200
- ai:
201
- optimization:
202
- # Compress context when possible
203
- compress_context: true
204
-
205
- # Truncate long files
206
- max_file_tokens: 10000
207
-
208
- # Summarize instead of full context
209
- use_summaries: true
210
- ```
211
-
212
- ---
213
-
214
- ## Cost Alerts
215
-
216
- ### Configuration
217
-
218
- ```yaml
219
- ai:
220
- alerts:
221
- cost:
222
- - name: "Daily 50%"
223
- condition: "daily_spend >= daily_limit * 0.5"
224
- channels: ["slack"]
225
-
226
- - name: "Daily 80%"
227
- condition: "daily_spend >= daily_limit * 0.8"
228
- channels: ["slack", "email"]
229
-
230
- - name: "Daily Limit"
231
- condition: "daily_spend >= daily_limit"
232
- channels: ["slack", "email", "sms"]
233
- action: "fallback_to_cheaper"
234
-
235
- - name: "Monthly 90%"
236
- condition: "monthly_spend >= monthly_limit * 0.9"
237
- channels: ["email"]
238
- action: "notify_admin"
239
- ```
240
-
241
- ### Alert Example
242
-
243
- ```
244
- 🔔 AI Cost Alert
245
-
246
- Daily spend has reached 80% of limit.
247
-
248
- Current: $40.12 / $50.00
249
- Remaining: $9.88
250
-
251
- Top Consumers:
252
- • Code analysis: $18.45
253
- • Feature implementation: $12.34
254
-
255
- Recommendation: Consider using Haiku for remaining tasks today.
256
-
257
- [View Details] [Adjust Limit]
258
- ```
259
-
260
- ---
261
-
262
- ## Cost Reports
263
-
264
- ### Generate Report
265
-
266
- ```bash
267
- # Monthly cost report
268
- proagents ai report --period month
269
-
270
- # Export to CSV
271
- proagents ai report --format csv --output costs.csv
272
- ```
273
-
274
- ### Report Contents
275
-
276
- ```markdown
277
- # AI Cost Report - January 2024
278
-
279
- ## Summary
280
- - Total Spend: $845.67
281
- - Budget: $1000.00
282
- - Remaining: $154.33
283
-
284
- ## By Provider
285
- | Provider | Spend | % of Total |
286
- |----------|-------|------------|
287
- | Anthropic | $678.45 | 80% |
288
- | OpenAI | $134.22 | 16% |
289
- | Google | $33.00 | 4% |
290
-
291
- ## By Model
292
- | Model | Requests | Tokens | Cost |
293
- |-------|----------|--------|------|
294
- | claude-3-sonnet | 1,234 | 4.5M | $456.78 |
295
- | claude-3-opus | 89 | 890K | $178.90 |
296
- | claude-3-haiku | 567 | 1.2M | $42.77 |
297
-
298
- ## By Team
299
- | Team | Spend | Budget | Status |
300
- |------|-------|--------|--------|
301
- | Frontend | $312.45 | $400 | ✅ |
302
- | Backend | $398.22 | $500 | ✅ |
303
- | Mobile | $135.00 | $300 | ✅ |
304
-
305
- ## Trends
306
- - Daily average: $28.19
307
- - Peak day: Jan 15 ($67.89)
308
- - Lowest day: Jan 1 ($3.45)
309
-
310
- ## Recommendations
311
- 1. Consider caching repeated analysis requests
312
- 2. Use Haiku for config/quick changes
313
- 3. Team Backend approaching limit - review usage
314
- ```
315
-
316
- ---
317
-
318
- ## Budget Actions
319
-
320
- ### On Budget Exceeded
321
-
322
- ```yaml
323
- ai:
324
- cost:
325
- on_limit_exceeded:
326
- # Options: block, fallback, notify_only, emergency_only
327
- action: "fallback"
328
-
329
- fallback_chain:
330
- - "claude-3-haiku"
331
- - "gpt-3.5-turbo"
332
-
333
- emergency_override:
334
- enabled: true
335
- requires: "admin_approval"
336
- max_additional: 20.00
337
- ```
338
-
339
- ### Manual Controls
340
-
341
- ```bash
342
- # Pause AI usage
343
- proagents ai pause
344
-
345
- # Resume AI usage
346
- proagents ai resume
347
-
348
- # Emergency override (with approval)
349
- proagents ai override --reason "Critical production fix"
350
- ```
351
-
352
- ---
353
-
354
- ## Best Practices
355
-
356
- 1. **Set Conservative Limits**: Start low, increase as needed
357
- 2. **Enable Alerts Early**: Get notified at 50%
358
- 3. **Use Right-Sized Models**: Don't use Opus for simple tasks
359
- 4. **Enable Caching**: Avoid duplicate requests
360
- 5. **Review Weekly**: Check usage patterns
361
- 6. **Optimize Prompts**: Reduce token usage
362
- 7. **Train Team**: Make team aware of costs
@@ -1,342 +0,0 @@
1
- # AI Model Fallbacks
2
-
3
- Configure fallback strategies when primary AI models are unavailable.
4
-
5
- ---
6
-
7
- ## Fallback Chain
8
-
9
- ```
10
- ┌─────────────────────────────────────────────────────────────┐
11
- │ Fallback Chain │
12
- ├─────────────────────────────────────────────────────────────┤
13
- │ │
14
- │ Request ──▶ Primary Model │
15
- │ │ │
16
- │ [Available?] │
17
- │ / \ │
18
- │ Yes No │
19
- │ │ │ │
20
- │ ▼ ▼ │
21
- │ Process Secondary Model │
22
- │ │ │
23
- │ [Available?] │
24
- │ / \ │
25
- │ Yes No │
26
- │ │ │ │
27
- │ ▼ ▼ │
28
- │ Process Tertiary Model │
29
- │ │ │
30
- │ [Continue...] │
31
- │ │
32
- └─────────────────────────────────────────────────────────────┘
33
- ```
34
-
35
- ---
36
-
37
- ## Configuration
38
-
39
- ### Fallback Chain Setup
40
-
41
- ```yaml
42
- ai:
43
- fallbacks:
44
- enabled: true
45
-
46
- # Primary chain
47
- chain:
48
- - model: "claude-3-opus"
49
- provider: "anthropic"
50
- - model: "gpt-4-turbo"
51
- provider: "openai"
52
- - model: "claude-3-sonnet"
53
- provider: "anthropic"
54
- - model: "gpt-4"
55
- provider: "openai"
56
- - model: "claude-3-haiku"
57
- provider: "anthropic"
58
-
59
- # When to trigger fallback
60
- triggers:
61
- - "rate_limit"
62
- - "timeout"
63
- - "service_unavailable"
64
- - "model_overloaded"
65
- - "quota_exceeded"
66
- ```
67
-
68
- ### Provider-Specific Settings
69
-
70
- ```yaml
71
- ai:
72
- providers:
73
- anthropic:
74
- api_key_env: "ANTHROPIC_API_KEY"
75
- timeout: 30000
76
- max_retries: 2
77
-
78
- openai:
79
- api_key_env: "OPENAI_API_KEY"
80
- timeout: 30000
81
- max_retries: 2
82
-
83
- google:
84
- api_key_env: "GOOGLE_AI_KEY"
85
- timeout: 30000
86
- max_retries: 2
87
- ```
88
-
89
- ---
90
-
91
- ## Fallback Triggers
92
-
93
- ### Automatic Triggers
94
-
95
- | Trigger | Description | Action |
96
- |---------|-------------|--------|
97
- | `rate_limit` | API rate limit hit | Immediate fallback |
98
- | `timeout` | Request timed out | Retry then fallback |
99
- | `service_unavailable` | 503 error | Immediate fallback |
100
- | `model_overloaded` | Model capacity | Immediate fallback |
101
- | `quota_exceeded` | Billing limit | Fallback + alert |
102
- | `error_5xx` | Server errors | Retry then fallback |
103
-
104
- ### Configuration
105
-
106
- ```yaml
107
- ai:
108
- fallbacks:
109
- triggers:
110
- rate_limit:
111
- action: "immediate_fallback"
112
- notify: false
113
-
114
- timeout:
115
- threshold: 30000 # ms
116
- retry_count: 1
117
- action: "retry_then_fallback"
118
-
119
- quota_exceeded:
120
- action: "fallback_and_alert"
121
- alert_channel: "slack:#ai-alerts"
122
- ```
123
-
124
- ---
125
-
126
- ## Retry Logic
127
-
128
- ### Retry Configuration
129
-
130
- ```yaml
131
- ai:
132
- fallbacks:
133
- retry:
134
- enabled: true
135
- max_attempts: 3
136
-
137
- # Backoff strategy
138
- backoff:
139
- type: "exponential" # exponential, linear, fixed
140
- initial_delay: 1000 # ms
141
- max_delay: 10000 # ms
142
- multiplier: 2
143
-
144
- # Retry conditions
145
- retry_on:
146
- - "timeout"
147
- - "error_5xx"
148
- - "network_error"
149
-
150
- # Don't retry these
151
- no_retry:
152
- - "rate_limit"
153
- - "invalid_request"
154
- - "auth_error"
155
- ```
156
-
157
- ### Retry Flow
158
-
159
- ```
160
- Request Failed
161
-
162
-
163
- [Retryable Error?]
164
-
165
- Yes ──▶ Wait (backoff) ──▶ Retry
166
- │ │
167
- │ [Max Attempts?]
168
- │ │
169
- │ Yes ──▶ Fallback to Next Model
170
- │ │
171
- │ No ──▶ Retry Again
172
-
173
- No ──▶ Fallback Immediately
174
- ```
175
-
176
- ---
177
-
178
- ## Graceful Degradation
179
-
180
- ### Quality Tiers
181
-
182
- ```yaml
183
- ai:
184
- fallbacks:
185
- degradation:
186
- # Define quality tiers
187
- tiers:
188
- premium:
189
- models: ["claude-3-opus", "gpt-4-turbo"]
190
- features: ["full"]
191
-
192
- standard:
193
- models: ["claude-3-sonnet", "gpt-4"]
194
- features: ["full"]
195
-
196
- basic:
197
- models: ["claude-3-haiku", "gpt-3.5-turbo"]
198
- features: ["limited"]
199
- disabled:
200
- - "complex_analysis"
201
- - "large_context"
202
-
203
- # Notify on degradation
204
- notify_on_degradation: true
205
- notification_channel: "slack:#ai-status"
206
- ```
207
-
208
- ### Feature Limitations
209
-
210
- ```yaml
211
- ai:
212
- fallbacks:
213
- degradation:
214
- feature_fallbacks:
215
- # If complex analysis unavailable
216
- complex_analysis:
217
- fallback_to: "basic_analysis"
218
- notify: true
219
-
220
- # If large context unavailable
221
- large_context:
222
- fallback_to: "chunked_processing"
223
- max_chunk_size: 4000
224
- ```
225
-
226
- ---
227
-
228
- ## Health Monitoring
229
-
230
- ### Provider Health Checks
231
-
232
- ```yaml
233
- ai:
234
- health:
235
- enabled: true
236
- check_interval: "60s"
237
-
238
- checks:
239
- anthropic:
240
- endpoint: "https://api.anthropic.com/health"
241
- timeout: 5000
242
-
243
- openai:
244
- endpoint: "https://api.openai.com/v1/models"
245
- timeout: 5000
246
-
247
- # Pre-emptive fallback
248
- preemptive:
249
- enabled: true
250
- unhealthy_threshold: 3 # consecutive failures
251
- ```
252
-
253
- ### Health Dashboard
254
-
255
- ```
256
- ┌─────────────────────────────────────────────────────────────┐
257
- │ AI Provider Health │
258
- ├─────────────────────────────────────────────────────────────┤
259
- │ │
260
- │ Anthropic │
261
- │ ├── claude-3-opus: ✅ Healthy (45ms) │
262
- │ ├── claude-3-sonnet: ✅ Healthy (32ms) │
263
- │ └── claude-3-haiku: ✅ Healthy (28ms) │
264
- │ │
265
- │ OpenAI │
266
- │ ├── gpt-4-turbo: ✅ Healthy (120ms) │
267
- │ ├── gpt-4: ⚠️ Degraded (850ms) │
268
- │ └── gpt-3.5-turbo: ✅ Healthy (95ms) │
269
- │ │
270
- │ Current Routing: claude-3-opus (primary) │
271
- │ Fallback Ready: gpt-4-turbo │
272
- │ │
273
- └─────────────────────────────────────────────────────────────┘
274
- ```
275
-
276
- ---
277
-
278
- ## Fallback Logging
279
-
280
- ### Log Events
281
-
282
- ```yaml
283
- ai:
284
- fallbacks:
285
- logging:
286
- enabled: true
287
-
288
- log_events:
289
- - "fallback_triggered"
290
- - "retry_attempt"
291
- - "provider_switch"
292
- - "degradation_activated"
293
-
294
- include:
295
- - "original_model"
296
- - "fallback_model"
297
- - "trigger_reason"
298
- - "latency"
299
- ```
300
-
301
- ### Log Example
302
-
303
- ```json
304
- {
305
- "event": "fallback_triggered",
306
- "timestamp": "2024-01-15T10:30:00Z",
307
- "original_model": "claude-3-opus",
308
- "fallback_model": "gpt-4-turbo",
309
- "trigger": "rate_limit",
310
- "retry_attempts": 0,
311
- "latency_impact": "+150ms"
312
- }
313
- ```
314
-
315
- ---
316
-
317
- ## Commands
318
-
319
- ```bash
320
- # Check fallback status
321
- proagents ai fallback-status
322
-
323
- # Test fallback chain
324
- proagents ai test-fallback
325
-
326
- # Force fallback (for testing)
327
- proagents ai use-fallback --model gpt-4
328
-
329
- # View fallback history
330
- proagents ai fallback-history --last 24h
331
- ```
332
-
333
- ---
334
-
335
- ## Best Practices
336
-
337
- 1. **Multiple Providers**: Use models from different providers
338
- 2. **Similar Capabilities**: Fallback models should have similar features
339
- 3. **Monitor Costs**: Track cost differences between models
340
- 4. **Test Regularly**: Periodically test fallback chain
341
- 5. **Alert on Fallback**: Know when primary is unavailable
342
- 6. **Graceful Degradation**: Plan for reduced capabilities