Pattern Proposal: Pluggable Provider Adapter
Summary
Isolates external API communications behind swappable client implementations for testing and runtime flexibility.
Candidate Pattern
- ID:
pluggable-provider-adapter - Classification: architectural
- Maturity: strategic_direction
- Type: emerging
Observed Signals
No specific signals listed.
Evidence
Supporting Evidence
- src/cas_runner/llm/litellm_client.py (LiteLLMClient) - Production integration with LiteLLM library.
- src/cas_runner/llm/mock_client.py (MockLLMClient) - Deterministic in-memory mock client enabling decoupled test execution.
Scope Assessment
- Evidence Strength: high
- Confidence: high
- Applies to: ideas-to-life-cas
Rationale
- Intent: Allow execution in disconnected or automated test environments by swapping real external services with mock equivalents.
- Context: The system relies on external LLM services (LiteLLM) during normal operation, but integration pipelines and tests require local deterministic responses without network calls or secrets.
- Force: Automated tests must not require API keys or incur network latencies.
- Force: Execution layer should remain unaware of whether an online or mock backend is in use.
Traceability
Artifact source: proposed-patterns