/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 88592e52d04e */ 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 { AgentExecutionStatus, AgentExecutionStatus$inboundSchema, } from "./agentexecutionstatus.js"; import { Message, Message$inboundSchema } from "./message.js"; /** * Payload for creating a run. **Important**: If the agent uses an input form trigger, the `input` field is required and must include all fields defined in the form schema. Even fields marked as optional in the UI must be included in the request—use an empty string (`""`) for optional fields without values. Omitting required form fields will result in a 500 error. */ export type AgentRun = { /** * The ID of the agent to run. */ agentId: string; /** * The input to the agent. Required when the agent uses an input form trigger. */ input?: { [k: string]: any } | undefined; /** * The messages to pass an input to the agent. */ messages?: Array | undefined; /** * The metadata to pass to the agent. */ metadata?: { [k: string]: any } | undefined; /** * The status of the run. One of 'error', 'success'. */ status?: AgentExecutionStatus | undefined; }; /** @internal */ export const AgentRun$inboundSchema: z.ZodType< AgentRun, z.ZodTypeDef, unknown > = z.object({ agent_id: z.string(), input: z.record(z.any()).optional(), messages: z.array(Message$inboundSchema).optional(), metadata: z.record(z.any()).optional(), status: AgentExecutionStatus$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "agent_id": "agentId", }); }); export function agentRunFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgentRun$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentRun' from JSON`, ); }