Genkit JS API reference
    Preparing search index...

    The registry is used to store and lookup actions, trace stores, flow state stores, plugins, and schemas.

    Index

    Constructors

    Properties

    apiStability: "beta" | "stable"
    context?: ActionContext

    Additional runtime context data for flows and tools.

    dotprompt: Dotprompt
    parent?: Registry

    Methods

    • Parameters

      • key: ParsedRegistryKey

      Returns Promise<
          | Action<
              z.ZodTypeAny,
              z.ZodTypeAny,
              z.ZodTypeAny,
              ActionRunOptions<any>,
          >
          | undefined,
      >

    • Initializes all plugins in the registry.

      Returns Promise<void>

    • Initializes a plugin already registered with registerPluginProvider.

      Parameters

      • name: string

        The name of the plugin to initialize.

      Returns Promise<void | InitializedPlugin>

      The plugin.

    • Returns all actions that have been registered in the registry.

      Returns Promise<ActionsRecord>

      All actions in the registry as a map of <key, action>.

    • Returns all actions that are resolvable by plugins as well as those that are already in the registry.

      NOTE: this method should not be used in latency sensitive code paths. It may rely on "admin" API calls such as "list models", which may cause increased cold start latency.

      Returns Promise<ActionMetadataRecord>

      All resolvable action metadata as a map of <key, action metadata>.

    • Type Parameters

      • T

      Parameters

      • type: string

      Returns Promise<Record<string, T>>

    • Looks up an action in the registry.

      Type Parameters

      Parameters

      • key: string

        The key of the action to lookup.

      Returns Promise<R>

      The action.

    • Looks up a background action from the registry.

      Parameters

      • key: string

        The key of the action to lookup.

      Returns Promise<
          | BackgroundAction<
              z.ZodTypeAny,
              z.ZodTypeAny,
              BackgroundActionRunOptions,
          >
          | undefined,
      >

      The action.

    • Looks up a plugin.

      Parameters

      • name: string

        The name of the plugin to lookup.

      Returns PluginProvider | undefined

      The plugin provider.

    • Looks up a schema.

      Parameters

      • name: string

        The name of the schema to lookup.

      Returns Schema | undefined

      The schema.

    • Type Parameters

      • T = unknown

      Parameters

      • type: string
      • key: string

      Returns Promise<T | undefined>

    • Registers an action in the registry.

      Type Parameters

      Parameters

      • type:
            | "custom"
            | "prompt"
            | "model"
            | "tool"
            | "dynamic-action-provider"
            | "embedder"
            | "evaluator"
            | "executable-prompt"
            | "flow"
            | "indexer"
            | "background-model"
            | "check-operation"
            | "cancel-operation"
            | "reranker"
            | "retriever"
            | "tool.v2"
            | "util"
            | "resource"

        The type of the action to register.

      • action: Action<I, O>

        The action to register.

      • Optionalopts: { namespace?: string }

      Returns void

    • Registers an action promise in the registry.

      Type Parameters

      Parameters

      • type:
            | "custom"
            | "prompt"
            | "model"
            | "tool"
            | "dynamic-action-provider"
            | "embedder"
            | "evaluator"
            | "executable-prompt"
            | "flow"
            | "indexer"
            | "background-model"
            | "check-operation"
            | "cancel-operation"
            | "reranker"
            | "retriever"
            | "tool.v2"
            | "util"
            | "resource"
      • name: string
      • action: PromiseLike<Action<I, O, z.ZodTypeAny, ActionRunOptions<any>>>
      • Optionalopts: { namespace?: string }

      Returns void

    • Registers a plugin provider. This plugin must be initialized before it can be used by calling initializePlugin or initializeAllPlugins.

      Parameters

      • name: string

        The name of the plugin to register.

      • provider: PluginProvider

        The plugin provider.

      Returns void

    • Registers a schema.

      Parameters

      • name: string

        The name of the schema to register.

      • data: Schema

        The schema to register (either a Zod schema or a JSON schema).

      Returns void

    • Parameters

      • type: string
      • name: string
      • value: any

      Returns void

    • Parameters

      • key: string

      Returns Promise<string[]>

    • Resolves a new Action dynamically by registering it.

      Parameters

      • pluginName: string

        The name of the plugin

      • actionType:
            | "custom"
            | "prompt"
            | "model"
            | "tool"
            | "dynamic-action-provider"
            | "embedder"
            | "evaluator"
            | "executable-prompt"
            | "flow"
            | "indexer"
            | "background-model"
            | "check-operation"
            | "cancel-operation"
            | "reranker"
            | "retriever"
            | "tool.v2"
            | "util"
            | "resource"

        The type of the action

      • actionName: string

        The name of the action

      Returns Promise<void>

    • Creates a new registry overlaid onto the provided registry.

      Parameters

      Returns Registry

      The new overlaid registry.