PRD 15: Multi-Model Agent Configuration

Status: Ready for Implementation Priority: P1 - High Priority Feature Enhancement Effort: 24-32 hours (3-4 days) Dependencies: PRD-02 (Agent Factory), PRD-10 (Workflow Orchestration)


Executive Summary

Transform agents from defaulting to GPT-4 to supporting user-configurable multi-model selection across OpenAI, Claude (Anthropic), and future HuggingFace models. Each agent will have its own model configuration, allowing users to select the optimal model based on agent skills, task complexity, and cost considerations.

Current State ❌

  • ✅ Agents exist and execute tasks via LLM

  • ✅ Basic model configuration in AgentMetadata (preferred_model)

  • ✅ LLM Provider abstraction supports OpenAI and Anthropic

  • ❌ All agents default to GPT-4 from environment variables

  • ❌ No UI to select models per agent

  • ❌ Limited model configuration options

  • ❌ No model metadata or capabilities tracking

  • ❌ Model configuration scattered across env vars and agent metadata

Target State ✅

  • ✅ Rich model configuration per agent

  • ✅ UI to select from available models (OpenAI, Claude, future HuggingFace)

  • ✅ Model metadata with capabilities, costs, and limits

  • ✅ Database schema for model configurations

  • ✅ Agent factory uses per-agent model configs

  • ✅ Workflow execution respects agent model choices

  • ✅ Model settings UI tab in agent configuration

  • ✅ Default models with intelligent recommendations


1. Problem Statement

Current Issues

  1. No Model Choice: All agents use GPT-4 by default, regardless of task requirements

  2. Cost Inefficiency: Simple tasks use expensive models unnecessarily

  3. No Optimization: Can't match model capabilities to agent skills

  4. Limited Flexibility: Changing models requires code/env changes

  5. Poor UX: Users can't easily select models in UI

  6. No Model Tracking: No visibility into which models agents use

Business Impact

  • Cost Optimization: Use cheaper models for simple tasks (GPT-3.5 vs GPT-4)

  • Performance Optimization: Use Claude for reasoning-heavy tasks

  • Future-Proofing: Ready for HuggingFace and custom models

  • User Control: Empower users to optimize their workflows

  • Transparency: Track model usage and costs per agent


2. Solution Overview

Architecture


3. Database Schema Updates

3.1 New Model Registry Table

3.2 Update Agents Table

3.3 Track Model Usage Per Execution


4. Backend Implementation

4.1 Model Registry Service

Location: orchestrator/services/model_registry.py

4.2 Enhanced AgentMetadata

Location: Update orchestrator/services/agent_factory.py

4.3 Update Agent Factory

Location: Update orchestrator/services/agent_factory.py

4.4 API Endpoints

Location: orchestrator/api/models_endpoints.py (NEW FILE)

Update orchestrator/api/agent_endpoints.py:


5. Frontend Implementation

5.1 Model Selection Component

Location: frontend/components/agents/model-selector.tsx (NEW FILE)

5.2 Update Agent Configuration Modal

Location: Update frontend/components/agents/agent-configuration-modal.tsx

Add a new "Model" tab:


6. Implementation Timeline

Week 1 (16h): Database & Backend Core

  • Day 1 (4h): Database schema

    • Create llm_models table with seed data

    • Add model_config column to agents table

    • Add model_usage_stats column

    • Create migrations

    • Test database changes

  • Day 2 (4h): Model Registry Service

    • Implement ModelRegistry class

    • Test model queries and recommendations

    • Seed database with OpenAI and Claude models

  • Day 3 (4h): Enhanced Agent Factory

    • Update AgentMetadata with ModelConfiguration

    • Update create_agent to use model configs

    • Implement fallback logic

    • Test agent creation with different models

  • Day 4 (4h): API Endpoints

    • Implement /api/models endpoints

    • Update /api/agents endpoints for model config

    • Test all endpoints

    • Documentation

Week 2 (16h): Frontend & Integration

  • Day 1 (4h): Model Selector Component

    • Build ModelSelector component

    • Implement model details display

    • Add provider grouping

    • Test with real API data

  • Day 2 (4h): Agent Configuration UI

    • Add "Model" tab to configuration modal

    • Implement model settings controls

    • Add fallback model selection

    • Test user flows

  • Day 3 (4h): Workflow Integration

    • Ensure workflows respect agent model configs

    • Update execution manager to track model usage

    • Add model usage to execution reports

    • Test end-to-end

  • Day 4 (4h): Testing & Polish

    • End-to-end testing

    • Fix bugs

    • Performance optimization

    • Documentation updates

Total: 32 hours (4 days)


7. Success Criteria

Functional Requirements ✅

Quality Requirements ✅

User Experience ✅


8. Testing Strategy

Unit Tests

Integration Tests


9. Future Enhancements (Post-MVP)

Phase 2: HuggingFace Integration

  • Add HuggingFace provider support

  • Support for custom/fine-tuned models

  • Model hosting configuration

  • GPU/CPU resource management

Phase 3: Advanced Features

  • Auto Model Selection: AI-driven model selection based on task

  • A/B Testing: Compare model performance

  • Cost Optimization: Automatic model switching based on budget

  • Model Fine-Tuning: Fine-tune models on agent's historical data

  • Model Analytics Dashboard: Detailed model usage and performance metrics

  • Smart Fallbacks: Intelligent fallback selection based on context

Phase 4: Enterprise Features

  • Model Versioning: Track model version changes

  • Custom Model Endpoints: Support for private LLM endpoints

  • Multi-Region Support: Different models per region

  • Compliance: Model selection based on data compliance requirements


10. Dependencies

Existing Components

  • ✅ Agent Factory (PRD-02)

  • ✅ LLM Provider Service

  • ✅ Agent Configuration UI

  • ✅ Workflow Execution (PRD-10)

External Dependencies

  • ✅ OpenAI API (already integrated)

  • ✅ Anthropic API (already integrated)

  • 🔄 HuggingFace API (future)


11. Risk Mitigation

Risk
Impact
Mitigation

Model API changes

High

Version tracking, deprecation warnings

Cost overruns

Medium

Usage limits, budget alerts

Model unavailability

High

Fallback models, retry logic

UI complexity

Medium

Progressive disclosure, good defaults

Migration issues

Medium

Backward compatibility, gradual rollout


Conclusion

PRD-15 transforms Automatos AI from a single-model platform to a flexible, multi-model system that empowers users to select the optimal model for each agent based on task requirements, cost considerations, and performance needs.

Key Outcomes:

  • ✅ User-configurable model selection

  • ✅ OpenAI and Claude support (HuggingFace ready)

  • ✅ Rich model metadata and recommendations

  • ✅ Cost tracking and optimization

  • ✅ Fallback resilience

  • ✅ Intuitive UI with model comparison

Development Time: 4 days (32 hours) Business Impact: Cost optimization, flexibility, future-proofing


Next Steps:

  1. Review and approve PRD

  2. Create database migrations

  3. Begin Week 1 implementation

  4. Daily progress updates

  5. Weekly demo of working features

Let's make Automatos AI truly multi-model! 🚀

Last updated