Sanity Library Reference Docs
    Preparing search index...

    Variable useAgentGenerateConst Alpha

    useAgentGenerate: () => (options: AgentGenerateOptions) => Subscribable<unknown> = ...

    Generates content for a document (or specific fields) via Sanity Agent Actions.

    • Uses instruction templates with $variables and supports instructionParams (constants, fields, documents, GROQ queries).
    • Can target specific paths/fields; supports image generation when targeting image fields.
    • Supports optional temperature, async, noWrite, and conditionalPaths.

    Returns a stable callback that triggers the action and yields a Subscribable stream.

    Type declaration