Skip to main content

Workflow Examples

These detailed workflow examples demonstrate how Expert Fabric orchestrates AI and human experts to deliver complex solutions across different domains.

Example 1: Financial Analysis Workflow

Scenario

A mid-size technology company's CFO needs a comprehensive financial health assessment for an upcoming board meeting. The analysis must include financial ratios, trend analysis, peer comparisons, and strategic recommendations.

Input Materials

  • Q4 2024 financial statements (10-K, 10-Q filings)
  • Previous 3 years of financial data
  • Industry benchmark data
  • Competitor financial information
  • Board presentation template

Workflow Execution

Phase 1: Task Decomposition (5 minutes)

Orchestrator Analysis:

{
"taskId": "fin-2024-q4-analysis",
"complexity": "high",
"estimatedDuration": "4-6 hours",
"requiredExpertise": ["financial-analysis", "industry-knowledge", "strategic-planning"],
"subtasks": [
{
"id": "data-extraction",
"type": "ai-primary",
"estimatedTime": "30 minutes",
"assignedNode": "financial-data-processor-ai"
},
{
"id": "ratio-analysis",
"type": "ai-primary",
"estimatedTime": "45 minutes",
"assignedNode": "financial-calculator-ai"
},
{
"id": "trend-analysis",
"type": "ai-primary",
"estimatedTime": "1 hour",
"assignedNode": "trend-analyzer-ai"
},
{
"id": "peer-comparison",
"type": "ai-human-collab",
"estimatedTime": "1.5 hours",
"assignedNodes": ["market-research-ai", "senior-financial-analyst"]
},
{
"id": "risk-assessment",
"type": "human-primary",
"estimatedTime": "1 hour",
"assignedNode": "senior-financial-analyst"
},
{
"id": "strategic-insights",
"type": "human-primary",
"estimatedTime": "1 hour",
"assignedNode": "financial-strategist"
}
]
}

Phase 2: Data Processing (30 minutes)

AI Node: Financial Data Processor

class FinancialDataProcessor(AIExpertNode):
async def process_financial_documents(self, documents: List[Document]) -> ProcessedData:
extracted_data = {}

for doc in documents:
# Extract financial statements
income_statement = await self.extract_income_statement(doc)
balance_sheet = await self.extract_balance_sheet(doc)
cash_flow = await self.extract_cash_flow_statement(doc)

# Validate data consistency
validation_results = await self.validate_financial_data({
'income_statement': income_statement,
'balance_sheet': balance_sheet,
'cash_flow': cash_flow
})

extracted_data[doc.period] = {
'statements': {
'income': income_statement,
'balance': balance_sheet,
'cash_flow': cash_flow
},
'validation': validation_results
}

return ProcessedData(
data=extracted_data,
quality_score=self.calculate_data_quality(extracted_data),
processing_notes=self.generate_processing_notes(extracted_data)
)

Output:

  • Structured financial data for 4 quarters
  • Data quality assessment (98% confidence)
  • Identified data gaps and inconsistencies
  • Processing notes for human review

Phase 3: Ratio Analysis (45 minutes)

AI Node: Financial Calculator

async def calculate_financial_ratios(self, financial_data: ProcessedData) -> RatioAnalysis:
ratios = {}

for period, data in financial_data.items():
period_ratios = {
# Liquidity Ratios
'current_ratio': data.balance.current_assets / data.balance.current_liabilities,
'quick_ratio': (data.balance.current_assets - data.balance.inventory) / data.balance.current_liabilities,
'cash_ratio': data.balance.cash / data.balance.current_liabilities,

# Efficiency Ratios
'asset_turnover': data.income.revenue / data.balance.total_assets,
'inventory_turnover': data.income.cogs / data.balance.inventory,
'receivables_turnover': data.income.revenue / data.balance.accounts_receivable,

# Leverage Ratios
'debt_to_equity': data.balance.total_debt / data.balance.shareholders_equity,
'debt_to_assets': data.balance.total_debt / data.balance.total_assets,
'interest_coverage': data.income.ebit / data.income.interest_expense,

# Profitability Ratios
'gross_margin': data.income.gross_profit / data.income.revenue,
'operating_margin': data.income.operating_income / data.income.revenue,
'net_margin': data.income.net_income / data.income.revenue,
'roa': data.income.net_income / data.balance.total_assets,
'roe': data.income.net_income / data.balance.shareholders_equity
}

