You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
884 B
25 lines
884 B
import { z } from "zod";
|
|
|
|
export const agentInvokeConfigSchema = z.object({
|
|
maxRecursionDepth: z.number().int().positive().max(10).default(3),
|
|
resultTruncateLength: z.number().int().positive().max(50000).default(4000),
|
|
timeoutMs: z.number().int().positive().max(120000).default(30000),
|
|
maxOutputTokens: z.number().int().positive().max(32768).default(4096),
|
|
});
|
|
|
|
export type AgentInvokeToolConfig = z.infer<typeof agentInvokeConfigSchema>;
|
|
|
|
export const DEFAULT_AGENT_INVOKE_CONFIG: AgentInvokeToolConfig = {
|
|
maxRecursionDepth: 3,
|
|
resultTruncateLength: 8000,
|
|
timeoutMs: 60000,
|
|
maxOutputTokens: 8192,
|
|
};
|
|
|
|
export function parseAgentInvokeConfig(raw: unknown): AgentInvokeToolConfig {
|
|
const parsed = agentInvokeConfigSchema.safeParse(raw);
|
|
if (!parsed.success) {
|
|
throw new Error(`Invalid agent-invoke config: ${parsed.error.message}`);
|
|
}
|
|
return parsed.data;
|
|
}
|
|
|