MCPcopy Create free account
hub / github.com/Noumena-Network/code / resolveWorkflowAgents

Function resolveWorkflowAgents

src/tools/WorkflowTool/WorkflowTool.ts:178–213  ·  view source on GitHub ↗
(
  inputAgents: WorkflowAgentInput[],
  context: ToolUseContext,
)

Source from the content-addressed store, hash-verified

176}
177
178function resolveWorkflowAgents(
179 inputAgents: WorkflowAgentInput[],
180 context: ToolUseContext,
181): ResolvedWorkflowAgent[] {
182 const activeAgents = context.options.agentDefinitions.activeAgents
183 const defaultAgent =
184 activeAgents.find(agent => agent.agentType === 'general-purpose') ??
185 activeAgents[0]
186
187 if (!defaultAgent) {
188 throw new Error('No agents are available for workflow execution.')
189 }
190
191 return inputAgents.map(agentInput => {
192 const selectedAgent = agentInput.agent_type
193 ? activeAgents.find(agent => agent.agentType === agentInput.agent_type)
194 : defaultAgent
195
196 if (!selectedAgent) {
197 throw new Error(
198 `Workflow agent type not found: ${agentInput.agent_type}`,
199 )
200 }
201
202 return {
203 id: createAgentId(),
204 name: agentInput.name,
205 description: agentInput.description ?? agentInput.name,
206 prompt: agentInput.prompt,
207 agentType: selectedAgent.agentType,
208 model: agentInput.model,
209 maxTurns: agentInput.max_turns,
210 selectedAgent,
211 }
212 })
213}
214
215async function runWorkflowAgentTask({
216 taskId,

Callers 1

callFunction · 0.85

Calls 1

createAgentIdFunction · 0.85

Tested by

no test coverage detected