MCPcopy Index your code
hub / github.com/docker/docker-agent / getEffectiveModelID

Method getEffectiveModelID

pkg/runtime/runtime.go:1268–1277  ·  view source on GitHub ↗

getEffectiveModelID returns the currently active model ID for an agent, accounting for any active fallback cooldown. During a cooldown period, this returns the fallback model ID instead of the configured primary model, so the UI reflects the actual model in use.

(ctx context.Context, a *agent.Agent)

Source from the content-addressed store, hash-verified

1266// for any active fallback cooldown. During a cooldown period, this returns the fallback
1267// model ID instead of the configured primary model, so the UI reflects the actual model in use.
1268func (r *LocalRuntime) getEffectiveModelID(ctx context.Context, a *agent.Agent) modelsdev.ID {
1269 cooldownState := r.fallback.cooldowns.Get(a.Name())
1270 if cooldownState != nil {
1271 fallbacks := a.FallbackModels()
1272 if cooldownState.fallbackIndex >= 0 && cooldownState.fallbackIndex < len(fallbacks) {
1273 return fallbacks[cooldownState.fallbackIndex].ID()
1274 }
1275 }
1276 return getAgentModelID(ctx, a)
1277}
1278
1279// agentDetailsFromTeam converts team agent info to AgentDetails for events.
1280// It accounts for active fallback cooldowns, returning the effective model

Callers 4

emitAgentAndTeamInfoMethod · 0.95
EmitStartupInfoMethod · 0.95
compactWithReasonMethod · 0.95
setModelAndEmitInfoMethod · 0.95

Calls 5

getAgentModelIDFunction · 0.85
FallbackModelsMethod · 0.80
GetMethod · 0.65
NameMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected