MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / switchProvider

Function switchProvider

main.go:309–317  ·  view source on GitHub ↗

switchProvider replaces the root agent's provider mid-session and re-registers subagents so they use the new one. Conversation history is kept — it's translated by the new provider on the next Send. Token totals reset because each provider keeps its own accumulator.

(name, model string)

Source from the content-addressed store, hash-verified

307// kept — it's translated by the new provider on the next Send. Token totals
308// reset because each provider keeps its own accumulator.
309func switchProvider(name, model string) error {
310 p, err := newProviderByName(name, model, activeSysPrompt)
311 if err != nil {
312 return err
313 }
314 rootAgent.Provider = p
315 registerSubagents(p)
316 return nil
317}
318
319// ProviderKind returns the short name of a provider value. Used by /model
320// and /provider to display the active backend.

Callers 1

cmdProviderFunction · 0.85

Calls 2

newProviderByNameFunction · 0.85
registerSubagentsFunction · 0.85

Tested by

no test coverage detected