@openai/agents-core
Version:
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
1,432 lines • 390 kB
TypeScript
import { z } from 'zod';
import { Agent } from './agent';
import { RunItem, RunToolApprovalItem } from './items';
import type { ModelResponse } from './model';
import { RunContext } from './runContext';
import { AgentToolUseTracker, NextStep, ProcessedResponse } from './runImplementation';
import type { AgentSpanData } from './tracing/spans';
import type { Span } from './tracing/spans';
import { Trace } from './tracing/traces';
import { AgentInputItem } from './types';
import type { InputGuardrailResult, OutputGuardrailResult } from './guardrail';
/**
* The schema version of the serialized run state. This is used to ensure that the serialized
* run state is compatible with the current version of the SDK.
* If anything in this schema changes, the version will have to be incremented.
*/
export declare const CURRENT_SCHEMA_VERSION: "1.0";
declare const serializedSpanBase: z.ZodObject<{
object: z.ZodLiteral<"trace.span">;
id: z.ZodString;
trace_id: z.ZodString;
parent_id: z.ZodNullable<z.ZodString>;
started_at: z.ZodNullable<z.ZodString>;
ended_at: z.ZodNullable<z.ZodString>;
error: z.ZodNullable<z.ZodObject<{
message: z.ZodString;
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
}, "strip", z.ZodTypeAny, {
message: string;
data?: Record<string, any> | undefined;
}, {
message: string;
data?: Record<string, any> | undefined;
}>>;
span_data: z.ZodRecord<z.ZodString, z.ZodAny>;
}, "strip", z.ZodTypeAny, {
object: "trace.span";
id: string;
trace_id: string;
parent_id: string | null;
started_at: string | null;
ended_at: string | null;
error: {
message: string;
data?: Record<string, any> | undefined;
} | null;
span_data: Record<string, any>;
}, {
object: "trace.span";
id: string;
trace_id: string;
parent_id: string | null;
started_at: string | null;
ended_at: string | null;
error: {
message: string;
data?: Record<string, any> | undefined;
} | null;
span_data: Record<string, any>;
}>;
type SerializedSpanType = z.infer<typeof serializedSpanBase> & {
previous_span?: SerializedSpanType;
};
export declare const SerializedRunState: z.ZodObject<{
$schemaVersion: z.ZodLiteral<"1.0">;
currentTurn: z.ZodNumber;
currentAgent: z.ZodObject<{
name: z.ZodString;
}, "strip", z.ZodTypeAny, {
name: string;
}, {
name: string;
}>;
originalInput: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodOptional<z.ZodLiteral<"message">>;
} & {
role: z.ZodLiteral<"user">;
content: z.ZodUnion<[z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_image">;
image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>>;
detail: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
}, {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_file">;
file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>, z.ZodObject<{
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
}, {
url: string;
}>]>>;
filename: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
}, {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"audio">;
audio: z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>;
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
}, {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
}>]>, "many">, z.ZodString]>;
}, "strip", z.ZodTypeAny, {
role: "user";
content: string | ({
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
} | {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
} | {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
})[];
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
role: "user";
content: string | ({
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
} | {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
} | {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
})[];
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodOptional<z.ZodLiteral<"message">>;
} & {
role: z.ZodLiteral<"assistant">;
status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"output_text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"refusal">;
refusal: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
}, {
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"audio">;
audio: z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>;
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
}, {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"image">;
image: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
}, {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
}>]>, "many">;
}, "strip", z.ZodTypeAny, {
status: "in_progress" | "completed" | "incomplete";
role: "assistant";
content: ({
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
} | {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
} | {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
})[];
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
status: "in_progress" | "completed" | "incomplete";
role: "assistant";
content: ({
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
} | {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
} | {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
})[];
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodOptional<z.ZodLiteral<"message">>;
} & {
role: z.ZodLiteral<"system">;
content: z.ZodString;
}, "strip", z.ZodTypeAny, {
role: "system";
content: string;
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
role: "system";
content: string;
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"hosted_tool_call">;
name: z.ZodString;
arguments: z.ZodOptional<z.ZodString>;
status: z.ZodOptional<z.ZodString>;
output: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "hosted_tool_call";
name: string;
status?: string | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
arguments?: string | undefined;
output?: string | undefined;
}, {
type: "hosted_tool_call";
name: string;
status?: string | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
arguments?: string | undefined;
output?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"function_call">;
callId: z.ZodString;
name: z.ZodString;
status: z.ZodOptional<z.ZodEnum<["in_progress", "completed", "incomplete"]>>;
arguments: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "function_call";
name: string;
arguments: string;
callId: string;
status?: "in_progress" | "completed" | "incomplete" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
type: "function_call";
name: string;
arguments: string;
callId: string;
status?: "in_progress" | "completed" | "incomplete" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"computer_call">;
callId: z.ZodString;
status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"screenshot">;
}, "strip", z.ZodTypeAny, {
type: "screenshot";
}, {
type: "screenshot";
}>, z.ZodObject<{
type: z.ZodLiteral<"click">;
x: z.ZodNumber;
y: z.ZodNumber;
button: z.ZodEnum<["left", "right", "wheel", "back", "forward"]>;
}, "strip", z.ZodTypeAny, {
type: "click";
x: number;
y: number;
button: "left" | "right" | "wheel" | "back" | "forward";
}, {
type: "click";
x: number;
y: number;
button: "left" | "right" | "wheel" | "back" | "forward";
}>, z.ZodObject<{
type: z.ZodLiteral<"double_click">;
x: z.ZodNumber;
y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
type: "double_click";
x: number;
y: number;
}, {
type: "double_click";
x: number;
y: number;
}>, z.ZodObject<{
type: z.ZodLiteral<"scroll">;
x: z.ZodNumber;
y: z.ZodNumber;
scroll_x: z.ZodNumber;
scroll_y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
type: "scroll";
x: number;
y: number;
scroll_x: number;
scroll_y: number;
}, {
type: "scroll";
x: number;
y: number;
scroll_x: number;
scroll_y: number;
}>, z.ZodObject<{
type: z.ZodLiteral<"type">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "type";
text: string;
}, {
type: "type";
text: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"wait">;
}, "strip", z.ZodTypeAny, {
type: "wait";
}, {
type: "wait";
}>, z.ZodObject<{
type: z.ZodLiteral<"move">;
x: z.ZodNumber;
y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
type: "move";
x: number;
y: number;
}, {
type: "move";
x: number;
y: number;
}>, z.ZodObject<{
type: z.ZodLiteral<"keypress">;
keys: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
keys: string[];
type: "keypress";
}, {
keys: string[];
type: "keypress";
}>, z.ZodObject<{
type: z.ZodLiteral<"drag">;
path: z.ZodArray<z.ZodObject<{
x: z.ZodNumber;
y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
x: number;
y: number;
}, {
x: number;
y: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
path: {
x: number;
y: number;
}[];
type: "drag";
}, {
path: {
x: number;
y: number;
}[];
type: "drag";
}>]>;
}, "strip", z.ZodTypeAny, {
type: "computer_call";
status: "in_progress" | "completed" | "incomplete";
callId: string;
action: {
type: "screenshot";
} | {
type: "click";
x: number;
y: number;
button: "left" | "right" | "wheel" | "back" | "forward";
} | {
type: "double_click";
x: number;
y: number;
} | {
type: "scroll";
x: number;
y: number;
scroll_x: number;
scroll_y: number;
} | {
type: "type";
text: string;
} | {
type: "wait";
} | {
type: "move";
x: number;
y: number;
} | {
keys: string[];
type: "keypress";
} | {
path: {
x: number;
y: number;
}[];
type: "drag";
};
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
type: "computer_call";
status: "in_progress" | "completed" | "incomplete";
callId: string;
action: {
type: "screenshot";
} | {
type: "click";
x: number;
y: number;
button: "left" | "right" | "wheel" | "back" | "forward";
} | {
type: "double_click";
x: number;
y: number;
} | {
type: "scroll";
x: number;
y: number;
scroll_x: number;
scroll_y: number;
} | {
type: "type";
text: string;
} | {
type: "wait";
} | {
type: "move";
x: number;
y: number;
} | {
keys: string[];
type: "keypress";
} | {
path: {
x: number;
y: number;
}[];
type: "drag";
};
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"function_call_result">;
name: z.ZodString;
callId: z.ZodString;
status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
output: z.ZodUnion<[z.ZodString, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "text";
text: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"image">;
image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodObject<{
data: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
mediaType: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
data: string | Uint8Array<ArrayBuffer>;
mediaType?: string | undefined;
}, {
data: string | Uint8Array<ArrayBuffer>;
mediaType?: string | undefined;
}>, z.ZodObject<{
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
}, {
url: string;
}>, z.ZodObject<{
fileId: z.ZodString;
}, "strip", z.ZodTypeAny, {
fileId: string;
}, {
fileId: string;
}>]>]>>;
detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), z.ZodTypeDef, "low" | "high" | "auto" | (string & {})>>;
}, "strip", z.ZodTypeAny, {
type: "image";
providerData?: Record<string, any> | undefined;
image?: string | {
data: string | Uint8Array<ArrayBuffer>;
mediaType?: string | undefined;
} | {
url: string;
} | {
fileId: string;
} | undefined;
detail?: "low" | "high" | "auto" | (string & {}) | undefined;
}, {
type: "image";
providerData?: Record<string, any> | undefined;
image?: string | {
data: string | Uint8Array<ArrayBuffer>;
mediaType?: string | undefined;
} | {
url: string;
} | {
fileId: string;
} | undefined;
detail?: "low" | "high" | "auto" | (string & {}) | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"file">;
file: z.ZodUnion<[z.ZodString, z.ZodObject<{
data: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
mediaType: z.ZodString;
filename: z.ZodString;
}, "strip", z.ZodTypeAny, {
filename: string;
data: string | Uint8Array<ArrayBuffer>;
mediaType: string;
}, {
filename: string;
data: string | Uint8Array<ArrayBuffer>;
mediaType: string;
}>, z.ZodObject<{
url: z.ZodString;
filename: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
url: string;
filename?: string | undefined;
}, {
url: string;
filename?: string | undefined;
}>, z.ZodObject<{
id: z.ZodString;
filename: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id: string;
filename?: string | undefined;
}, {
id: string;
filename?: string | undefined;
}>]>;
}, "strip", z.ZodTypeAny, {
type: "file";
file: string | {
filename: string;
data: string | Uint8Array<ArrayBuffer>;
mediaType: string;
} | {
url: string;
filename?: string | undefined;
} | {
id: string;
filename?: string | undefined;
};
providerData?: Record<string, any> | undefined;
}, {
type: "file";
file: string | {
filename: string;
data: string | Uint8Array<ArrayBuffer>;
mediaType: string;
} | {
url: string;
filename?: string | undefined;
} | {
id: string;
filename?: string | undefined;
};
providerData?: Record<string, any> | undefined;
}>]>, z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_image">;
image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>>;
detail: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
}, {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_file">;
file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>, z.ZodObject<{
url: z.ZodString;
}, "strip", z.ZodTypeAny, {
url: string;
}, {
url: string;
}>]>>;
filename: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
}, {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
}>]>, "many">]>;
}, "strip", z.ZodTypeAny, {
type: "function_call_result";
status: "in_progress" | "completed" | "incomplete";
name: string;
output: string | {
type: "text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "image";
providerData?: Record<string, any> | undefined;
image?: string | {
data: string | Uint8Array<ArrayBuffer>;
mediaType?: string | undefined;
} | {
url: string;
} | {
fileId: string;
} | undefined;
detail?: "low" | "high" | "auto" | (string & {}) | undefined;
} | {
type: "file";
file: string | {
filename: string;
data: string | Uint8Array<ArrayBuffer>;
mediaType: string;
} | {
url: string;
filename?: string | undefined;
} | {
id: string;
filename?: string | undefined;
};
providerData?: Record<string, any> | undefined;
} | ({
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
} | {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
})[];
callId: string;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
type: "function_call_result";
status: "in_progress" | "completed" | "incomplete";
name: string;
output: string | {
type: "text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "image";
providerData?: Record<string, any> | undefined;
image?: string | {
data: string | Uint8Array<ArrayBuffer>;
mediaType?: string | undefined;
} | {
url: string;
} | {
fileId: string;
} | undefined;
detail?: "low" | "high" | "auto" | (string & {}) | undefined;
} | {
type: "file";
file: string | {
filename: string;
data: string | Uint8Array<ArrayBuffer>;
mediaType: string;
} | {
url: string;
filename?: string | undefined;
} | {
id: string;
filename?: string | undefined;
};
providerData?: Record<string, any> | undefined;
} | ({
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "input_image";
providerData?: Record<string, any> | undefined;
image?: string | {
id: string;
} | undefined;
detail?: string | undefined;
} | {
type: "input_file";
providerData?: Record<string, any> | undefined;
file?: string | {
id: string;
} | {
url: string;
} | undefined;
filename?: string | undefined;
})[];
callId: string;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"computer_call_result">;
callId: z.ZodString;
output: z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"computer_screenshot">;
data: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "computer_screenshot";
data: string;
providerData?: Record<string, any> | undefined;
}, {
type: "computer_screenshot";
data: string;
providerData?: Record<string, any> | undefined;
}>;
}, "strip", z.ZodTypeAny, {
type: "computer_call_result";
output: {
type: "computer_screenshot";
data: string;
providerData?: Record<string, any> | undefined;
};
callId: string;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
type: "computer_call_result";
output: {
type: "computer_screenshot";
data: string;
providerData?: Record<string, any> | undefined;
};
callId: string;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
type: z.ZodLiteral<"reasoning">;
content: z.ZodArray<z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"input_text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}>, "many">;
rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"reasoning_text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "reasoning_text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "reasoning_text";
text: string;
providerData?: Record<string, any> | undefined;
}>, "many">>;
}, "strip", z.ZodTypeAny, {
type: "reasoning";
content: {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}[];
providerData?: Record<string, any> | undefined;
id?: string | undefined;
rawContent?: {
type: "reasoning_text";
text: string;
providerData?: Record<string, any> | undefined;
}[] | undefined;
}, {
type: "reasoning";
content: {
type: "input_text";
text: string;
providerData?: Record<string, any> | undefined;
}[];
providerData?: Record<string, any> | undefined;
id?: string | undefined;
rawContent?: {
type: "reasoning_text";
text: string;
providerData?: Record<string, any> | undefined;
}[] | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"unknown">;
}, "strip", z.ZodTypeAny, {
type: "unknown";
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
type: "unknown";
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>]>, "many">]>;
modelResponses: z.ZodArray<z.ZodObject<{
usage: z.ZodObject<{
requests: z.ZodNumber;
inputTokens: z.ZodNumber;
outputTokens: z.ZodNumber;
totalTokens: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
requests: number;
inputTokens: number;
outputTokens: number;
totalTokens: number;
}, {
requests: number;
inputTokens: number;
outputTokens: number;
totalTokens: number;
}>;
output: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodOptional<z.ZodLiteral<"message">>;
} & {
role: z.ZodLiteral<"assistant">;
status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"output_text">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
}, {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"refusal">;
refusal: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
}, {
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"audio">;
audio: z.ZodUnion<[z.ZodString, z.ZodObject<{
id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
}, {
id: string;
}>]>;
format: z.ZodOptional<z.ZodNullable<z.ZodString>>;
transcript: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
}, {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
type: z.ZodLiteral<"image">;
image: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
}, {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
}>]>, "many">;
}, "strip", z.ZodTypeAny, {
status: "in_progress" | "completed" | "incomplete";
role: "assistant";
content: ({
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
} | {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
} | {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
})[];
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
status: "in_progress" | "completed" | "incomplete";
role: "assistant";
content: ({
type: "refusal";
refusal: string;
providerData?: Record<string, any> | undefined;
} | {
type: "output_text";
text: string;
providerData?: Record<string, any> | undefined;
} | {
type: "audio";
audio: string | {
id: string;
};
providerData?: Record<string, any> | undefined;
format?: string | null | undefined;
transcript?: string | null | undefined;
} | {
type: "image";
image: string;
providerData?: Record<string, any> | undefined;
})[];
type?: "message" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"hosted_tool_call">;
name: z.ZodString;
arguments: z.ZodOptional<z.ZodString>;
status: z.ZodOptional<z.ZodString>;
output: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
type: "hosted_tool_call";
name: string;
status?: string | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
arguments?: string | undefined;
output?: string | undefined;
}, {
type: "hosted_tool_call";
name: string;
status?: string | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
arguments?: string | undefined;
output?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"function_call">;
callId: z.ZodString;
name: z.ZodString;
status: z.ZodOptional<z.ZodEnum<["in_progress", "completed", "incomplete"]>>;
arguments: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "function_call";
name: string;
arguments: string;
callId: string;
status?: "in_progress" | "completed" | "incomplete" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}, {
type: "function_call";
name: string;
arguments: string;
callId: string;
status?: "in_progress" | "completed" | "incomplete" | undefined;
providerData?: Record<string, any> | undefined;
id?: string | undefined;
}>, z.ZodObject<{
providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
} & {
id: z.ZodOptional<z.ZodString>;
} & {
type: z.ZodLiteral<"computer_call">;
callId: z.ZodString;
status: z.ZodEnum<["in_progress", "completed", "incomplete"]>;
action: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"screenshot">;
}, "strip", z.ZodTypeAny, {
type: "screenshot";
}, {
type: "screenshot";
}>, z.ZodObject<{
type: z.ZodLiteral<"click">;
x: z.ZodNumber;
y: z.ZodNumber;
button: z.ZodEnum<["left", "right", "wheel", "back", "forward"]>;
}, "strip", z.ZodTypeAny, {
type: "click";
x: number;
y: number;
button: "left" | "right" | "wheel" | "back" | "forward";
}, {
type: "click";
x: number;
y: number;
button: "left" | "right" | "wheel" | "back" | "forward";
}>, z.ZodObject<{
type: z.ZodLiteral<"double_click">;
x: z.ZodNumber;
y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
type: "double_click";
x: number;
y: number;
}, {
type: "double_click";
x: number;
y: number;
}>, z.ZodObject<{
type: z.ZodLiteral<"scroll">;
x: z.ZodNumber;
y: z.ZodNumber;
scroll_x: z.ZodNumber;
scroll_y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
type: "scroll";
x: number;
y: number;
scroll_x: number;
scroll_y: number;
}, {
type: "scroll";
x: number;
y: number;
scroll_x: number;
scroll_y: number;
}>, z.ZodObject<{
type: z.ZodLiteral<"type">;
text: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "type";
text: string;
}, {
type: "type";
text: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"wait">;
}, "strip", z.ZodTypeAny, {
type: "wait";
}, {
type: "wait";
}>, z.ZodObject<{
type: z.ZodLiteral<"move">;
x: z.ZodNumber;
y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
type: "move";
x: number;
y: number;
}, {
type: "move";
x: number;
y: number;
}>, z.ZodObject<{
type: z.ZodLiteral<"keypress">;
keys: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
keys: string[];
type: "keypress";
}, {
keys: string[];
type: "keypress";
}>, z.ZodObject<{
type: z.ZodLiteral<"drag">;
path: z.ZodArray<z.ZodObject<{
x: z.ZodNumber;
y: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
x: number;
y: number;
}, {
x: number;
y: number;
}>, "many">;
}, "strip", z.ZodTypeAny, {
path: {
x: number;
y: number;
}[];
type: "drag";
}, {
path: {
x: number;
y: number;
}[];
type: "drag";
}>]>;
}, "strip", z.ZodTypeAny, {
type: "computer_call";
status: "in_progress" | "complete