better pipeline agent fix

This commit is contained in:
Ramnique Singh 2025-08-14 06:04:12 +05:30
parent f56ee650cf
commit 402cf40203
2 changed files with 5 additions and 8 deletions

View file

@ -20,13 +20,10 @@ export function validateConfigChanges(configType: string, configChanges: Record<
break; break;
} }
case 'agent': { case 'agent': {
// Determine if this is a pipeline agent from the config changes
const isPipelineAgent = configChanges.type === 'pipeline';
testObject = { testObject = {
name: 'test', name: 'test',
description: 'test', description: 'test',
type: isPipelineAgent ? 'pipeline' : 'conversation', type: 'conversation',
instructions: 'test', instructions: 'test',
prompts: [], prompts: [],
tools: [], tools: [],
@ -34,9 +31,8 @@ export function validateConfigChanges(configType: string, configChanges: Record<
ragReturnType: 'chunks', ragReturnType: 'chunks',
ragK: 10, ragK: 10,
connectedAgents: [], connectedAgents: [],
// Set correct defaults based on agent type controlType: 'retain',
controlType: isPipelineAgent ? 'relinquish_to_parent' : 'retain', outputVisibility: 'user_facing',
outputVisibility: isPipelineAgent ? 'internal' : 'user_facing',
maxCallsPerParentAgent: 3, maxCallsPerParentAgent: 3,
} as z.infer<typeof WorkflowAgent>; } as z.infer<typeof WorkflowAgent>;
schema = WorkflowAgent; schema = WorkflowAgent;

View file

@ -26,7 +26,8 @@ export const WorkflowAgent = z.object({
'relinquish_to_start', 'relinquish_to_start',
]).optional().describe('Whether this agent retains control after a turn, relinquishes to the parent agent, or relinquishes to the start agent'), ]).optional().describe('Whether this agent retains control after a turn, relinquishes to the parent agent, or relinquishes to the start agent'),
maxCallsPerParentAgent: z.number().default(3).describe('Maximum number of times this agent can be called by a parent agent in a single turn').optional(), maxCallsPerParentAgent: z.number().default(3).describe('Maximum number of times this agent can be called by a parent agent in a single turn').optional(),
}).refine((data) => { });
export const StrictWorkflowAgent = WorkflowAgent.refine((data) => {
// Pipeline agents should have internal output visibility and relinquish_to_parent control type // Pipeline agents should have internal output visibility and relinquish_to_parent control type
if (data.type === 'pipeline' && data.outputVisibility !== 'internal') { if (data.type === 'pipeline' && data.outputVisibility !== 'internal') {
return false; return false;