ratios[period] = period_ratios

return RatioAnalysis(
ratios=ratios,
trends=self.calculate_ratio_trends(ratios),
flags=self.identify_concerning_ratios(ratios),
industry_comparison=await self.compare_to_industry_benchmarks(ratios)
)

Phase 4: Human Expert Review (1 hour)

Human Expert: Senior Financial Analyst

The financial analyst receives:

  • Processed financial data with 98% confidence score
  • Calculated ratios and trends
  • AI-identified concerns and flags
  • Industry benchmark comparisons

Expert Activities:

  1. Validation Review (15 minutes)

    • Verify AI calculations and data extraction
    • Validate industry comparisons
    • Confirm trend analysis accuracy
  2. Contextual Analysis (30 minutes)

    • Add industry-specific insights
    • Consider macroeconomic factors
    • Evaluate management guidance and strategy
    • Assess one-time items and adjustments
  3. Risk Assessment (15 minutes)

    • Identify financial risks not captured by ratios
    • Evaluate covenant compliance
    • Assess liquidity and cash flow sustainability
    • Consider market and competitive risks

Expert Output:

{
"validation_summary": {
"ai_accuracy": "96%",
"data_quality": "excellent",
"corrections_made": 3,
"confidence_level": "high"
},
"contextual_insights": [
"Q4 revenue growth driven by new product launch, sustainable into 2025",
"Inventory increase strategic for anticipated demand surge",
"Debt increase planned for expansion, well within industry norms",
"Cash position strong despite capex investments"
],
"risk_factors": [
"Customer concentration risk - top 3 customers represent 45% of revenue",
"Interest rate sensitivity due to variable rate debt",
"Seasonal revenue patterns may impact Q1 2025 cash flow"
],
"recommendations": [
"Diversify customer base to reduce concentration risk",
"Consider fixed-rate debt refinancing given rate environment",
"Maintain current cash reserves given expansion plans"
]
}

Phase 5: Strategic Synthesis (1 hour)

Human Expert: Financial Strategist

Receives complete analysis and adds strategic layer:

  1. Strategic Context (20 minutes)

    • Market position analysis
    • Competitive landscape assessment
    • Growth strategy alignment
  2. Board-Level Insights (25 minutes)

    • Key performance drivers
    • Strategic recommendations
    • Investment priorities
  3. Presentation Preparation (15 minutes)

    • Executive summary creation
    • Key metrics dashboard
    • Talking points for CFO

Phase 6: Report Generation & Quality Assurance (30 minutes)

AI Node: Report Generator creates structured report with:

  • Executive summary (1 page)
  • Detailed financial analysis (8 pages)
  • Appendices with calculations and data (5 pages)
  • Interactive dashboard for board presentation

Human Expert: Final Review (15 minutes)

  • Ensures narrative coherence
  • Validates conclusions align with analysis
  • Confirms board-appropriate language and focus

Final Deliverable

Executive Summary: "Company X demonstrates strong financial health with improving profitability margins (net margin increased from 12% to 15% YoY) and solid liquidity position (current ratio 2.1x). Revenue growth of 18% driven by successful new product launches. Key strategic priorities: customer diversification to reduce concentration risk and debt refinancing to lock in favorable rates."

Complete Package:

  • 14-page comprehensive financial analysis
  • Board presentation with key metrics dashboard
  • Risk assessment with mitigation strategies
  • Strategic recommendations with implementation roadmap
  • Interactive financial model for scenario analysis

Delivery Time: 4.5 hours vs. traditional 2-3 weeks Cost: $1,800 vs. $15,000+ for external consultant Quality: AI thoroughness + expert strategic insight


Example 2: Software Development Workflow

Scenario

A fintech startup needs a secure user authentication system with multi-factor authentication, OAuth integration, and audit logging for their Node.js/React application.

Requirements

  • JWT-based authentication
  • MFA support (TOTP, SMS backup)
  • OAuth integration (Google, GitHub)
  • Role-based access control
  • Audit logging and compliance
  • Rate limiting and security headers
  • Comprehensive testing

Workflow Execution

Phase 1: Requirements Analysis (30 minutes)

AI Node: Requirements Analyzer

