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.

Graceful Degradation If the OpenAI API key is not configured or a call fails, the system silently ignores AI and uses the rule engine results. No error is shown to the user.

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

VariableControlsDefault
AI_FEATURE_ARCHITECTUREAI Insights on recommendation cardtrue
AI_FEATURE_PROCEDURESAI-generated migration procedurestrue
AI_FEATURE_RISKSAI risk analysistrue
AI_FEATURE_REPORTSAI-generated report narrativefalse

Technical architecture

ClassResponsibility
App\Services\AI\OpenAIProviderOpenAI API wrapper. Methods: chat(), chatJson(), isAvailable()
App\Services\AI\RiskAnalysisServiceGenerates risk suggestions. Method: suggestRisks(Application, ?Assessment)
App\Services\ArchitectureRecommendationEngineRule engine + AI augmentation via getAIInsights()
App\Services\MigrationProcedureGeneratorRunbook generator with generateAIProcedures()
App\Http\Controllers\Web\AIControllerAJAX endpoint: POST /ai/applications/{id}/risks

Cost estimates

CallEstimated tokensFrequency
Architecture Insights~1,500–2,500 tokensPer assessment completion
Risk Analysis~1,000–2,000 tokensPer button click (manual)
Migration Procedures~2,000–3,000 tokensPer plan generation
Cost With GPT-4o, each full analysis (architecture + procedures) costs approximately $0.02–$0.05 USD. For large portfolios, estimate costs before enabling all features in production.

Verify AI is configured

php artisan tinker

# Check availability
app(\App\Services\AI\OpenAIProvider::class)->isAvailable();
// true = configured, false = no API key