Sanity Library Reference Docs
    Preparing search index...

    Interface ContentAgentProviderSettings

    Settings for creating a Content Agent provider instance via createContentAgent.

    import { createContentAgent } from 'content-agent'

    const contentAgent = createContentAgent({
    organizationId: 'your-org-id',
    token: 'your-sanity-token',
    // Optional overrides:
    // baseURL: 'https://api.sanity.io',
    // apiVersion: 'v2026-01-01',
    })
    interface ContentAgentProviderSettings {
        apiVersion?: string;
        application?: {
            bundleVersion?: string;
            intentBaseUrl?: string;
            key?: string;
            name?: string;
            resource?: { id?: string; type?: "dataset" };
            schemaDescriptorId?: string;
            title?: string;
        };
        baseURL?: string;
        fetch?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        headers?: Record<string, string>;
        organizationId: string;
        token?: string;
    }
    Index

    Properties

    apiVersion?: string

    API version to use for requests. Should be in format 'vYYYY-MM-DD' (e.g., 'v2026-01-01').

    'v2026-01-01'
    
    application?: {
        bundleVersion?: string;
        intentBaseUrl?: string;
        key?: string;
        name?: string;
        resource?: { id?: string; type?: "dataset" };
        schemaDescriptorId?: string;
        title?: string;
    }

    Default application for all agent and prompt calls.

    When set, this application is used unless overridden per-call via AgentSettings.application or GenerateSettings.application.

    Typically set automatically by createStudioAgent.

    Type declaration

    • OptionalbundleVersion?: string

      Bundle version

    • OptionalintentBaseUrl?: string

      Format: uri

      Base URL for the Sanity Studio

      https://your-studio.sanity.studio
      
    • Optionalkey?: string

      Application key in format "projectId.datasetName"

      abc123.production
      
    • Optionalname?: string

      Application name

    • Optionalresource?: { id?: string; type?: "dataset" }
      • Optionalid?: string

        Resource ID in format "projectId.datasetName"

        abc123.production
        
      • Optionaltype?: "dataset"

        Resource type

    • OptionalschemaDescriptorId?: string

      Schema descriptor ID

    • Optionaltitle?: string

      Application title

    baseURL?: string

    Base URL for the Sanity API.

    'https://api.sanity.io'
    
    fetch?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    }

    Custom fetch implementation. Useful for testing or adding middleware.

    Type declaration

      • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
      • Parameters

        • input: URL | RequestInfo
        • Optionalinit: RequestInit

        Returns Promise<Response>

      • (input: string | URL | Request, init?: RequestInit): Promise<Response>
      • Parameters

        • input: string | URL | Request
        • Optionalinit: RequestInit

        Returns Promise<Response>

    headers?: Record<string, string>

    Custom headers to include in requests.

    organizationId: string

    Your Sanity organization ID.

    When using createStudioAgent, this is fetched automatically from the project metadata.

    token?: string

    Authentication token for the Sanity API. If not provided, requests will be made without authentication (useful for browser contexts where auth may come from cookies).