-
Notifications
You must be signed in to change notification settings - Fork 5
[Phase 4.D] Multi-provider LLM support — connect any model to CodeFrame #542
Copy link
Copy link
Open
Labels
architectureSystem architecture and design patternsSystem architecture and design patternsenhancementNew feature or requestNew feature or requestphase-4Phase 4: Multi-Agent CoordinationPhase 4: Multi-Agent Coordination
Description
Overview
CodeFrame should be a delivery harness, not an Anthropic-specific tool. The agent execution layer should accept any LLM — Anthropic, OpenAI, Ollama, Qwen-Coder, GLM, Deepseek, vLLM, LM Studio, or any OpenAI-compatible endpoint — chosen by the user at runtime.
Current State
The right abstraction already exists:
LLMProviderABC incodeframe/adapters/llm/base.pywithcomplete()/stream(),Purposeenum, and env var overridesAnthropicProviderimplements it correctly- ReactAgent uses it correctly — never imports
anthropicdirectly
The gap is in the worker agents and CLI plumbing:
worker_agent.py,backend_worker_agent.py,frontend_worker_agent.py,test_worker_agent.pyall hardcodeAsyncAnthropic()directlystreaming_chat.pyis wired toanthropic.AsyncAnthropic().messages.stream()- No
--llm-provider/--llm-modelCLI flags get_provider()factory only supports"anthropic"and"mock"
Architecture
Because OpenAI's API is now an industry standard (Ollama, vLLM, LM Studio, Qwen, GLM, Deepseek all expose OpenAI-compatible endpoints), two adapters cover the entire ecosystem:
codeframe/adapters/llm/
├── base.py ✅ LLMProvider ABC, Purpose enum, ModelSelector
├── anthropic.py ✅ Anthropic implementation
├── openai.py ❌ OpenAI-compatible (covers OpenAI + any base_url override)
└── mock.py ✅ Test mock
Runtime selection:
cf work start <task> --execute --llm-provider openai --llm-model qwen2.5-coder:7b
cf work start <task> --execute --llm-provider openai --llm-model gpt-4o
cf work start <task> --execute # default: anthropic, claude-sonnet-4-5Subissues (implement in order)
- [4.D.1] OpenAI-compatible LLM adapter (adapters/llm/openai.py) #543 — OpenAI-compatible LLM adapter (
adapters/llm/openai.py) - [4.D.2] Provider factory + env var wiring (get_provider, ModelSelector) #544 — Provider factory + env var wiring (
get_provider()+ModelSelector) - [4.D.3] CLI flags: --llm-provider and --llm-model on cf work start / batch run #545 — CLI flags:
--llm-providerand--llm-model - [4.D.4] Refactor worker_agent.py to use LLMProvider abstraction #546 — Refactor
worker_agent.pyto useLLMProviderabstraction - [4.D.5] Refactor backend_worker_agent, frontend_worker_agent, test_worker_agent to use LLMProvider #547 — Refactor
backend_worker_agent.py,frontend_worker_agent.py,test_worker_agent.py - [4.D.6] Abstract streaming layer (streaming_chat.py) to use LLMProvider #548 — Abstract streaming layer (
streaming_chat.py) - [4.D.7] Workspace config support for LLM provider (llm: block in config.yaml) #549 — Workspace config support (
llm:block in.codeframe/config.yaml)
Acceptance Criteria
-
cf work start <task> --execute --llm-provider openai --llm-model gpt-4oworks end-to-end -
OPENAI_BASE_URL=http://localhost:11434/v1routes to local Ollama - Default behavior (no flags) unchanged — still uses Anthropic
- All existing tests pass
- Worker agents use
LLMProviderabstraction, notAsyncAnthropicdirectly
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
architectureSystem architecture and design patternsSystem architecture and design patternsenhancementNew feature or requestNew feature or requestphase-4Phase 4: Multi-Agent CoordinationPhase 4: Multi-Agent Coordination