P3 Tech Debt: Remove Anthropic Partial Wiring
Date: 2025-12-03 Status: OPEN Severity: P3 (Tech Debt / Simplification) Component: Architecture / Provider Integration
Summary
Remove all Anthropic-related code, configuration, and references from the codebase. Anthropic is partially wired but not fully threaded through the architecture, creating confusion and half-implemented code paths.
Rationale
1. Anthropic Does NOT Provide Embeddings
Our architecture requires embeddings for:
- RAG (LlamaIndex/ChromaDB)
- Evidence deduplication
- Semantic search
Anthropic only provides chat completion, not embeddings. This means even with a working Anthropic chat client, users would need a second provider for embeddings, breaking the unified experience.
2. Partial Implementation Creates Confusion
Current state:
settings.anthropic_api_keyexists βsettings.has_anthropic_keyproperty exists βsettings.anthropic_modelconfigured βAnthropicChatClientfor agent_framework DOES NOT EXIST β- Code raises
NotImplementedErrorwhen Anthropic detected β
This half-state causes:
- User confusion ("Why doesn't my Anthropic key work?")
- Developer confusion ("Is Anthropic supported or not?")
- Dead code paths that need maintenance
3. Unified Architecture Principle
Principle: Only support providers that work end-to-end through the entire stack:
Provider Requirements:
βββ Chat Completion (for agents) β
Required
βββ Function/Tool Calling β
Required
βββ Embeddings (for RAG) β
Required
βββ Streaming β
Required
| Provider | Chat | Tools | Embeddings | Streaming | Status |
|---|---|---|---|---|---|
| OpenAI | β | β | β | β | KEEP |
| HuggingFace | β | β | β (local) | β | KEEP |
| Gemini | β | β | β | β | Future (Phase 4) |
| Anthropic | β | β | β | β | REMOVE |
Files to Clean Up
Configuration
-
src/utils/config.py- Removeanthropic_api_key,anthropic_model,has_anthropic_key
Client Factory
-
src/clients/factory.py- Remove Anthropic detection andNotImplementedError
Legacy Code (pydantic-ai based)
-
src/utils/llm_factory.py- RemoveAnthropicModel,AnthropicProviderimports and handling -
src/agent_factory/judges.py- Remove Anthropic model selection
App/UI
-
src/app.py- Removehas_anthropic_keychecks and "Anthropic from env" backend info
Documentation
-
CLAUDE.md- Update LLM provider list -
AGENTS.md- Update LLM provider list -
GEMINI.md- Update LLM provider list
Tests
-
tests/unit/clients/test_chat_client_factory.py- Remove Anthropic test cases -
tests/unit/utils/test_config.py- Remove Anthropic config tests
Code Snippets to Remove
src/utils/config.py
# REMOVE these lines:
anthropic_api_key: str | None = Field(default=None, description="Anthropic API key")
anthropic_model: str = Field(
default="claude-sonnet-4-5-20250929", description="Anthropic model"
)
@property
def has_anthropic_key(self) -> bool:
"""Check if Anthropic API key is available."""
return bool(self.anthropic_api_key)
src/clients/factory.py
# REMOVE these lines:
if api_key.startswith("sk-ant-"):
normalized = "anthropic"
if normalized == "anthropic":
raise NotImplementedError(
"Anthropic client not yet implemented. "
"Use OpenAI key (sk-...) or leave empty for free HuggingFace tier."
)
src/app.py
# REMOVE these lines:
elif settings.has_anthropic_key:
backend_info = "Paid API (Anthropic from env)"
has_anthropic = settings.has_anthropic_key
has_paid_key = has_openai or has_anthropic or bool(user_api_key)
# Change to:
has_paid_key = has_openai or bool(user_api_key)
Migration Notes
For Users with Anthropic Keys
If users have ANTHROPIC_API_KEY set in their environment:
- It will be silently ignored (not an error)
- System falls through to HuggingFace free tier
- Users should use
OPENAI_API_KEYinstead for paid tier
Future Consideration
If Anthropic adds embeddings API in the future, we can re-add support. But until then, partial support creates more confusion than value.
Definition of Done
- All Anthropic references removed from
src/ - All Anthropic tests removed or updated
- Documentation updated to reflect supported providers: OpenAI, HuggingFace, (future: Gemini)
-
make checkpasses (lint, typecheck, tests) - PR reviewed and merged
Related Documents
P2_7B_MODEL_GARBAGE_OUTPUT.md- Current free tier model quality issuesHF_FREE_TIER_ANALYSIS.md- HuggingFace provider routing analysisCLAUDE.md- Agent context with provider documentation