[Feature] Allow switching LLM provider for existing session
Problem or Motivation
When I use craft-agent, I keep several AI connections configured in Settings because I use more than one LLM provider in my daily work. Recently I was working in a session when the chosen LLM provider ran out of its usage limit. However when I tried to switch LLM provider for the current session, I realize this project does not allow user to do so.
It seems this feature is designed such that, the provider of a session is permently decided at the moment the first message is sent. The model picker still lets users switch models during the session, but it only offers options within the same provider the session started with.
Also since the Session is the foudematal feature in such agentic product, everything is attached to it: the conversation history, the files users attached, and the files the agent downloaded... So when a provider becomes unavailable like ran out of usage, users have to start a new session which means wiped out the context they built with Agent. I think this is an inappropriate feature that compromise user experience.
Proposed Solution
Allow changing the provider of a session after the conversation has started.
Alternatives Considered
No response
Additional Context
Where this is enforced, as of v0.13.3:
The connection is locked when the agent is first created — packages/server-core/src/sessions/SessionManager.ts (line 3303):
// Lock the connection after first resolution
// This ensures the session always uses the same provider
if (connection && !managed.connectionLocked) {
managed.llmConnection = connection.slug
managed.connectionLocked = true
}Changing the connection on a started session throws — same file, setSessionConnection() (line 4710):
if (managed.messages && managed.messages.length > 0) {
throw new Error('Cannot change connection after session has started')
}The connection parameter of updateSessionModel() is silently ignored once locked — same file (line 5421):
// Also update connection if provided and not already locked
if (connection && !managed.connectionLocked) {
managed.llmConnection = connection
}The connection switcher UI is only offered for empty sessions — apps/electron/src/renderer/components/app-shell/input/picker-mode.ts (line 38):
if (input.isEmptySession && input.connectionCount > 1) return 'switcher'Source: craft-ai-agents/craft-agents-oss