interface AuthenticationRequirements {
functional: {
authMethods: ['email/password', 'oauth', 'mfa'];
oauthProviders: ['google', 'github'];
mfaMethods: ['totp', 'sms'];
sessionManagement: 'jwt';
roles: ['user', 'admin', 'developer'];
};

nonFunctional: {
security: ['bcrypt', 'jwt', 'rate-limiting', 'csrf-protection'];
compliance: ['audit-logging', 'gdpr-ready'];
performance: ['< 200ms auth', '> 1000 req/s'];
scalability: ['horizontal-scaling', 'stateless-sessions'];
};

technical: {
backend: 'node.js/express';
frontend: 'react';
database: 'postgresql';
deployment: 'docker/kubernetes';
};
}

Human Expert: Solution Architect validates and refines:

  • Confirms security requirements meet fintech standards
  • Adds compliance considerations (PCI DSS, SOX)
  • Recommends additional security measures
  • Validates technical architecture decisions

Phase 2: Code Generation (2 hours)

AI Node: Backend Developer

// Generated authentication service
@Injectable()
export class AuthService {
constructor(
private userService: UserService,
private jwtService: JwtService,
private mfaService: MfaService,
private auditService: AuditService
) {}

async login(email: string, password: string, ip: string): Promise<LoginResult> {
// Rate limiting check
await this.checkRateLimit(email, ip);

// Validate credentials
const user = await this.validateCredentials(email, password);

// Check if MFA required
if (user.mfaEnabled) {
const challenge = await this.mfaService.createChallenge(user.id);
await this.auditService.log('MFA_CHALLENGE_CREATED', user.id, ip);

return {
requiresMfa: true,
challengeId: challenge.id,
availableMethods: user.mfaMethods
};
}

// Generate tokens
const tokens = await this.generateTokens(user);
await this.auditService.log('LOGIN_SUCCESS', user.id, ip);

return {
accessToken: tokens.accessToken,
refreshToken: tokens.refreshToken,
user: this.sanitizeUser(user)
};
}

async validateMfa(
challengeId: string,
code: string,
method: MfaMethod
): Promise<LoginResult> {
const challenge = await this.mfaService.validateChallenge(
challengeId,
code,
method
);

if (!challenge.valid) {
await this.auditService.log('MFA_FAILED', challenge.userId);
throw new UnauthorizedException('Invalid MFA code');
}

const user = await this.userService.findById(challenge.userId);
const tokens = await this.generateTokens(user);

await this.auditService.log('LOGIN_SUCCESS_MFA', user.id);

return {
accessToken: tokens.accessToken,
refreshToken: tokens.refreshToken,
user: this.sanitizeUser(user)
};
}
}

AI Node: Frontend Developer

// Generated React authentication hook
export const useAuth = () => {
const [user, setUser] = useState<User | null>(null);
const [loading, setLoading] = useState(true);

const login = async (email: string, password: string): Promise<LoginResult> => {
setLoading(true);

try {
const result = await authAPI.login(email, password);

if (result.requiresMfa) {
return result; // Handle MFA flow
}

localStorage.setItem('accessToken', result.accessToken);
localStorage.setItem('refreshToken', result.refreshToken);
setUser(result.user);

return result;
} catch (error) {
throw new Error(error.message);
} finally {
setLoading(false);
}
};

const loginWithOAuth = async (provider: 'google' | 'github') => {
const popup = window.open(
`/auth/oauth/${provider}`,
'oauth',
'width=500,height=600'
);

return new Promise((resolve, reject) => {
const messageHandler = (event: MessageEvent) => {
if (event.origin !== window.location.origin) return;

if (event.data.type === 'OAUTH_SUCCESS') {
localStorage.setItem('accessToken', event.data.accessToken);
localStorage.setItem('refreshToken', event.data.refreshToken);
setUser(event.data.user);
resolve(event.data);
} else if (event.data.type === 'OAUTH_ERROR') {
reject(new Error(event.data.error));
}

window.removeEventListener('message', messageHandler);
popup?.close();
};

window.addEventListener('message', messageHandler);
});
};

return {
user,
loading,
login,
loginWithOAuth,
logout,
isAuthenticated: !!user
};
};

Phase 3: Security Review (1 hour)

Human Expert: Security Specialist

Reviews generated code for:

  1. Authentication Security (20 minutes)

    • Password hashing implementation
    • JWT token security (expiration, signing)
    • Session management best practices
  2. MFA Implementation (20 minutes)

    • TOTP secret generation and validation
    • SMS backup security considerations
    • Challenge-response flow security
  3. OAuth Security (20 minutes)

    • State parameter validation
    • PKCE implementation for mobile
    • Redirect URI validation

