feat: Add support for agent handoffs with edges in agent forms and schemas

This commit is contained in:
Danny Avila 2025-09-03 21:15:31 -04:00
parent e705b09280
commit 317a5b5310
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
12 changed files with 406 additions and 3 deletions

View file

@ -38,6 +38,17 @@ export const agentSupportContactSchema = z
})
.optional();
/** Graph edge schema for agent handoffs */
export const graphEdgeSchema = z.object({
from: z.union([z.string(), z.array(z.string())]),
to: z.union([z.string(), z.array(z.string())]),
description: z.string().optional(),
edgeType: z.enum(['handoff', 'direct']).optional(),
prompt: z.union([z.string(), z.function()]).optional(),
excludeResults: z.boolean().optional(),
promptKey: z.string().optional(),
});
/** Base agent schema with all common fields */
export const agentBaseSchema = z.object({
name: z.string().nullable().optional(),
@ -47,6 +58,7 @@ export const agentBaseSchema = z.object({
model_parameters: z.record(z.unknown()).optional(),
tools: z.array(z.string()).optional(),
agent_ids: z.array(z.string()).optional(),
edges: z.array(graphEdgeSchema).optional(),
end_after_tools: z.boolean().optional(),
hide_sequential_outputs: z.boolean().optional(),
artifacts: z.string().optional(),