/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AgentReasoningConfiguration, AgentReasoningConfiguration$inboundSchema, AgentReasoningConfiguration$Outbound, AgentReasoningConfiguration$outboundSchema, } from "./agentreasoningconfiguration.js"; import { AgentTextConfiguration, AgentTextConfiguration$inboundSchema, AgentTextConfiguration$Outbound, AgentTextConfiguration$outboundSchema, } from "./agenttextconfiguration.js"; import { ToolDefinition, ToolDefinition$inboundSchema, ToolDefinition$Outbound, ToolDefinition$outboundSchema, } from "./tooldefinition.js"; export type CreateAgentRequest = { name: string; description?: string | null | undefined; model: string; instructions?: string | null | undefined; tools?: Array | undefined; /** * Arbitrary JSON value. */ toolChoice?: any | undefined; parallelToolCalls?: boolean | undefined; maxToolCalls?: number | null | undefined; text?: AgentTextConfiguration | null | undefined; reasoning?: AgentReasoningConfiguration | null | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const CreateAgentRequest$inboundSchema: z.ZodType< CreateAgentRequest, z.ZodTypeDef, unknown > = z.object({ name: z.string(), description: z.nullable(z.string()).optional(), model: z.string(), instructions: z.nullable(z.string()).optional(), tools: z.array(ToolDefinition$inboundSchema).optional(), tool_choice: z.any().optional(), parallel_tool_calls: z.boolean().default(true), max_tool_calls: z.nullable(z.number().int()).optional(), text: z.nullable(AgentTextConfiguration$inboundSchema).optional(), reasoning: z.nullable(AgentReasoningConfiguration$inboundSchema).optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { "tool_choice": "toolChoice", "parallel_tool_calls": "parallelToolCalls", "max_tool_calls": "maxToolCalls", }); }); /** @internal */ export type CreateAgentRequest$Outbound = { name: string; description?: string | null | undefined; model: string; instructions?: string | null | undefined; tools?: Array | undefined; tool_choice?: any | undefined; parallel_tool_calls: boolean; max_tool_calls?: number | null | undefined; text?: AgentTextConfiguration$Outbound | null | undefined; reasoning?: AgentReasoningConfiguration$Outbound | null | undefined; metadata?: { [k: string]: string } | undefined; }; /** @internal */ export const CreateAgentRequest$outboundSchema: z.ZodType< CreateAgentRequest$Outbound, z.ZodTypeDef, CreateAgentRequest > = z.object({ name: z.string(), description: z.nullable(z.string()).optional(), model: z.string(), instructions: z.nullable(z.string()).optional(), tools: z.array(ToolDefinition$outboundSchema).optional(), toolChoice: z.any().optional(), parallelToolCalls: z.boolean().default(true), maxToolCalls: z.nullable(z.number().int()).optional(), text: z.nullable(AgentTextConfiguration$outboundSchema).optional(), reasoning: z.nullable(AgentReasoningConfiguration$outboundSchema).optional(), metadata: z.record(z.string()).optional(), }).transform((v) => { return remap$(v, { toolChoice: "tool_choice", parallelToolCalls: "parallel_tool_calls", maxToolCalls: "max_tool_calls", }); }); export function createAgentRequestToJSON( createAgentRequest: CreateAgentRequest, ): string { return JSON.stringify( CreateAgentRequest$outboundSchema.parse(createAgentRequest), ); } export function createAgentRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAgentRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentRequest' from JSON`, ); }