AI Decision Support Services
Build AI-powered decision support services that provide recommendations, optimize resources, assess risks, and help make data-driven strategic decisions using the Services-as-Software framework.
AI decision support services help organizations make better, faster, and more informed decisions by leveraging machine learning to analyze options, simulate outcomes, optimize resources, and provide evidence-based recommendations across business operations.
Overview
Decision support services combine data analysis, predictive modeling, optimization algorithms, and scenario simulation to help decision-makers evaluate alternatives and choose the best course of action. These services are particularly valuable for complex decisions with multiple variables and uncertain outcomes.
Key Benefits
- Data-Driven Decisions: Base choices on evidence rather than intuition
- Risk Mitigation: Identify and quantify risks before committing
- Optimization: Find the best solution among many alternatives
- Speed: Make complex decisions in minutes instead of weeks
- Consistency: Apply the same rigorous analysis to every decision
- Simulation: Test scenarios before implementing in reality
Service Architecture
Decision support services follow this pattern:
- Context Gathering: Collect relevant data and constraints
- Option Generation: Identify possible alternatives
- Impact Analysis: Evaluate each option's potential outcomes
- Scenario Simulation: Model different future states
- Optimization: Find the best solution given objectives and constraints
- Risk Assessment: Quantify uncertainties and risks
- Recommendation: Provide clear, justified recommendations
- Sensitivity Analysis: Show how results change with assumptions
Pricing Optimization Service
Dynamic pricing optimization that maximizes revenue while considering market position:
import $, { ai, db, on, send } from 'sdk.do'
const pricingOptimizationService = await $.Service.create({
id: 'pricing-optimizer',
name: 'Dynamic Pricing Optimizer',
description: 'Optimize product pricing to maximize revenue, margin, or market share',
type: $.ServiceType.DecisionSupport,
subtype: 'pricing-optimization',
capabilities: [
'price-elasticity-analysis',
'competitor-pricing-analysis',
'revenue-maximization',
'margin-optimization',
'demand-forecasting',
'scenario-simulation',
'a-b-test-design',
],
pricing: {
model: 'value-based',
valueMultiplier: 0.1, // 10% of estimated value created
minimumCharge: 500.0,
alternativeModels: {
perProduct: {
tiers: [
{ products: { min: 1, max: 10 }, rate: 100.0 },
{ products: { min: 11, max: 100 }, rate: 75.0 },
{ products: { min: 101, max: Infinity }, rate: 50.0 },
],
},
subscription: {
monthly: 999.0,
yearly: 9999.0,
includes: {
products: 'unlimited',
optimizations: 'unlimited',
updates: 'real-time',
},
},
},
},
inputSchema: {
products: {
type: 'array',
required: true,
items: {
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
currentPrice: { type: 'number' },
cost: { type: 'number' },
category: { type: 'string' },
},
},
},
objective: {
type: 'string',
enum: ['maximize-revenue', 'maximize-margin', 'maximize-units', 'maximize-market-share'],
default: 'maximize-revenue',
},
constraints: {
type: 'object',
properties: {
minMargin: { type: 'number', default: 0.2 },
maxPriceIncrease: { type: 'number', default: 0.25 },
maintainPositioning: { type: 'boolean', default: true },
},
},
marketData: {
type: 'object',
properties: {
competitors: { type: 'array' },
demandHistory: { type: 'array' },
seasonality: { type: 'object' },
},
},
},
outputSchema: {
recommendations: {
type: 'array',
items: {
type: 'object',
properties: {
productId: { type: 'string' },
currentPrice: { type: 'number' },
recommendedPrice: { type: 'number' },
priceChange: { type: 'number' },
expectedImpact: { type: 'object' },
confidence: { type: 'number' },
},
},
},
simulation: { type: 'object' },
expectedValue: { type: 'number' },
implementationPlan: { type: 'object' },
},
})
on($.ServiceRequest.created, async (request) => {
if (request.serviceId !== pricingOptimizationService.id) return
try {
await send($.ServiceRequest.update, {
requestId: request.id,
status: 'processing',
progress: 0.1,
})
const { products, objective, constraints, marketData } = request.inputs
// 1. Analyze current pricing performance
const currentPerformance = await ai.generate({
model: 'gpt-5',
prompt: `Analyze current pricing performance for these products:
Products: ${JSON.stringify(products)}
Sales data: ${JSON.stringify(marketData.demandHistory)}
For each product, calculate:
1. Current revenue
2. Current margin
3. Sales volume trends
4. Price elasticity
5. Competitive position
Identify pricing issues and opportunities.`,
schema: {
products: {
type: 'array',
items: {
type: 'object',
properties: {
productId: { type: 'string' },
currentRevenue: { type: 'number' },
currentMargin: { type: 'number' },
volumeTrend: { type: 'string' },
elasticity: { type: 'number' },
competitivePosition: { type: 'string' },
issues: { type: 'array' },
opportunities: { type: 'array' },
},
},
},
},
})
await send($.ServiceRequest.update, {
requestId: request.id,
progress: 0.3,
})
// 2. Analyze competitor pricing
const competitorAnalysis = await ai.generate({
model: 'gpt-5',
prompt: `Analyze competitor pricing strategy:
Our products: ${JSON.stringify(products)}
Competitors: ${JSON.stringify(marketData.competitors)}
For each competitor:
1. Pricing strategy (premium/value/penetration)
2. Price positioning vs. our products
3. Recent price changes
4. Promotional patterns
Identify:
- Pricing gaps we can exploit
- Threats from competitor pricing
- Market price sensitivity`,
schema: {
competitors: {
type: 'array',
items: {
type: 'object',
properties: {
name: { type: 'string' },
strategy: { type: 'string' },
pricePoints: { type: 'array' },
positioning: { type: 'string' },
},
},
},
gaps: { type: 'array' },
threats: { type: 'array' },
marketSensitivity: { type: 'string' },
},
})
await send($.ServiceRequest.update, {
requestId: request.id,
progress: 0.5,
})
// 3. Optimize pricing for each product
const optimizations = await Promise.all(
products.map(async (product) => {
const performance = currentPerformance.data.products.find((p: any) => p.productId === product.id)
const optimization = await ai.generate({
model: 'gpt-5',
prompt: `Optimize pricing for this product:
Product: ${JSON.stringify(product)}
Current performance: ${JSON.stringify(performance)}
Objective: ${objective}
Constraints: ${JSON.stringify(constraints)}
Competitor analysis: ${JSON.stringify(competitorAnalysis.data)}
Calculate optimal price that:
- ${objective === 'maximize-revenue' ? 'Maximizes total revenue' : ''}
- ${objective === 'maximize-margin' ? 'Maximizes profit margin' : ''}
- ${objective === 'maximize-units' ? 'Maximizes units sold' : ''}
- Respects minimum margin of ${constraints.minMargin * 100}%
- Changes price by no more than ${constraints.maxPriceIncrease * 100}%
- Maintains market positioning: ${constraints.maintainPositioning}
Use price elasticity of ${performance?.elasticity || -1.5}
Provide:
- Optimal price
- Expected revenue impact
- Expected volume impact
- Expected margin impact
- Confidence level
- Rationale`,
schema: {
productId: { type: 'string' },
productName: { type: 'string' },
currentPrice: { type: 'number' },
recommendedPrice: { type: 'number' },
priceChange: { type: 'number' },
priceChangePercent: { type: 'number' },
expectedImpact: {
type: 'object',
properties: {
revenue: { type: 'number' },
revenueChange: { type: 'number' },
volume: { type: 'number' },
volumeChange: { type: 'number' },
margin: { type: 'number' },
marginChange: { type: 'number' },
},
},
confidence: { type: 'number' },
rationale: { type: 'string' },
risks: { type: 'array' },
},
})
return optimization.data
})
)
await send($.ServiceRequest.update, {
requestId: request.id,
progress: 0.7,
})
// 4. Simulate different scenarios
const simulation = await ai.generate({
model: 'gpt-5',
prompt: `Simulate pricing scenarios:
Recommended optimizations: ${JSON.stringify(optimizations)}
Market conditions: ${JSON.stringify(marketData)}
Simulate these scenarios over 90 days:
1. Implement all recommendations immediately
2. Implement recommendations gradually (10% per week)
3. Implement only high-confidence recommendations
4. Conservative approach (half the recommended changes)
5. Aggressive approach (maximum allowed changes)
For each scenario, project:
- Total revenue
- Total profit
- Market share impact
- Customer response
- Competitor reactions
Run 1000 Monte Carlo iterations considering:
- Demand uncertainty
- Competitor responses
- Economic conditions
- Seasonality`,
schema: {
scenarios: {
type: 'array',
items: {
type: 'object',
properties: {
name: { type: 'string' },
description: { type: 'string' },
projections: {
type: 'object',
properties: {
revenue: { type: 'object' },
profit: { type: 'object' },
marketShare: { type: 'object' },
customerResponse: { type: 'string' },
},
},
probability: { type: 'number' },
risk: { type: 'string' },
},
},
},
bestScenario: { type: 'string' },
expectedValue: { type: 'number' },
},
})
await send($.ServiceRequest.update, {
requestId: request.id,
progress: 0.85,
})
// 5. Create implementation plan
const implementationPlan = await ai.generate({
model: 'gpt-5',
prompt: `Create pricing implementation plan:
Optimizations: ${JSON.stringify(optimizations)}
Best scenario: ${simulation.data.bestScenario}
Provide:
1. Rollout schedule (which products, when)
2. Communication strategy (internal and customer-facing)
3. Monitoring plan (what to track)
4. Rollback criteria (when to revert)
5. A/B testing recommendations
6. Risk mitigation steps`,
schema: {
rollout: {
type: 'array',
items: {
type: 'object',
properties: {
phase: { type: 'number' },
products: { type: 'array' },
timing: { type: 'string' },
actions: { type: 'array' },
},
},
},
communication: {
type: 'object',
properties: {
internal: { type: 'array' },
external: { type: 'array' },
},
},
monitoring: {
type: 'object',
properties: {
metrics: { type: 'array' },
frequency: { type: 'string' },
alerts: { type: 'array' },
},
},
rollbackCriteria: { type: 'array' },
abTests: { type: 'array' },
},
})
await send($.ServiceRequest.update, {
requestId: request.id,
progress: 0.95,
})
// 6. Generate visualizations
const visualizations = await generatePricingVisualizations({
current: currentPerformance.data,
optimizations,
simulation: simulation.data,
})
// 7. Deliver comprehensive recommendation
await send($.ServiceResult.deliver, {
requestId: request.id,
outputs: {
executiveSummary: generatePricingExecutiveSummary({
optimizations,
simulation: simulation.data,
expectedValue: simulation.data.expectedValue,
}),
currentPerformance: currentPerformance.data,
competitorAnalysis: competitorAnalysis.data,
recommendations: optimizations,
simulation: simulation.data,
implementationPlan: implementationPlan.data,
visualizations,
confidence: calculateOverallConfidence(optimizations),
},
})
// Calculate value-based fee
const expectedValue = simulation.data.expectedValue
const fee = Math.max(expectedValue * pricingOptimizationService.pricing.valueMultiplier, pricingOptimizationService.pricing.minimumCharge)
await send($.Payment.charge, {
customerId: request.customerId,
amount: fee,
description: `Pricing Optimization (10% of $${expectedValue.toLocaleString()} projected value)`,
metadata: {
productCount: products.length,
projectedValue: expectedValue,
objective,
},
})
} catch (error) {
await send($.ServiceRequest.fail, {
requestId: request.id,
error: { code: 'OPTIMIZATION_FAILED', message: error.message },
})
}
})
function generatePricingExecutiveSummary(data: any): string {
const avgIncrease = data.optimizations.reduce((sum: number, opt: any) => sum + opt.priceChangePercent, 0) / data.optimizations.length
return `
# Pricing Optimization Summary
## Recommended Changes
- ${data.optimizations.length} products analyzed
- Average price adjustment: ${avgIncrease > 0 ? '+' : ''}${avgIncrease.toFixed(1)}%
- Expected annual revenue increase: $${data.expectedValue.toLocaleString()}
## Best Scenario: ${data.simulation.bestScenario}
${data.simulation.scenarios.find((s: any) => s.name === data.simulation.bestScenario)?.description}
## Implementation
Phased rollout over ${data.implementationPlan?.rollout?.length || 3} weeks with continuous monitoring and A/B testing.
`.trim()
}
function calculateOverallConfidence(optimizations: any[]): number {
return optimizations.reduce((sum, opt) => sum + opt.confidence, 0) / optimizations.length
}
async function generatePricingVisualizations(data: any) {
return {
currentVsOptimized: 'chart showing current vs optimized pricing',
revenueProjection: 'chart showing revenue projection over time',
scenarioComparison: 'chart comparing different scenarios',
elasticityAnalysis: 'chart showing price elasticity by product',
}
}Resource Allocation Service
Optimize resource allocation across projects, teams, or campaigns:
import $, { ai, db, on, send } from 'sdk.do'
const resourceAllocationService = await $.Service.create({
id: 'resource-allocator',
name: 'Resource Allocation Optimizer',
description: 'Optimize allocation of budget, people, and resources across initiatives',
type: $.ServiceType.DecisionSupport,
subtype: 'resource-allocation',
pricing: {
model: 'per-optimization',
tiers: [
{ name: 'basic', price: 250, resources: { max: 50 }, initiatives: { max: 20 } },
{ name: 'professional', price: 750, resources: { max: 200 }, initiatives: { max: 100 } },
{ name: 'enterprise', price: 2500, resources: 'unlimited', initiatives: 'unlimited' },
],
},
})
on($.ServiceRequest.created, async (request) => {
if (request.serviceId !== resourceAllocationService.id) return
const { resources, initiatives, constraints, objective } = request.inputs
// 1. Analyze each initiative
const initiativeAnalysis = await Promise.all(
initiatives.map(async (initiative: any) => {
const analysis = await ai.generate({
model: 'gpt-5',
prompt: `Analyze this initiative for resource allocation:
Initiative: ${JSON.stringify(initiative)}
Assess:
1. Expected ROI
2. Strategic value
3. Risk level
4. Resource requirements
5. Timeline
6. Dependencies
7. Success probability`,
schema: {
id: { type: 'string' },
name: { type: 'string' },
expectedROI: { type: 'number' },
strategicValue: { type: 'number' },
riskLevel: { type: 'string' },
resourceNeeds: { type: 'object' },
timeline: { type: 'string' },
dependencies: { type: 'array' },
successProbability: { type: 'number' },
score: { type: 'number' },
},
})
return analysis.data
})
)
// 2. Optimize allocation
const optimization = await ai.generate({
model: 'gpt-5',
prompt: `Optimize resource allocation:
Available resources: ${JSON.stringify(resources)}
Initiatives: ${JSON.stringify(initiativeAnalysis)}
Constraints: ${JSON.stringify(constraints)}
Objective: ${objective}
Find optimal allocation that:
- ${objective === 'maximize-roi' ? 'Maximizes expected ROI' : ''}
- ${objective === 'maximize-strategic-value' ? 'Maximizes strategic value' : ''}
- ${objective === 'minimize-risk' ? 'Minimizes overall risk' : ''}
- Respects all resource constraints
- Considers dependencies
For each initiative, determine:
- Priority (1-5)
- Resource allocation
- Timeline
- Success probability with allocated resources
Use linear programming to find optimal solution.`,
schema: {
allocations: {
type: 'array',
items: {
type: 'object',
properties: {
initiativeId: { type: 'string' },
priority: { type: 'number' },
resourceAllocation: { type: 'object' },
expectedOutcome: { type: 'object' },
timeline: { type: 'string' },
},
},
},
totalExpectedValue: { type: 'number' },
resourceUtilization: { type: 'object' },
risks: { type: 'array' },
},
})
// 3. Simulate alternative allocations
const alternatives = await ai.generate({
model: 'gpt-5',
prompt: `Generate 3 alternative allocation strategies:
Optimal: ${JSON.stringify(optimization.data)}
Alternatives:
1. Risk-averse (favor low-risk initiatives)
2. Innovation-focused (favor high-potential initiatives)
3. Balanced (spread resources more evenly)
Compare expected outcomes.`,
schema: {
alternatives: {
type: 'array',
items: {
type: 'object',
properties: {
strategy: { type: 'string' },
allocations: { type: 'array' },
expectedValue: { type: 'number' },
riskProfile: { type: 'string' },
tradeoffs: { type: 'array' },
},
},
},
},
})
await send($.ServiceResult.deliver, {
requestId: request.id,
outputs: {
recommendedAllocation: optimization.data,
alternativeStrategies: alternatives.data.alternatives,
comparison: compareAllocationStrategies([{ name: 'Recommended', data: optimization.data }, ...alternatives.data.alternatives]),
implementationGuide: await createImplementationGuide(optimization.data),
},
})
const tier = pricingOptimizationService.pricing.tiers.find((t: any) => t.name === request.inputs.tier)
await send($.Payment.charge, {
customerId: request.customerId,
amount: tier!.price,
description: 'Resource Allocation Optimization',
})
})
function compareAllocationStrategies(strategies: any[]) {
return strategies.map((s) => ({
name: s.name,
expectedValue: s.data.totalExpectedValue || s.expectedValue,
risk: s.data.risks?.length || s.riskProfile,
initiativeCount: s.data.allocations?.length || s.allocations.length,
}))
}
async function createImplementationGuide(allocation: any) {
return {
phases: allocation.allocations.map((a: any, i: number) => ({
phase: i + 1,
initiative: a.initiativeId,
resources: a.resourceAllocation,
timeline: a.timeline,
})),
milestones: generateMilestones(allocation),
monitoring: {
metrics: ['resource-utilization', 'roi-tracking', 'timeline-adherence'],
frequency: 'weekly',
},
}
}
function generateMilestones(allocation: any) {
return allocation.allocations.flatMap((a: any) => [
{ initiative: a.initiativeId, milestone: 'kickoff', date: 'Week 1' },
{ initiative: a.initiativeId, milestone: 'midpoint', date: 'Week 6' },
{ initiative: a.initiativeId, milestone: 'completion', date: a.timeline },
])
}Hiring Decision Support Service
Help make data-driven hiring decisions with candidate scoring:
import $, { ai, db, on, send } from 'sdk.do'
const hiringDecisionService = await $.Service.create({
id: 'hiring-decision-support',
name: 'Hiring Decision Support',
description: 'Evaluate candidates and provide hiring recommendations',
type: $.ServiceType.DecisionSupport,
subtype: 'hiring-decisions',
pricing: {
model: 'per-candidate',
tiers: [
{ candidates: { min: 1, max: 10 }, rate: 50.0 },
{ candidates: { min: 11, max: 50 }, rate: 35.0 },
{ candidates: { min: 51, max: Infinity }, rate: 25.0 },
],
},
})
on($.ServiceRequest.created, async (request) => {
if (request.serviceId !== hiringDecisionService.id) return
const { position, candidates, criteria, companyContext } = request.inputs
// Analyze each candidate
const candidateEvaluations = await Promise.all(
candidates.map(async (candidate: any) => {
const evaluation = await ai.generate({
model: 'gpt-5',
prompt: `Evaluate this candidate for the position:
Position: ${JSON.stringify(position)}
Candidate: ${JSON.stringify(candidate)}
Evaluation criteria: ${JSON.stringify(criteria)}
Company context: ${JSON.stringify(companyContext)}
Assess:
1. Skills match (0-100)
2. Experience relevance (0-100)
3. Cultural fit (0-100)
4. Growth potential (0-100)
5. Leadership ability (0-100)
For each criterion:
- Score
- Evidence from resume/interview
- Strengths
- Concerns
Provide:
- Overall score (0-100)
- Hiring recommendation (strong-yes/yes/maybe/no)
- Key strengths
- Key concerns
- Onboarding recommendations`,
schema: {
candidateId: { type: 'string' },
candidateName: { type: 'string' },
scores: {
type: 'object',
properties: {
skills: { type: 'number' },
experience: { type: 'number' },
culturalFit: { type: 'number' },
growthPotential: { type: 'number' },
leadership: { type: 'number' },
},
},
overallScore: { type: 'number' },
recommendation: { type: 'string' },
strengths: { type: 'array' },
concerns: { type: 'array' },
evidence: { type: 'object' },
onboardingRecommendations: { type: 'array' },
},
})
return evaluation.data
})
)
// Rank candidates
const ranking = await ai.generate({
model: 'gpt-5',
prompt: `Rank these candidates:
Evaluations: ${JSON.stringify(candidateEvaluations)}
Position requirements: ${JSON.stringify(position)}
Provide:
1. Ranked list (best to worst)
2. Rationale for each ranking
3. Comparison of top 3 candidates
4. Recommendation on how many to hire
5. Backup candidates if top choices decline`,
schema: {
ranking: {
type: 'array',
items: {
type: 'object',
properties: {
rank: { type: 'number' },
candidateId: { type: 'string' },
score: { type: 'number' },
rationale: { type: 'string' },
},
},
},
topCandidatesComparison: { type: 'string' },
hiringRecommendation: { type: 'string' },
backupCandidates: { type: 'array' },
},
})
await send($.ServiceResult.deliver, {
requestId: request.id,
outputs: {
evaluations: candidateEvaluations,
ranking: ranking.data.ranking,
comparison: ranking.data.topCandidatesComparison,
recommendation: ranking.data.hiringRecommendation,
visualizations: await generateCandidateCharts(candidateEvaluations),
},
})
const tier = hiringDecisionService.pricing.tiers.find((t: any) => candidates.length >= t.candidates.min && candidates.length <= t.candidates.max)
const cost = candidates.length * (tier?.rate || 50.0)
await send($.Payment.charge, {
customerId: request.customerId,
amount: cost,
description: `Hiring Decision Support: ${candidates.length} candidates`,
})
})
async function generateCandidateCharts(evaluations: any[]) {
return {
scoreComparison: 'radar chart comparing candidate scores',
rankingVisualization: 'bar chart showing overall scores',
criteriaBreakdown: 'stacked bar chart showing scores by criterion',
}
}Investment Analysis Service
Evaluate investment opportunities with risk-adjusted returns:
import $, { ai, db, on, send } from 'sdk.do'
const investmentAnalysisService = await $.Service.create({
id: 'investment-analyzer',
name: 'Investment Decision Support',
description: 'Analyze investment opportunities and provide recommendations',
type: $.ServiceType.DecisionSupport,
subtype: 'investment-analysis',
pricing: {
model: 'per-analysis',
baseRate: 500.0,
tiers: [
{ name: 'basic', price: 500, includes: ['financial-analysis', 'risk-assessment'] },
{ name: 'comprehensive', price: 1500, includes: ['all-basic', 'market-analysis', 'due-diligence'] },
{ name: 'institutional', price: 5000, includes: ['all-comprehensive', 'scenario-modeling', 'portfolio-impact'] },
],
},
})
on($.ServiceRequest.created, async (request) => {
if (request.serviceId !== investmentAnalysisService.id) return
const { investment, portfolio, riskTolerance, objectives } = request.inputs
// 1. Financial analysis
const financialAnalysis = await ai.generate({
model: 'gpt-5',
prompt: `Analyze this investment opportunity:
Investment: ${JSON.stringify(investment)}
Calculate:
1. Expected return (base case, optimistic, pessimistic)
2. Risk metrics (volatility, max drawdown, VaR)
3. Payback period
4. Internal rate of return (IRR)
5. Net present value (NPV)
6. Risk-adjusted return (Sharpe ratio)
Consider market conditions and comparable investments.`,
schema: {
returns: {
type: 'object',
properties: {
baseCase: { type: 'number' },
optimistic: { type: 'number' },
pessimistic: { type: 'number' },
probability: { type: 'object' },
},
},
risk: {
type: 'object',
properties: {
volatility: { type: 'number' },
maxDrawdown: { type: 'number' },
var95: { type: 'number' },
sharpeRatio: { type: 'number' },
},
},
metrics: {
type: 'object',
properties: {
paybackPeriod: { type: 'number' },
irr: { type: 'number' },
npv: { type: 'number' },
roe: { type: 'number' },
},
},
},
})
// 2. Risk assessment
const riskAssessment = await ai.generate({
model: 'gpt-5',
prompt: `Assess investment risks:
Investment: ${JSON.stringify(investment)}
Financial analysis: ${JSON.stringify(financialAnalysis.data)}
Identify:
1. Market risks
2. Execution risks
3. Competitive risks
4. Regulatory risks
5. Financial risks
For each risk:
- Probability (low/medium/high)
- Impact (low/medium/high)
- Mitigation strategies
- Red flags`,
schema: {
risks: {
type: 'array',
items: {
type: 'object',
properties: {
category: { type: 'string' },
description: { type: 'string' },
probability: { type: 'string' },
impact: { type: 'string' },
mitigation: { type: 'array' },
redFlags: { type: 'array' },
},
},
},
overallRisk: { type: 'string' },
},
})
// 3. Portfolio fit analysis
const portfolioAnalysis = await ai.generate({
model: 'gpt-5',
prompt: `Analyze how this investment fits in the portfolio:
Investment: ${JSON.stringify(investment)}
Current portfolio: ${JSON.stringify(portfolio)}
Risk tolerance: ${riskTolerance}
Objectives: ${JSON.stringify(objectives)}
Assess:
1. Diversification benefit
2. Correlation with existing holdings
3. Impact on portfolio risk/return
4. Alignment with objectives
5. Optimal allocation`,
schema: {
diversificationBenefit: { type: 'string' },
correlation: { type: 'number' },
portfolioImpact: {
type: 'object',
properties: {
expectedReturnChange: { type: 'number' },
riskChange: { type: 'number' },
sharpeRatioChange: { type: 'number' },
},
},
alignment: { type: 'string' },
recommendedAllocation: { type: 'number' },
},
})
// 4. Generate recommendation
const recommendation = await ai.generate({
model: 'gpt-5',
prompt: `Provide investment recommendation:
Financial analysis: ${JSON.stringify(financialAnalysis.data)}
Risk assessment: ${JSON.stringify(riskAssessment.data)}
Portfolio fit: ${JSON.stringify(portfolioAnalysis.data)}
Risk tolerance: ${riskTolerance}
Provide:
1. Clear recommendation (strong-buy/buy/hold/pass)
2. Rationale
3. Suggested allocation
4. Entry strategy
5. Exit criteria
6. Monitoring plan`,
schema: {
recommendation: { type: 'string' },
rationale: { type: 'string' },
allocation: { type: 'number' },
entryStrategy: { type: 'string' },
exitCriteria: { type: 'array' },
monitoring: {
type: 'object',
properties: {
metrics: { type: 'array' },
frequency: { type: 'string' },
triggers: { type: 'array' },
},
},
confidence: { type: 'number' },
},
})
await send($.ServiceResult.deliver, {
requestId: request.id,
outputs: {
executiveSummary: generateInvestmentSummary({
investment,
financial: financialAnalysis.data,
recommendation: recommendation.data,
}),
financialAnalysis: financialAnalysis.data,
riskAssessment: riskAssessment.data,
portfolioAnalysis: portfolioAnalysis.data,
recommendation: recommendation.data,
visualizations: await generateInvestmentCharts({
financial: financialAnalysis.data,
risk: riskAssessment.data,
}),
},
})
const tier = investmentAnalysisService.pricing.tiers.find((t: any) => t.name === request.inputs.analysisDepth)
await send($.Payment.charge, {
customerId: request.customerId,
amount: tier!.price,
description: `Investment Analysis: ${investment.name}`,
})
})
function generateInvestmentSummary(data: any): string {
return `
# Investment Analysis: ${data.investment.name}
## Recommendation: ${data.recommendation.recommendation.toUpperCase()}
## Key Metrics
- Expected Return: ${data.financial.returns.baseCase}%
- Risk (Volatility): ${data.financial.risk.volatility}%
- Sharpe Ratio: ${data.financial.risk.sharpeRatio}
- IRR: ${data.financial.metrics.irr}%
## Confidence: ${data.recommendation.confidence * 100}%
${data.recommendation.rationale}
`.trim()
}
async function generateInvestmentCharts(data: any) {
return {
returnDistribution: 'histogram showing return scenarios',
riskReturn: 'scatter plot of risk vs return',
scenarioAnalysis: 'tree diagram of different scenarios',
}
}Strategic Planning Service
Help develop and evaluate strategic plans:
import $, { ai, db, on, send } from 'sdk.do'
const strategicPlanningService = await $.Service.create({
id: 'strategic-planner',
name: 'Strategic Planning Support',
description: 'Develop and evaluate strategic plans with scenario modeling',
type: $.ServiceType.DecisionSupport,
subtype: 'strategic-planning',
pricing: {
model: 'per-engagement',
basePrice: 5000,
variables: {
complexity: { simple: 1.0, moderate: 1.5, complex: 2.5 },
timeframe: { perYear: 500 },
stakeholders: { perDepartment: 250 },
},
},
})
on($.ServiceRequest.created, async (request) => {
if (request.serviceId !== strategicPlanningService.id) return
const { company, currentStrategy, objectives, timeframe, constraints } = request.inputs
// 1. Analyze current state
const situationAnalysis = await ai.generate({
model: 'gpt-5',
prompt: `Perform situation analysis (SWOT):
Company: ${JSON.stringify(company)}
Current strategy: ${JSON.stringify(currentStrategy)}
Identify:
- Strengths
- Weaknesses
- Opportunities
- Threats
Be specific and actionable.`,
schema: {
strengths: { type: 'array' },
weaknesses: { type: 'array' },
opportunities: { type: 'array' },
threats: { type: 'array' },
keyInsights: { type: 'array' },
},
})
// 2. Generate strategic options
const strategicOptions = await ai.generate({
model: 'gpt-5',
prompt: `Generate 4-5 strategic options:
Situation: ${JSON.stringify(situationAnalysis.data)}
Objectives: ${JSON.stringify(objectives)}
Timeframe: ${timeframe}
Constraints: ${JSON.stringify(constraints)}
For each option:
- Description
- Key initiatives
- Resource requirements
- Expected outcomes
- Risks
- Timeline`,
schema: {
options: {
type: 'array',
items: {
type: 'object',
properties: {
name: { type: 'string' },
description: { type: 'string' },
initiatives: { type: 'array' },
resources: { type: 'object' },
outcomes: { type: 'object' },
risks: { type: 'array' },
timeline: { type: 'string' },
},
},
},
},
})
// 3. Evaluate each option
const evaluation = await ai.generate({
model: 'gpt-5',
prompt: `Evaluate strategic options:
Options: ${JSON.stringify(strategicOptions.data)}
Objectives: ${JSON.stringify(objectives)}
Score each option (0-100) on:
- Strategic fit
- Feasibility
- Expected ROI
- Risk level
- Time to value
- Resource efficiency
Provide overall ranking and recommendation.`,
schema: {
evaluations: {
type: 'array',
items: {
type: 'object',
properties: {
optionName: { type: 'string' },
scores: { type: 'object' },
overallScore: { type: 'number' },
pros: { type: 'array' },
cons: { type: 'array' },
},
},
},
recommendedOption: { type: 'string' },
rationale: { type: 'string' },
},
})
// 4. Create implementation roadmap
const roadmap = await ai.generate({
model: 'gpt-5',
prompt: `Create implementation roadmap for recommended strategy:
Strategy: ${evaluation.data.recommendedOption}
Timeframe: ${timeframe}
Include:
- Quarterly milestones
- Key initiatives by quarter
- Resource allocation
- Success metrics
- Risk mitigation steps`,
schema: {
quarters: {
type: 'array',
items: {
type: 'object',
properties: {
quarter: { type: 'string' },
milestones: { type: 'array' },
initiatives: { type: 'array' },
resources: { type: 'object' },
metrics: { type: 'array' },
},
},
},
},
})
await send($.ServiceResult.deliver, {
requestId: request.id,
outputs: {
situationAnalysis: situationAnalysis.data,
strategicOptions: strategicOptions.data.options,
evaluation: evaluation.data,
recommendedStrategy: evaluation.data.recommendedOption,
roadmap: roadmap.data,
executiveDeck: await generateStrategyDeck({
situation: situationAnalysis.data,
options: strategicOptions.data,
recommendation: evaluation.data,
roadmap: roadmap.data,
}),
},
})
})Pricing Models
Value-Based Pricing
Charge based on value created:
const pricing = {
model: 'value-based',
valueMultiplier: 0.1, // 10% of estimated value
minimumCharge: 500.0,
valueCalculation: {
method: 'projected-impact',
timeframe: '12-months',
},
}Per-Decision Pricing
Charge per decision supported:
const pricing = {
model: 'per-decision',
tiers: [
{ complexity: 'simple', price: 100 },
{ complexity: 'moderate', price: 500 },
{ complexity: 'complex', price: 2000 },
],
}Subscription Pricing
Ongoing decision support:
const pricing = {
model: 'subscription',
tiers: [
{ name: 'team', price: 999, decisions: 50, users: 10 },
{ name: 'business', price: 2999, decisions: 200, users: 50 },
{ name: 'enterprise', price: 9999, decisions: 'unlimited', users: 'unlimited' },
],
}Best Practices
- Quantify Uncertainty: Always include confidence intervals
- Provide Alternatives: Show multiple options, not just one
- Simulate Outcomes: Model different scenarios
- Explain Reasoning: Make recommendations transparent
- Include Sensitivity Analysis: Show how results change with assumptions
- Monitor Results: Track actual outcomes vs predictions
- Continuous Learning: Improve models based on feedback
Real-World Use Cases
E-commerce Company
- Challenge: Optimize pricing across 10,000 SKUs
- Solution: Dynamic pricing optimization service
- Result: 23% revenue increase, 15% margin improvement
Investment Firm
- Challenge: Evaluate 100+ investment opportunities quarterly
- Solution: Investment analysis service
- Result: 40% faster decision-making, 18% higher returns
Manufacturing Company
- Challenge: Allocate $50M budget across 30 initiatives
- Solution: Resource allocation optimizer
- Result: 35% better ROI, completed 20% more projects
Tech Startup
- Challenge: Decide whether to expand to new market
- Solution: Strategic planning support
- Result: Data-driven expansion, 2x faster market entry
Related Resources
- AI Analysis Services - Analyze data to inform decisions
- AI Content Generation - Generate decision documentation
- Building Services Guide - Implementation details
- API Reference - Service API documentation
AI Creative Services
Build AI-powered creative services that generate designs, images, videos, music, brand assets, and visual content using the Services-as-Software framework.
Business Process Automation
Build services that automate complete business processes including invoice processing, expense management, scheduling, approvals, and document workflows