Security Improvements:

// Enhanced security measures added by expert
export class SecurityEnhancedAuthService extends AuthService {
async login(email: string, password: string, ip: string): Promise<LoginResult> {
// Add device fingerprinting
const deviceFingerprint = await this.generateDeviceFingerprint(ip);

// Check for suspicious activity
await this.checkSuspiciousActivity(email, ip, deviceFingerprint);

// Add geographic validation
await this.validateGeographicAccess(email, ip);

return super.login(email, password, ip);
}

private async checkSuspiciousActivity(
email: string,
ip: string,
fingerprint: string
): Promise<void> {
const recentAttempts = await this.getRecentLoginAttempts(email);

// Check for multiple IPs
const uniqueIPs = new Set(recentAttempts.map(a => a.ip));
if (uniqueIPs.size > 3) {
await this.triggerSecurityAlert(email, 'MULTIPLE_IP_ACCESS');
}

// Check for rapid succession attempts
const rapidAttempts = recentAttempts.filter(
a => Date.now() - a.timestamp < 60000
);
if (rapidAttempts.length > 5) {
await this.triggerSecurityAlert(email, 'RAPID_LOGIN_ATTEMPTS');
}
}
}

Phase 4: Testing & Documentation (1.5 hours)

AI Node: Test Generator

// Generated comprehensive test suite
describe('AuthService', () => {
describe('login', () => {
it('should successfully authenticate valid credentials', async () => {
const result = await authService.login('test@example.com', 'validPassword', '127.0.0.1');

expect(result.accessToken).toBeDefined();
expect(result.user.email).toBe('test@example.com');
});

it('should require MFA for enabled users', async () => {
const result = await authService.login('mfa@example.com', 'validPassword', '127.0.0.1');

expect(result.requiresMfa).toBe(true);
expect(result.challengeId).toBeDefined();
});

it('should reject invalid credentials', async () => {
await expect(
authService.login('test@example.com', 'invalidPassword', '127.0.0.1')
).rejects.toThrow('Invalid credentials');
});

it('should enforce rate limiting', async () => {
// Simulate multiple failed attempts
for (let i = 0; i < 5; i++) {
try {
await authService.login('test@example.com', 'wrong', '127.0.0.1');
} catch (e) {}
}

await expect(
authService.login('test@example.com', 'validPassword', '127.0.0.1')
).rejects.toThrow('Rate limit exceeded');
});
});

describe('OAuth', () => {
it('should handle Google OAuth flow', async () => {
const mockGoogleUser = { id: '123', email: 'test@gmail.com' };
jest.spyOn(googleOAuth, 'validateToken').mockResolvedValue(mockGoogleUser);

const result = await authService.handleOAuthCallback('google', 'valid-code');

expect(result.user.email).toBe('test@gmail.com');
expect(result.accessToken).toBeDefined();
});
});
});

Human Expert: QA Engineer adds integration tests and performance tests:

  • End-to-end authentication flows
  • Load testing for rate limiting
  • Security penetration tests
  • Browser compatibility testing

Phase 5: Deployment Setup (30 minutes)

AI Node: DevOps Assistant

# Generated Docker configuration
FROM node:18-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .

# Security hardening
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
USER nextjs

EXPOSE 3000

CMD ["npm", "start"]

---
# Kubernetes deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-service
spec:
replicas: 3
selector:
matchLabels:
app: auth-service
template:
metadata:
labels:
app: auth-service
spec:
containers:
- name: auth-service
image: fintech-app/auth-service:latest
ports:
- containerPort: 3000
env:
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: auth-secrets
key: jwt-secret
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: auth-secrets
key: database-url
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"

Final Deliverable

Complete Authentication System:

  • Secure backend API with JWT, MFA, and OAuth
  • React frontend with authentication hooks and components
  • Comprehensive test suite (85% code coverage)
  • Security-hardened deployment configuration
  • Complete documentation and API reference
  • Compliance audit trail and logging

Delivery Time: 5 hours vs. 2-3 weeks traditional development Quality: Production-ready with security expert validation Coverage: 100% of requirements met with additional security enhancements

This workflow demonstrates how Expert Fabric combines AI efficiency with human expertise to deliver complex, production-ready solutions rapidly while maintaining high quality and security standards.