Omics-OS Docs
Architecture

21. Cloud/Local ArchitecturePremium

Lobster AI features a hybrid deployment architecture that seamlessly switches between cloud and local processing modes based on configuration. This desig...

PremiumThis is premium content. Upgrade for full access

Overview

Lobster AI features a hybrid deployment architecture that seamlessly switches between cloud and local processing modes based on configuration. This design enables users to choose between privacy-focused local execution and scalable cloud infrastructure without changing their workflow.

Deployment Modes

Local Mode (Default)

  • Data Privacy: All data processing occurs on your local machine
  • Full Functionality: Complete feature set with no limitations
  • Model Access: Uses AWS Bedrock or OpenAI with your API keys
  • No Dependencies: Works offline once dependencies are installed

Cloud Mode (Optional)

  • Managed Infrastructure: Scalable cloud compute resources
  • Team Collaboration: Shared workspaces and results
  • Persistent Storage: Data preserved across sessions
  • Enterprise Features: Advanced security and compliance

Architecture Pattern

Client Abstraction Layer

Both deployment modes implement the same BaseClient interface, ensuring consistent behavior:

Common Interface

class BaseClient(ABC):
    @abstractmethod
    def query(self, user_input: str, stream: bool = False) -> str:
        """Execute user query."""

    @abstractmethod
    def get_status(self) -> Dict[str, Any]:
        """Get current system status."""

    @abstractmethod
    def export_session(self) -> Dict[str, Any]:
        """Export current session."""

Local Implementation

class AgentClient(BaseClient):
    """Local processing with LangGraph agents."""

    def __init__(self, data_manager: DataManagerV2):
        self.data_manager = data_manager
        self.graph = create_bioinformatics_graph(data_manager)

Cloud Implementation

class CloudLobsterClient(BaseClient):
    """Cloud processing via REST API."""

    def __init__(self, api_key: str, base_url: str):
        self.api_key = api_key
        self.session = httpx.Client(base_url=base_url)

Automatic Mode Detection

The system automatically selects the appropriate client based on environment:

def init_client() -> BaseClient:
    """Initialize appropriate client based on environment."""

    cloud_key = os.getenv('LOBSTER_CLOUD_KEY')

    if cloud_key:
        try:
            client = CloudLobsterClient(api_key=cloud_key)
            client.get_status()  # Verify connection
            return client
        except Exception as e:
            logger.warning(f"Cloud unavailable: {e}. Falling back to local.")

    # Default to local mode
    data_manager = DataManagerV2()
    return AgentClient(data_manager=data_manager)

Configuration

Local Mode Setup

No additional configuration required beyond model API keys:

# AWS Bedrock (recommended)
export AWS_BEDROCK_ACCESS_KEY=your-access-key
export AWS_BEDROCK_SECRET_ACCESS_KEY=your-secret-key

# Or OpenAI
export OPENAI_API_KEY=your-openai-key

Cloud Mode Setup

Set the cloud API key to enable cloud processing:

export LOBSTER_CLOUD_KEY=your-cloud-api-key

The system will automatically:

  1. Detect the cloud key
  2. Attempt cloud connection
  3. Fall back to local if cloud is unavailable

Data Flow Comparison

Local Mode Flow

User Query

Lobster CLI

AgentClient (Local)

LangGraph Multi-Agent System

DataManagerV2 (Local Storage)

Analysis Results

Cloud Mode Flow

User Query

Lobster CLI

CloudLobsterClient (HTTP)

Cloud API (REST)

Cloud LangGraph System

Cloud Storage & Compute

Analysis Results (Streamed)

Feature Parity

FeatureLocal ModeCloud Mode
All analysis agents
Natural language interface
Data privacy✅ Full⚠️ Managed
ScalabilityLimited by hardware✅ Auto-scaling
Team collaboration
Persistent storageLocal only✅ Cloud
Offline capability
CostAPI key usage onlySubscription

Performance Characteristics

Local Mode

  • Latency: Low (no network overhead)
  • Throughput: Limited by local CPU/GPU
  • Storage: Limited by local disk
  • Best for: Individual researchers, sensitive data

Cloud Mode

  • Latency: Network-dependent
  • Throughput: Elastic (auto-scales)
  • Storage: S3-backed (unlimited)
  • Best for: Teams, large-scale analyses

Security Considerations

Local Mode

  • ✅ Data never leaves your machine
  • ✅ No data transmission to cloud
  • ✅ Full control over environment
  • ⚠️ Responsible for backups
  • ⚠️ Responsible for security updates

Cloud Mode

  • ✅ Encrypted data transmission (TLS)
  • ✅ Encrypted data at rest (S3)
  • ✅ Managed backups
  • ✅ SOC2/HIPAA compliance (roadmap)
  • ⚠️ Data processed in cloud

Implementation Details

Client Adapter

The LobsterClientAdapter provides a unified interface:

class LobsterClientAdapter:
    """Adapter for seamless cloud/local switching."""

    def __init__(self):
        self.client = init_client()

    def query(self, user_input: str) -> str:
        return self.client.query(user_input)

    @property
    def mode(self) -> str:
        if isinstance(self.client, CloudLobsterClient):
            return "cloud"
        return "local"

Status Reporting

Both clients report mode in status:

{
    "mode": "local",  # or "cloud"
    "data_loaded": true,
    "modalities": ["geo_gse12345"],
    "workspace": "/path/to/.lobster_workspace"
}

Migration Between Modes

Local to Cloud

# Export session from local
lobster export-session --output session.zip

# Upload to cloud (future feature)
lobster cloud upload session.zip

# Set cloud key
export LOBSTER_CLOUD_KEY=your-key

# Resume work
lobster chat

Cloud to Local

# Download session from cloud (future feature)
lobster cloud download session-id --output session.zip

# Clear cloud key
unset LOBSTER_CLOUD_KEY

# Import locally
lobster import-session session.zip

# Resume work locally
lobster chat

Best Practices

When to Use Local Mode

  • Sensitive data that cannot leave your network
  • Regulatory compliance requiring on-premise processing
  • Offline environments without internet access
  • Cost optimization for small-scale analyses
  • Development and testing

When to Use Cloud Mode

  • Large-scale analyses exceeding local hardware
  • Team collaboration requiring shared workspaces
  • Production pipelines needing high availability
  • Managed infrastructure for reduced operational overhead

Troubleshooting

Cloud Connection Fails

# System automatically falls back to local
# Check cloud key:
echo $LOBSTER_CLOUD_KEY

# Test connection:
lobster status

Local Performance Issues

# Check memory usage:
lobster status

# Consider cloud mode for large datasets:
export LOBSTER_CLOUD_KEY=your-key

Future Enhancements

Planned improvements for cloud/local architecture:

  • Hybrid execution: Start locally, scale to cloud automatically
  • Smart caching: Cache results across local/cloud
  • Collaborative workspaces: Real-time team collaboration
  • Edge processing: Hybrid local/cloud for sensitive data
  • Multi-cloud support: AWS, GCP, Azure options

Version: v0.2+ Last Updated: 2025-11-16

On this page