Skip to content

feat: add FastestStrategy routing + vendor-agnostic cleanup #139

@Aureliolo

Description

@Aureliolo

Summary

Two related changes bundled together:

  1. Add FastestStrategy routing strategy — selects the model with the lowest estimated_latency_ms, as specified in DESIGN_SPEC §9.4
  2. Remove all vendor-specific names from source code, tests, and documentation — enforce vendor-agnostic naming everywhere

Success Criteria

FastestStrategy

  • ProviderModelConfig has estimated_latency_ms: int | None field (default None, gt=0)
  • ResolvedModel has matching estimated_latency_ms field, wired from config
  • ModelResolver.all_models_sorted_by_latency() returns models sorted ascending, None last
  • FastestStrategy class implements RoutingStrategy protocol with name = "fastest"
  • Strategy picks the fastest model within budget; falls back to cheapest when no latency data exists
  • Mixed None/non-None latency: only models with data are considered
  • Budget exceeded by all fast models: returns fastest anyway with warning in reason
  • No models registered: raises NoAvailableModelError
  • STRATEGY_NAME_FASTEST constant and FastestStrategy re-exported through routing/__init__.py and providers/__init__.py
  • Registered in STRATEGY_MAP as "fastest"
  • DESIGN_SPEC §9.4 comment updated to list all 6 implemented strategies

Vendor-Agnostic Cleanup

  • Zero mentions of Anthropic, Claude, Opus, Sonnet, Haiku in src/ (code + docstrings + comments)
  • Zero mentions in tests/ (all .py files)
  • Generic naming convention used consistently:
    • Provider: example-provider
    • Model IDs: example-large-001, example-medium-001, example-small-001
    • Aliases: large, medium, small
    • Test fixtures: test-provider, test-small-001, test-medium-001, test-large-001
  • DESIGN_SPEC.md examples use generic names (vendor names only in factual industry references like MCP ownership)
  • README.md provider description is vendor-neutral
  • CLAUDE.md has explicit vendor-agnostic rule to prevent future regression

Quality Gates

  • All 1850 tests pass
  • Coverage ≥ 80% (actual: 94.97%)
  • ruff check clean
  • mypy --strict clean
  • All pre-commit hooks pass

Branch

feat/fastest-strategy-vendor-cleanup

Files Changed (40 files)

Source (15 files):

  • src/ai_company/config/schema.py — latency field + docstring cleanup
  • src/ai_company/providers/routing/models.py — latency field on ResolvedModel
  • src/ai_company/providers/routing/resolver.py — wire latency + all_models_sorted_by_latency()
  • src/ai_company/providers/routing/strategies.pyFastestStrategy + _fastest_within_budget() helper
  • src/ai_company/providers/routing/__init__.py — re-exports
  • src/ai_company/providers/__init__.py — re-exports
  • src/ai_company/core/agent.py — docstring cleanup
  • src/ai_company/providers/drivers/__init__.py — docstring cleanup
  • src/ai_company/providers/drivers/litellm_driver.py — docstring cleanup
  • src/ai_company/providers/drivers/mappers.py — comment cleanup
  • src/ai_company/providers/models.py — docstring cleanup
  • src/ai_company/providers/registry.py — docstring cleanup

Tests (25 files): vendor name replacements + new FastestStrategy/latency tests

Docs (3 files): CLAUDE.md, DESIGN_SPEC.md, README.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:highImportant, should be prioritizedscope:medium1-3 days of workspec:providersDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationtype:refactorCode restructuring, cleanup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions