MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / NewSubAgent

Function NewSubAgent

agent/subagent.go:65–86  ·  view source on GitHub ↗
(cfg config.Config, registry *coretools.ToolRegistry, definition AgentDef, parentState *AgentState, modelOverride, agentType string, extraContext coretools.ExecutionContext, thinkingBudgetTokens ...*int)

Source from the content-addressed store, hash-verified

63
64func NewSubAgent(cfg config.Config, registry *coretools.ToolRegistry, definition AgentDef, parentState *AgentState, modelOverride, agentType string, extraContext coretools.ExecutionContext, thinkingBudgetTokens ...*int) *SubAgent {
65 model := modelOverride
66 if model == "" {
67 model = definition.Model
68 }
69 if model == "" {
70 model = cfg.APIModel
71 }
72 maxTurns := definition.MaxTurns
73 if maxTurns <= 0 {
74 maxTurns = MaxSubagentTurns
75 }
76 var thinkingBudget *int
77 if len(thinkingBudgetTokens) > 0 {
78 thinkingBudget = thinkingBudgetTokens[0]
79 }
80 timeoutSeconds := intFromAny(extraContext["subagent_timeout_seconds"])
81 if timeoutSeconds <= 0 {
82 timeoutSeconds = DefaultSubagentTimeoutSeconds
83 }
84 return &SubAgent{Config: cfg, Registry: registry, Definition: definition, ParentState: parentState, Model: model, AgentType: agentType, ExtraContext: extraContext, ThinkingBudget: thinkingBudget, MaxTurns: maxTurns, TimeoutSeconds: timeoutSeconds}
85}
86
87func (s *SubAgent) Abort() {
88 s.Aborted = true
89}

Calls 1

intFromAnyFunction · 0.70