Rafiki Worker API Reference
    Preparing search index...

    Variable JobStatusResponseSchemaConst

    JobStatusResponseSchema: ZodObject<
        {
            agent_duration_api_ms: ZodOptional<ZodNullable<ZodNumber>>;
            agent_duration_ms: ZodOptional<ZodNullable<ZodNumber>>;
            artifacts: ZodOptional<
                ZodNullable<
                    ZodObject<
                        {
                            files: ZodArray<
                                ZodObject<
                                    {
                                        checksum_sha256: ZodOptional<ZodNullable<(...)>>;
                                        content_type: ZodOptional<ZodNullable<(...)>>;
                                        created_at: ZodOptional<ZodNullable<(...)>>;
                                        modified_at: ZodOptional<ZodNullable<(...)>>;
                                        path: ZodString;
                                        size_bytes: ZodOptional<ZodNullable<(...)>>;
                                    },
                                    "strict",
                                    ZodTypeAny,
                                    {
                                        checksum_sha256?: string
                                        | null;
                                        content_type?: string | null;
                                        created_at?: number | null;
                                        modified_at?: number | null;
                                        path: string;
                                        size_bytes?: number | null;
                                    },
                                    {
                                        checksum_sha256?: string
                                        | null;
                                        content_type?: string | null;
                                        created_at?: number | null;
                                        modified_at?: number | null;
                                        path: string;
                                        size_bytes?: number | null;
                                    },
                                >,
                                "many",
                            >;
                            root: ZodOptional<ZodNullable<ZodString>>;
                        },
                        "strict",
                        ZodTypeAny,
                        {
                            files: {
                                checksum_sha256?: string
                                | null;
                                content_type?: string | null;
                                created_at?: number | null;
                                modified_at?: number | null;
                                path: string;
                                size_bytes?: number | null;
                            }[];
                            root?: string
                            | null;
                        },
                        {
                            files: {
                                checksum_sha256?: string
                                | null;
                                content_type?: string | null;
                                created_at?: number | null;
                                modified_at?: number | null;
                                path: string;
                                size_bytes?: number | null;
                            }[];
                            root?: string
                            | null;
                        },
                    >,
                >,
            >;
            attempts: ZodOptional<ZodNullable<ZodNumber>>;
            canceled_at: ZodOptional<ZodNullable<ZodNumber>>;
            completed_at: ZodOptional<ZodNullable<ZodNumber>>;
            created_at: ZodOptional<ZodNullable<ZodNumber>>;
            duration_ms: ZodOptional<ZodNullable<ZodNumber>>;
            error: ZodOptional<ZodNullable<ZodString>>;
            job_id: ZodString;
            metadata: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
            models: ZodOptional<ZodNullable<ZodArray<ZodString, "many">>>;
            num_turns: ZodOptional<ZodNullable<ZodNumber>>;
            ok: ZodDefault<ZodBoolean>;
            question: ZodOptional<ZodNullable<ZodString>>;
            queue_latency_ms: ZodOptional<ZodNullable<ZodNumber>>;
            result: ZodOptional<
                ZodNullable<
                    ZodObject<
                        {
                            messages: ZodArray<
                                ZodObject<
                                    {
                                        content: ZodOptional<ZodUnion<(...)>>;
                                        role: ZodOptional<ZodEnum<(...)>>;
                                        type: ZodOptional<ZodEnum<(...)>>;
                                    },
                                    "passthrough",
                                    ZodTypeAny,
                                    objectOutputType<
                                        {
                                            content: ZodOptional<(...)>;
                                            role: ZodOptional<(...)>;
                                            type: ZodOptional<(...)>;
                                        },
                                        ZodTypeAny,
                                        "passthrough",
                                    >,
                                    objectInputType<
                                        {
                                            content: ZodOptional<(...)>;
                                            role: ZodOptional<(...)>;
                                            type: ZodOptional<(...)>;
                                        },
                                        ZodTypeAny,
                                        "passthrough",
                                    >,
                                >,
                                "many",
                            >;
                            ok: ZodBoolean;
                            session_id: ZodOptional<ZodNullable<ZodString>>;
                            summary: ZodObject<
                                {
                                    duration_api_ms: ZodOptional<ZodNullable<ZodNumber>>;
                                    duration_ms: ZodOptional<ZodNullable<ZodNumber>>;
                                    is_complete: ZodBoolean;
                                    is_error: ZodOptional<ZodNullable<ZodBoolean>>;
                                    num_turns: ZodOptional<ZodNullable<ZodNumber>>;
                                    openai_trace_id: ZodOptional<ZodNullable<ZodString>>;
                                    result: ZodOptional<ZodNullable<ZodString>>;
                                    session_id: ZodOptional<ZodNullable<ZodString>>;
                                    structured_output: ZodOptional<ZodNullable<ZodUnknown>>;
                                    subtype: ZodOptional<ZodNullable<ZodString>>;
                                    text: ZodOptional<ZodNullable<ZodString>>;
                                    total_cost_usd: ZodOptional<ZodNullable<ZodNumber>>;
                                    trace_id: ZodOptional<ZodNullable<ZodString>>;
                                    usage: ZodOptional<ZodNullable<ZodRecord<(...), (...)>>>;
                                },
                                "strict",
                                ZodTypeAny,
                                {
                                    duration_api_ms?: number
                                    | null;
                                    duration_ms?: number | null;
                                    is_complete: boolean;
                                    is_error?: boolean | null;
                                    num_turns?: number | null;
                                    openai_trace_id?: string | null;
                                    result?: string | null;
                                    session_id?: string | null;
                                    structured_output?: unknown;
                                    subtype?: string | null;
                                    text?: string | null;
                                    total_cost_usd?: number | null;
                                    trace_id?: string | null;
                                    usage?: Record<string, unknown> | null;
                                },
                                {
                                    duration_api_ms?: number
                                    | null;
                                    duration_ms?: number | null;
                                    is_complete: boolean;
                                    is_error?: boolean | null;
                                    num_turns?: number | null;
                                    openai_trace_id?: string | null;
                                    result?: string | null;
                                    session_id?: string | null;
                                    structured_output?: unknown;
                                    subtype?: string | null;
                                    text?: string | null;
                                    total_cost_usd?: number | null;
                                    trace_id?: string | null;
                                    usage?: Record<string, unknown> | null;
                                },
                            >;
                        },
                        "strict",
                        ZodTypeAny,
                        {
                            messages: objectOutputType<
                                {
                                    content: ZodOptional<ZodUnion<(...)>>;
                                    role: ZodOptional<ZodEnum<(...)>>;
                                    type: ZodOptional<ZodEnum<(...)>>;
                                },
                                ZodTypeAny,
                                "passthrough",
                            >[];
                            ok: boolean;
                            session_id?: string
                            | null;
                            summary: {
                                duration_api_ms?: number | null;
                                duration_ms?: number | null;
                                is_complete: boolean;
                                is_error?: boolean | null;
                                num_turns?: number | null;
                                openai_trace_id?: string | null;
                                result?: string | null;
                                session_id?: string | null;
                                structured_output?: unknown;
                                subtype?: string | null;
                                text?: string | null;
                                total_cost_usd?: number | null;
                                trace_id?: string | null;
                                usage?: Record<string, unknown> | null;
                            };
                        },
                        {
                            messages: objectInputType<
                                {
                                    content: ZodOptional<ZodUnion<(...)>>;
                                    role: ZodOptional<ZodEnum<(...)>>;
                                    type: ZodOptional<ZodEnum<(...)>>;
                                },
                                ZodTypeAny,
                                "passthrough",
                            >[];
                            ok: boolean;
                            session_id?: string
                            | null;
                            summary: {
                                duration_api_ms?: number | null;
                                duration_ms?: number | null;
                                is_complete: boolean;
                                is_error?: boolean | null;
                                num_turns?: number | null;
                                openai_trace_id?: string | null;
                                result?: string | null;
                                session_id?: string | null;
                                structured_output?: unknown;
                                subtype?: string | null;
                                text?: string | null;
                                total_cost_usd?: number | null;
                                trace_id?: string | null;
                                usage?: Record<string, unknown> | null;
                            };
                        },
                    >,
                >,
            >;
            sandbox_id: ZodOptional<ZodNullable<ZodString>>;
            schedule_at: ZodOptional<ZodNullable<ZodNumber>>;
            session_id: ZodString;
            started_at: ZodOptional<ZodNullable<ZodNumber>>;
            status: ZodEnum<["queued", "running", "complete", "failed", "canceled"]>;
            tenant_id: ZodOptional<ZodNullable<ZodString>>;
            tool_call_count: ZodOptional<ZodNullable<ZodNumber>>;
            total_cost_usd: ZodOptional<ZodNullable<ZodNumber>>;
            updated_at: ZodOptional<ZodNullable<ZodNumber>>;
            usage: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
            user_id: ZodOptional<ZodNullable<ZodString>>;
            webhook: ZodOptional<
                ZodNullable<
                    ZodObject<
                        {
                            attempts: ZodOptional<ZodNullable<ZodNumber>>;
                            delivered_at: ZodOptional<ZodNullable<ZodNumber>>;
                            last_error: ZodOptional<ZodNullable<ZodString>>;
                            last_status: ZodOptional<ZodNullable<ZodNumber>>;
                            secret_ref: ZodOptional<ZodNullable<ZodString>>;
                            url: ZodOptional<ZodNullable<ZodString>>;
                        },
                        "strict",
                        ZodTypeAny,
                        {
                            attempts?: number
                            | null;
                            delivered_at?: number | null;
                            last_error?: string | null;
                            last_status?: number | null;
                            secret_ref?: string | null;
                            url?: string | null;
                        },
                        {
                            attempts?: number
                            | null;
                            delivered_at?: number | null;
                            last_error?: string | null;
                            last_status?: number | null;
                            secret_ref?: string | null;
                            url?: string | null;
                        },
                    >,
                >,
            >;
        },
        "strict",
        ZodTypeAny,
        {
            agent_duration_api_ms?: number
            | null;
            agent_duration_ms?: number | null;
            artifacts?:
                | {
                    files: {
                        checksum_sha256?: string
                        | null;
                        content_type?: string | null;
                        created_at?: number | null;
                        modified_at?: number | null;
                        path: string;
                        size_bytes?: number | null;
                    }[];
                    root?: string
                    | null;
                }
                | null;
            attempts?: number
            | null;
            canceled_at?: number | null;
            completed_at?: number | null;
            created_at?: number | null;
            duration_ms?: number | null;
            error?: string | null;
            job_id: string;
            metadata?: Record<string, unknown> | null;
            models?: string[] | null;
            num_turns?: number | null;
            ok: boolean;
            question?: string | null;
            queue_latency_ms?: number | null;
            result?:
                | {
                    messages: objectOutputType<
                        {
                            content: ZodOptional<
                                ZodUnion<[ZodArray<(...), (...)>, ZodString, ZodNull]>,
                            >;
                            role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                            type: ZodOptional<
                                ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                            >;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >[];
                    ok: boolean;
                    session_id?: string
                    | null;
                    summary: {
                        duration_api_ms?: number | null;
                        duration_ms?: number | null;
                        is_complete: boolean;
                        is_error?: boolean | null;
                        num_turns?: number | null;
                        openai_trace_id?: string | null;
                        result?: string | null;
                        session_id?: string | null;
                        structured_output?: unknown;
                        subtype?: string | null;
                        text?: string | null;
                        total_cost_usd?: number | null;
                        trace_id?: string | null;
                        usage?: Record<string, unknown> | null;
                    };
                }
                | null;
            sandbox_id?: string
            | null;
            schedule_at?: number | null;
            session_id: string;
            started_at?: number | null;
            status: "queued" | "running" | "complete" | "failed" | "canceled";
            tenant_id?: string | null;
            tool_call_count?: number | null;
            total_cost_usd?: number | null;
            updated_at?: number | null;
            usage?: Record<string, unknown> | null;
            user_id?: string | null;
            webhook?:
                | {
                    attempts?: number
                    | null;
                    delivered_at?: number | null;
                    last_error?: string | null;
                    last_status?: number | null;
                    secret_ref?: string | null;
                    url?: string | null;
                }
                | null;
        },
        {
            agent_duration_api_ms?: number
            | null;
            agent_duration_ms?: number | null;
            artifacts?:
                | {
                    files: {
                        checksum_sha256?: string
                        | null;
                        content_type?: string | null;
                        created_at?: number | null;
                        modified_at?: number | null;
                        path: string;
                        size_bytes?: number | null;
                    }[];
                    root?: string
                    | null;
                }
                | null;
            attempts?: number
            | null;
            canceled_at?: number | null;
            completed_at?: number | null;
            created_at?: number | null;
            duration_ms?: number | null;
            error?: string | null;
            job_id: string;
            metadata?: Record<string, unknown> | null;
            models?: string[] | null;
            num_turns?: number | null;
            ok?: boolean;
            question?: string | null;
            queue_latency_ms?: number | null;
            result?:
                | {
                    messages: objectInputType<
                        {
                            content: ZodOptional<
                                ZodUnion<[ZodArray<(...), (...)>, ZodString, ZodNull]>,
                            >;
                            role: ZodOptional<ZodEnum<["user", "assistant"]>>;
                            type: ZodOptional<
                                ZodEnum<["user", "assistant", "system", "result", "stream_event"]>,
                            >;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >[];
                    ok: boolean;
                    session_id?: string
                    | null;
                    summary: {
                        duration_api_ms?: number | null;
                        duration_ms?: number | null;
                        is_complete: boolean;
                        is_error?: boolean | null;
                        num_turns?: number | null;
                        openai_trace_id?: string | null;
                        result?: string | null;
                        session_id?: string | null;
                        structured_output?: unknown;
                        subtype?: string | null;
                        text?: string | null;
                        total_cost_usd?: number | null;
                        trace_id?: string | null;
                        usage?: Record<string, unknown> | null;
                    };
                }
                | null;
            sandbox_id?: string
            | null;
            schedule_at?: number | null;
            session_id: string;
            started_at?: number | null;
            status: "queued" | "running" | "complete" | "failed" | "canceled";
            tenant_id?: string | null;
            tool_call_count?: number | null;
            total_cost_usd?: number | null;
            updated_at?: number | null;
            usage?: Record<string, unknown> | null;
            user_id?: string | null;
            webhook?:
                | {
                    attempts?: number
                    | null;
                    delivered_at?: number | null;
                    last_error?: string | null;
                    last_status?: number | null;
                    secret_ref?: string | null;
                    url?: string | null;
                }
                | null;
        },
    > = ...

    Runtime schema for job status responses returned by the Modal backend.

    session_id is mandatory because Worker ownership checks fail closed when the backend omits authoritative actor-scope identity.