2025-10-28 13:17:06 +05:30
|
|
|
import { z } from "zod";
|
2025-11-07 11:42:10 +05:30
|
|
|
|
|
|
|
|
export const BaseAgentTool = z.object({
|
|
|
|
|
name: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const BuiltinAgentTool = BaseAgentTool.extend({
|
|
|
|
|
type: z.literal("builtin"),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const McpAgentTool = BaseAgentTool.extend({
|
|
|
|
|
type: z.literal("mcp"),
|
|
|
|
|
description: z.string(),
|
|
|
|
|
inputSchema: z.any(),
|
|
|
|
|
mcpServerName: z.string(),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const WorkflowAgentTool = BaseAgentTool.extend({
|
|
|
|
|
type: z.literal("workflow"),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const AgentTool = z.discriminatedUnion("type", [
|
|
|
|
|
BuiltinAgentTool,
|
|
|
|
|
McpAgentTool,
|
|
|
|
|
WorkflowAgentTool,
|
|
|
|
|
]);
|
|
|
|
|
|
2025-10-28 13:17:06 +05:30
|
|
|
export const Agent = z.object({
|
|
|
|
|
name: z.string(),
|
|
|
|
|
model: z.string(),
|
|
|
|
|
description: z.string(),
|
|
|
|
|
instructions: z.string(),
|
2025-11-07 11:42:10 +05:30
|
|
|
tools: z.record(z.string(), AgentTool).optional(),
|
2025-10-28 13:17:06 +05:30
|
|
|
});
|