circle-arrow-up-leftAdvanced Orchestration

Overview

The Advanced Orchestration feature provides intelligent routing between AI models based on task characteristics. It automatically analyzes incoming prompts and routes them to the most suitable provider and model combination for optimal performance and cost efficiency.

Key Features

🧠 Binary Task Classification

  • Fast Tasks: Simple queries, calculations, quick facts → Routed to Vertex AI Gemini 2.5 Flash

  • Reasoning Tasks: Complex analysis, philosophical questions, detailed explanations → Routed to Vertex AI Claude Sonnet 4

⚡ Intelligent Model Routing

  • Automatic provider and model selection based on task type

  • Optimizes for response speed vs. reasoning capability

  • Built-in confidence scoring for classification accuracy

🎯 Precedence Hierarchy

  1. User-specified provider/model (highest priority)

  2. Orchestration routing (when no provider specified)

  3. Auto provider selection (fallback)

  4. Graceful error handling

🔄 Zero Breaking Changes

  • Completely optional feature (disabled by default)

  • Existing functionality preserved

  • Backward compatible with all existing code

Usage

Basic Usage

Advanced Usage

Manual Classification and Routing

Task Classification Logic

Fast Tasks (→ Gemini 2.5 Flash)

  • Short prompts (< 50 characters)

  • Keywords: quick, fast, simple, what, time, weather, calculate, translate

  • Patterns: Questions, calculations, greetings, simple requests

  • Examples:

    • "What's 2+2?"

    • "Current time?"

    • "Quick weather update"

    • "Translate 'hello' to Spanish"

Reasoning Tasks (→ Claude Sonnet 4)

  • Complex prompts (detailed analysis requests)

  • Keywords: analyze, explain, compare, design, strategy, implications, philosophy, complex

  • Patterns: Analysis requests, philosophical questions, strategy development

  • Examples:

    • "Analyze the ethical implications of AI in healthcare"

    • "Compare different economic theories"

    • "Design a comprehensive climate strategy"

    • "Explain the philosophical implications of consciousness"

Configuration Options

Constructor Options

Environment Variables

The orchestration system uses unified Vertex AI for both fast and reasoning tasks:

Architecture

Components

  1. BinaryTaskClassifier: Analyzes prompts and classifies as 'fast' or 'reasoning'

  2. ModelRouter: Maps task types to optimal provider/model combinations

  3. NeurosLink AI Integration: Orchestration logic integrated into main generation flow

  4. Precedence Engine: Handles priority between user preferences and orchestration

Flow Diagram

Error Handling

  • Orchestration Failure: Falls back to auto provider selection

  • Provider Unavailable: Uses next best available provider

  • Classification Errors: Defaults to fast task routing

  • Network Issues: Standard NeurosLink AI retry mechanisms apply

Performance

Response Time Optimization

  • Fast tasks: Target <2s response time with Gemini Flash

  • Reasoning tasks: Accept longer response time for better quality with Claude Sonnet 4

  • Classification overhead: <10ms per request

  • Routing overhead: <5ms per request

Cost Optimization

  • Fast tasks: Use cost-effective Gemini Flash for simple queries

  • Reasoning tasks: Use premium Claude Sonnet 4 for complex analysis

  • Automatic scaling: Route based on complexity, not user preference

Monitoring and Analytics

Built-in Logging

Alternative: Set environment variable before running your application:

Event Monitoring

Best Practices

When to Enable Orchestration

Good use cases:

  • Mixed workloads (both simple and complex queries)

  • Cost optimization important

  • Response time optimization for simple queries

  • Large-scale applications with varied request types

Not recommended:

  • Single-purpose applications (all fast or all reasoning)

  • When you need consistent provider behavior

  • Testing/development with specific models

  • Applications requiring strict provider control

Optimization Tips

  1. Trust the Classification: The binary classifier is highly accurate (>95% confidence)

  2. Use Precedence: Override orchestration when you need specific behavior

  3. Monitor Performance: Track response times and adjust if needed

  4. Combine with Analytics: Use enableAnalytics: true to track usage patterns

Integration Patterns

Migration Guide

Gradual Adoption

Troubleshooting

Common Issues

Issue: Orchestration not working

Issue: Wrong provider selected

Issue: Performance concerns

Debug Mode

API Reference

BinaryTaskClassifier

ModelRouter

Version History

  • v7.31.0: Initial implementation of Advanced Orchestration

    • Binary task classification

    • Intelligent model routing

    • Zero breaking changes

    • Comprehensive testing and validation

Support

For questions, issues, or feature requests related to Advanced Orchestration:

  1. Check this documentation first

  2. Review the troubleshooting section

  3. Run the POC validation test: node test-orchestration-poc.js

  4. Open an issue on the NeurosLink AI repository


Advanced Orchestration is a powerful feature that makes AI model selection intelligent and automatic. Use it to optimize both performance and costs while maintaining full control when needed.

Last updated

Was this helpful?