Skip to content

feat(agents): admin-switchable copilot provider (cloud ↔ local)#366

Merged
sudoshi merged 1 commit into
mainfrom
feature/admin-copilot-provider-switch
Jun 16, 2026
Merged

feat(agents): admin-switchable copilot provider (cloud ↔ local)#366
sudoshi merged 1 commit into
mainfrom
feature/admin-copilot-provider-switch

Conversation

@sudoshi

@sudoshi sudoshi commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

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_PROVIDER env (edit .env + recreate python-ai). The Admin → AI Providers page already picks the active provider for the chat/RAG path; python-ai's copilots never read ai_provider_settings. This wires Laravel as authoritative and passes a per-session provider override into the session-create call.

What

  • New system setting agents.provider_mode: cloud (default) | local | auto.
    • cloud → Anthropic (preserves EE) · local → local via claude-router proxy · auto → local iff the active ai_provider_settings row is an enabled ollama, else cloud.
  • AgentProviderResolver maps mode (+ active provider) → anthropic|local.
  • The 3 copilot controllers (Abby/StudyDesign/Publish) pass provider into /agent/sessions.
  • python-ai: CreateSessionRequest.provider + AgentSessionState.provider_override; resolve precedence request > profile > env.
  • AgentSettingsController show/update manage provider_mode (+ local_ready).
  • AI Agents admin card gets a Cloud / Local / Auto selector + a "no local provider active" 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. 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

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>
@sudoshi sudoshi changed the base branch from feature/local-model-agent-backend-ce to main June 16, 2026 19:34
@sudoshi sudoshi merged commit 6186299 into main Jun 16, 2026
1 check passed
@sudoshi sudoshi deleted the feature/admin-copilot-provider-switch branch June 16, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant