feat(agents): admin-switchable copilot provider (cloud ↔ local)#366
Merged
Conversation
The action-taking copilots could only switch to a local model via the
AGENT_PROVIDER env (edit .env + recreate python-ai). Parthenon already has an
Admin → AI Providers page that picks the active provider for the chat/RAG path;
this wires that same surface to the copilots so a super-admin flips them at
runtime, no redeploy.
- new system setting agents.provider_mode: cloud (default) | local | auto
- cloud -> copilots use Anthropic (preserves EE)
- local -> copilots use the local model via the claude-router proxy
- auto -> local IF the active ai_provider_settings row is an enabled ollama,
else cloud
- AgentProviderResolver maps the mode (+ active provider) to anthropic|local
- the three copilot controllers (Abby/StudyDesign/Publish) pass `provider` into
the python-ai /agent/sessions call; Laravel is authoritative
- python-ai: CreateSessionRequest.provider + AgentSessionState.provider_override;
resolve_agent_provider precedence request > profile > env
- AgentSettingsController show/update manage provider_mode (+ local_ready)
- AI Agents admin card gains a Cloud/Local/Auto selector with a not-ready warning
Default is cloud deliberately: the seeder makes ollama the ACTIVE chat provider,
so auto-by-default would flip copilots to a possibly-absent proxy. Model/actions
for the local path stay deployment config (AGENT_LOCAL_*); the admin picks only
the provider.
Verified: PHP 23 (resolver/settings/abby) + Pint + PHPStan; Python 28 + mypy;
frontend 8 + tsc + vite build.
Co-Authored-By: claude-flow <ruv@ruv.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #365. Makes the Admin → AI Providers page switch the action-taking copilots between cloud (Claude) and a local model — at runtime, no redeploy.
Why
#365 made the copilots able to run on a local model, but only via the
AGENT_PROVIDERenv (edit.env+ recreatepython-ai). The Admin → AI Providers page already picks the active provider for the chat/RAG path;python-ai's copilots never readai_provider_settings. This wires Laravel as authoritative and passes a per-session provider override into the session-create call.What
agents.provider_mode:cloud(default) |local|auto.cloud→ Anthropic (preserves EE) ·local→ local via claude-router proxy ·auto→ local iff the activeai_provider_settingsrow is an enabledollama, else cloud.AgentProviderResolvermaps mode (+ active provider) →anthropic|local.providerinto/agent/sessions.python-ai:CreateSessionRequest.provider+AgentSessionState.provider_override; resolve precedence request > profile > env.AgentSettingsControllershow/update manageprovider_mode(+local_ready).Default is
clouddeliberately — the seeder makesollamathe active chat provider, soauto-by-default would flip copilots to a possibly-absent proxy. The specific local model + actions stay deployment config (AGENT_LOCAL_*); the admin picks only the provider.Verification
PHP 23 (resolver 7 / settings 11 / abby 5) + Pint + PHPStan · Python 28 + mypy · frontend 8 + tsc + vite build. All green.
🤖 Generated with claude-flow