GenkitAgents extension
Experimental agent-authoring methods on Genkit.
Import package:genkit/experimental.dart to bring these into scope. They
only touch the public Genkit surface (the registry and Genkit.definePrompt),
so call sites read the same as any built-in method: ai.defineAgent(...).
Methods
-
currentSession<
State> () → Session< State> ? -
Available on Genkit, provided by the GenkitAgents extension
Returns the Session active in the current agent turn, ornullwhen called outside of an agent turn. -
defineAgent<
CustomOptions, Input, State> ({required String name, String? variant, ModelRef< CustomOptions> ? model, CustomOptions? config, String? description, SchemanticType<Input> ? inputSchema, String? system, List<Part> ? systemParts, String? prompt, List<Part> ? promptParts, List<Message> ? messages, String? messagesTemplate, GenerateActionOutputConfig? output, int? maxTurns, bool? returnToolRequests, Map<String, dynamic> ? metadata, List<Tool> ? tools, List<String> ? toolNames, String? toolChoice, List<GenerateMiddlewareRef> ? use, Map<String, dynamic> ? promptInput, SchemanticType<State> ? stateSchema, SessionStore? store, ClientTransform? clientTransform}) → Agent<State> -
Available on Genkit, provided by the GenkitAgents extension
Defines and registers an agent by creating a prompt and wiring it into a multi-turn agent in one step. -
defineCustomAgent<
State> ({required String name, String? description, SchemanticType< State> ? stateSchema, SessionStore? store, ClientTransform? clientTransform, required AgentFn<State> fn}) → Agent<State> -
Available on Genkit, provided by the GenkitAgents extension
Registers a multi-turn custom agent action capable of maintaining persistent state. -
definePromptAgent<
State> ({required String promptName, Map< String, dynamic> ? promptInput, SchemanticType<State> ? stateSchema, SessionStore? store, ClientTransform? clientTransform}) → Agent<State> -
Available on Genkit, provided by the GenkitAgents extension
Registers an agent from an existing, previously-defined prompt.