Overview
The AI layer is optional and non-blocking. The system works completely without an API key configured — in that case, all analysis is done by the traditional rule engine. When AI is available, it enriches the results without replacing existing logic.
AI features
1. Architecture recommendation with AI
Where: Assessment → Recommendation card → "AI Insights" panel
After the assessment is completed, the rule engine determines the strategy. AI receives the application profile and engine result, and generates:
- Validation of the recommended strategy
- Executive summary — narrative text ready for reports
- Additional risks not captured by the rules
- Suggested next steps (numbered and actionable)
- Contextual confidence note
The recommendation card shows the AI Enhanced badge when AI insight is available.
2. Risk analysis with AI
Where: Application page → Risks tab → "Analyze with AI" button
Sends the complete application profile to AI and returns 5 to 10 contextual risks — including risks beyond pre-defined rules, stack-specific risks, and contextual organizational and compliance risks. Each can be registered with one click.
3. Migration procedure generation with AI
Where: Migration Plan → Procedures marked with AI Generated
When generating a migration plan, AI produces procedures personalized for the application's specific stack:
- Migration Procedure — complete runbook with real commands for the stack
- Containerization Procedure — Dockerfile example, multi-stage build, OKD manifests (Deployment, Service, Route, ConfigMap, Secret)
Configuration
Environment variables
# .env
AI_PROVIDER=openai
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_MODEL=gpt-4o
OPENAI_TEMPERATURE=0.3
OPENAI_MAX_TOKENS=3000
OPENAI_TIMEOUT=60
# Feature flags — disable individual features
AI_FEATURE_ARCHITECTURE=true
AI_FEATURE_PROCEDURES=true
AI_FEATURE_RISKS=true
AI_FEATURE_REPORTS=false
Feature flags
| Variable | Controls | Default |
|---|---|---|
AI_FEATURE_ARCHITECTURE | AI Insights on recommendation card | true |
AI_FEATURE_PROCEDURES | AI-generated migration procedures | true |
AI_FEATURE_RISKS | AI risk analysis | true |
AI_FEATURE_REPORTS | AI-generated report narrative | false |
Technical architecture
| Class | Responsibility |
|---|---|
App\Services\AI\OpenAIProvider | OpenAI API wrapper. Methods: chat(), chatJson(), isAvailable() |
App\Services\AI\RiskAnalysisService | Generates risk suggestions. Method: suggestRisks(Application, ?Assessment) |
App\Services\ArchitectureRecommendationEngine | Rule engine + AI augmentation via getAIInsights() |
App\Services\MigrationProcedureGenerator | Runbook generator with generateAIProcedures() |
App\Http\Controllers\Web\AIController | AJAX endpoint: POST /ai/applications/{id}/risks |
Cost estimates
| Call | Estimated tokens | Frequency |
|---|---|---|
| Architecture Insights | ~1,500–2,500 tokens | Per assessment completion |
| Risk Analysis | ~1,000–2,000 tokens | Per button click (manual) |
| Migration Procedures | ~2,000–3,000 tokens | Per plan generation |
Verify AI is configured
php artisan tinker
# Check availability
app(\App\Services\AI\OpenAIProvider::class)->isAvailable();
// true = configured, false = no API key