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

Method agentDetailsFromTeam

pkg/runtime/runtime.go:1282–1315  ·  view source on GitHub ↗

agentDetailsFromTeam converts team agent info to AgentDetails for events. It accounts for active fallback cooldowns, returning the effective model instead of the configured model when a fallback is in effect.

(ctx context.Context)

Source from the content-addressed store, hash-verified

1280// It accounts for active fallback cooldowns, returning the effective model
1281// instead of the configured model when a fallback is in effect.
1282func (r *LocalRuntime) agentDetailsFromTeam(ctx context.Context) []AgentDetails {
1283 agentsInfo := r.team.AgentsInfo(ctx)
1284 details := make([]AgentDetails, len(agentsInfo))
1285 for i, info := range agentsInfo {
1286 providerName := info.Provider
1287 modelName := info.Model
1288 var thinking string
1289
1290 // Get the agent to access fallbacks and the effective thinking level.
1291 if a, err := r.team.Agent(info.Name); err == nil && a != nil {
1292 // Check if this agent has an active fallback cooldown
1293 cooldownState := r.fallback.cooldowns.Get(info.Name)
1294 if cooldownState != nil {
1295 fallbacks := a.FallbackModels()
1296 if cooldownState.fallbackIndex >= 0 && cooldownState.fallbackIndex < len(fallbacks) {
1297 fb := fallbacks[cooldownState.fallbackIndex].ID()
1298 providerName = fb.Provider
1299 modelName = fb.Model
1300 }
1301 }
1302 thinking = r.agentThinkingLabel(ctx, a)
1303 }
1304
1305 details[i] = AgentDetails{
1306 Name: info.Name,
1307 Description: info.Description,
1308 Provider: providerName,
1309 Model: modelName,
1310 Thinking: thinking,
1311 Commands: info.Commands,
1312 }
1313 }
1314 return details
1315}
1316
1317// agentThinkingLabel returns a short, user-facing label for the effective
1318// thinking-effort level of the agent's current model: the effort level (e.g.

Callers 2

runStreamLoopMethod · 0.95
emitAgentAndTeamInfoMethod · 0.95

Calls 6

agentThinkingLabelMethod · 0.95
AgentsInfoMethod · 0.80
AgentMethod · 0.80
FallbackModelsMethod · 0.80
GetMethod · 0.65
IDMethod · 0.65

Tested by

no test coverage detected