NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev
pub.dev, #1660 most downloaded on pub.dev
Genkit Dart package, a Generative AI library for pure Dart client/server and Flutter apps.
Latest stable
1.0.2
Last release 11 days ago
10 Nov 2026
Ships fairly regularly
a new release about every 3 weeks
Nearly every release is documented
notes for 26 of 26 stable releases
Nothing withdrawn
no release was ever pulled
2 years old
51 releases · first in 2025
Drag across the ruler to compare, or tap a release to open it.
Plus a long list of bug fixes. This release has breaking changes, so check them before upgrading.
[!IMPORTANT] Firebase AI Logic enforces App Check from November 2, 2026 (you can delay it in the console until January 21, 2027 at the latest). The README shows how to set it up.
What's new:
Model catalog. init() registers the models Firebase AI Logic serves (text, image, TTS and Live), each only on the backends that serve it, with its own label, stage and capabilities. They show up in the Developer UI, along with a GeminiOptions config form. (#670, #671, #678)
thinkingLevel for Gemini 3.x models. (#614)
config: GeminiOptions(thinkingConfig: ThinkingConfig(thinkingLevel: 'HIGH')),
Grounding with Google Search, URL context and Google Maps. Grounding and URL context metadata are returned in response.custom. (#668)
config: GeminiOptions(
googleSearch: GeminiGoogleSearch(),
urlContext: GeminiUrlContext(),
),
Safety settings. GeminiOptions.safetySettings, with the same shape as in genkit_google_genai. (#665)
Image and speech generation options. imageConfig, speechConfig (including multi-speaker TTS) and mediaResolution, which a media part can also set for itself. For multi-speaker TTS, a text part names its speaker with metadata: {'speechMetadata': {'speaker': 'Joe'}}. (#669, #737)
Cancellation. ai.generate(cancel: token) now aborts the in-flight request and ends with finishReason: aborted. A cancelled Live session closes and ends with a CancelledException. (#667)
Errors carry a status code. Firebase AI and HTTP errors are mapped to GenkitException with a proper status (RESOURCE_EXHAUSTED, PERMISSION_DENIED, UNAVAILABLE, ...), so retry() and your own code can tell a quota error from a bad request or a network failure. (#615)
Schemas go to Gemini unchanged. Output schemas are sent as responseJsonSchema and tool input schemas as parametersJsonSchema, so enum, anyOf, additionalProperties, $ref and friends now reach the model. (#612, #666)
firebase_ai 5.x support. The plugin accepts firebase_ai >=3.15.0 <6.0.0. gemini-3.8-live needs 5.0 or later. (#673)
Refreshed README covering App Check, the model list, every option, errors, cancellation, the Live API, and known caveats from live testing. (#664, #674, #723, #738)
Plus a long list of bug fixes. This release has breaking changes, so check them before upgrading.
The model now writes UI in A2UI Express, a compact DSL, instead of JSON messages. The middleware compiles each block to the same v0.9 messages, so renderers and the server-side calling code (use: [a2ui()]) don't change. (#472)
<a2ui>
surface("tokyo-weather")
$/temp = "18°C"
root = Card(body)
body = Column([title, temp])
title = Text("Weather in Tokyo", "h3")
temp = Text($/temp)
</a2ui>
In our evals, Express cut output tokens per turn by about 64% compared to 0.4, and turns that failed because of broken UI dropped from 1.9% to 0.6%.
What's new:
Every block is compiled and checked against the catalog's schemas (component names, property types, enums, references), not just component names. (#472)
Partial updates. Blocks are checked against the surfaces the client already holds, so a block without root updates a live surface in place, for example just its data. (#714)
<a2ui>
surface("tokyo-weather")
$/temp = "21°C"
</a2ui>
Self-repair. When a block fails to compile, the middleware asks the model once to fix it instead of dropping the surface. On by default; opt out with a2ui(repair: false). (#474)
Fewer unnecessary surfaces. The injected instructions tell the model to answer small talk, explanations and simple facts in prose. Your system prompt can still ask for more or fewer surfaces. (#715)
Spec-aligned catalogs. Catalogs use the A2UI spec's catalog.json format, so published catalogs load as-is, and A2uiCatalogComponent.simple builds one in Dart without hand-writing JSON Schema. (#468)
Clients don't depend on genkit_a2ui anymore. A client needs package:genkit, a renderer and two small helpers from the README. The sample is split into separate server and client packages to show it. (#710, #711)
This is a breaking release, see Breaking changes and the README's Migrating from 0.4 section.
Errors are GenkitExceptions with a status. ai.generate reports a model error as finishReason: FinishReason.failed, with the status in response.error. response.cause is now a GenkitException, so response.cause is QuotaExceeded (or on QuotaExceeded catch) no longer matches. Check the status instead; the original firebase_ai exception is cause.cause. (#615)
Finish reasons use Genkit's names. maxTokens is now length, safety is blocked, malformedFunctionCall is other, and values firebase_ai can't parse are unknown. Compare against the FinishReason constants. The value firebase_ai parsed is in custom['finishReason']. (#608)
Schemas are sent verbatim. Keywords that used to be dropped now reach the model, and only the fields listed in required are required (before, every property was). The same schema can produce different output, so re-check prompts that relied on every field being filled in. (#612, #666)
GeminiOptions.responseSchema is removed. Use responseJsonSchema with a regular JSON Schema, or just pass outputSchema: to ai.generate. (#736)
// Before
config: GeminiOptions(
responseMimeType: 'application/json',
responseSchema: {'type': 'object', 'properties': {...}},
),
// After
config: GeminiOptions(
responseMimeType: 'application/json',
responseJsonSchema: {'type': 'object', 'properties': {...}, 'required': [...]},
),
logprobs and responseLogprobs are removed from GeminiOptions. Firebase AI Logic never sent them. (#606)
firebaseAiModelInfo is removed. Read the model's own metadata instead. (#735)
final model = await ai.registry.lookupAction(.model, 'firebaseai/gemini-flash-latest');
final info = model?.metadata['model'];
Converters and Live helpers are no longer exported. The toGemini* / fromGemini* functions, extractUsage and the Live helpers are now internal. Call models through firebaseAI and ai.generate. (#716)
Missing token counts are null, not 0. usage.inputTokens! and friends compile but can fail at runtime; use ?? 0 where you need a number. (#675)
Streaming with candidateCount > 1 fails with INVALID_ARGUMENT. It used to silently merge the candidates' text. Use a non-streaming request for several candidates. (#676)
Live sessions report errors. A session the server closes (even with a normal close code) now fails with a GenkitException carrying the server's reason instead of ending with finishReason: stop, and receive errors are thrown instead of logged. A system message sent after the first request fails with INVALID_ARGUMENT; put system instructions in the first request. (#677)
Calling code on the server (use: [a2ui()]) and the v0.9 messages on the wire are unchanged. See the README's Migrating from 0.4 section for upgrade order and a staged rollout.
Model output format is A2UI Express. Prompts, evals or fixtures with ```a2ui JSON blocks need updating, and instructions: 'none' users must rewrite their prompts (see renderCatalogInstructions). The surfaceId option is removed: surface ids now come from the model, and reusing one replaces or updates that surface. (#472)
// Before
a2ui(surfaceId: 'main')
// After
a2ui()
Catalogs use the spec's catalog.json shape. A2uiCatalog.components is now a name-keyed Map, A2uiCatalogComponent.props is replaced by a JSON Schema (build one with A2uiCatalogComponent.simple), and catalog files must use the object form. Extend the basic catalog with extend. (#468)
final myCatalog = basicCatalog.extend(
id: 'https://my-app.org/catalogs/custom.json',
components: [
A2uiCatalogComponent.simple(
name: 'Gauge',
description: 'A circular gauge for a single numeric value.',
params: [
A2uiParam.dynamicValue('value', required: true, type: .number),
A2uiParam.number('max'),
],
),
],
);
package:genkit_a2ui/client.dart is removed, and a2ui parts use data.messages instead of data.envelopes. Clients only need package:genkit and a renderer, plus two small helpers you can copy from the README. The server still reads envelopes from older clients. (#710)
baseUrl. googleAI(baseUrl: ...) lets the plugin talk to proxies and gateways that serve the Gemini REST API. (#704)interruptRestart now finds namespaced tools (such as MCP tools like work-orders/order_part) instead of failing with Tool not found. (#658)systemInstruction instead of user turns, for both generate and Live, and every system message is kept. (#605, #681)UnimplementedError, and they round-trip back to the model in history. (#607)Function call is missing a thought_signature. (#650)FAILED_PRECONDITION naming the block reason, instead of a StateError (streaming) or a generic INTERNAL error that retry() would resend. (#613)httpClient share one client, instead of leaking a new one per request. (#648)responseMimeType is no longer sent as an empty string when unset. (#649)speechConfig without voiceConfig no longer throws), and audio, images, video and tool responses are each sent the right way. (#651)data: URLs fail with INVALID_ARGUMENT instead of INTERNAL, so retry() doesn't resend them. (#679, #697)functionCall without args (a tool that takes no arguments) is treated as empty input instead of failing the tool. (#693)thoughtSignature are kept instead of failing the whole generate call. (#683)dynamicSchema()) no longer send a typeless parametersJsonSchema. Also applies to genkit_vertexai. (#694)rawToolResponses: true if you need the old raw shape. (#702)subscriptions/listen, running without list-change notifications instead of crashing with an unhandled error. (#685)anthropic_sdk_dart ^9.0.1, which fixes FormatException: Unknown ServiceTier from proxies that send an empty service_tier. (#687)openai_dart ^11.0.1. (#630)Full changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v1.0.1...genkit-v1.0.2
Your coding agent can read these notes before it upgrades. Set up the MCP server →
The plugin no longer uses the firebase_ai APIs that were deprecated in 3.15 and are removed in the next upstream major. App Check and Auth are now rea…
vertexAI provider is replaced by agentPlatform, and the appCheck and auth params are removed. The plugin no longer uses the firebase_ai APIs that were deprecated in 3.15 and are removed in the next upstream major. App Check and Auth are now read from the FirebaseApp, so register them for that app (FirebaseAppCheck.instanceFor(app:), FirebaseAuth.instanceFor(app:)) before the first model call. (#609)
// Before
firebaseAI(
appCheck: FirebaseAppCheck.instanceFor(app: app),
auth: FirebaseAuth.instanceFor(app: app),
provider: FirebaseAiProvider.vertexAI(location: 'us-central1'),
);
// After
firebaseAI(
provider: FirebaseAiProvider.agentPlatform(location: 'us-central1'),
);
global instead of us-central1. Preview models are only available on global. If you use Agent Platform Live models or need us-central1 for data residency, pass location: 'us-central1' explicitly.firebase_ai 3.15.0 and firebase_core ^4.13.0.Tools can use primitive input schemas. Tools with non-object input schemas (for example inputSchema: .string()) now work with every provider. Genkit wraps the input as {input: <value>} when it talks to the model, and your tools, middleware and history still see the shape you declared. When you use defineRemoteModel, the serving side does the wrapping, so update the server before you adopt these tools on the client. (#653)
ai.defineTool(
name: 'echo',
description: 'Echo a string back.',
inputSchema: .string(),
fn: (input, _) async => .response('echo: $input'), // input is a String
);
httpClient parameter. You can pass your own http.Client with firebaseAI(httpClient: client). The plugin never closes a client you pass in. (#602)firebase_ai >=3.8.0 <5.0.0, so apps already on 4.x can depend on it. (#601){}. Before, sessions with a stateSchema could crash in updateCustom/getCustom because they got an empty object instead of null. (#642)generate() with interruptRespond/interruptRestart now fails with FAILED_PRECONDITION when the last message is not a model tool request. Before, it ignored the resume and called the model again from scratch. This matches the JS and Go SDKs. (#641)Full changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v1.0.0...genkit-v1.0.1
This release has a lot of breaking changes. Most of them are small renames and tightened types that came out of a full review of the public API before…
Genkit Dart is now 1.0. The core genkit package, schemantic, and the main plugins are stable and covered by semantic versioning. Some packages stay on 0.x because their underlying platforms or APIs are still changing:
| Package | Version |
|---|---|
genkit, schemantic, schemantic_builder |
1.0.0 |
genkit_google_genai, genkit_vertexai, genkit_anthropic, genkit_openai |
1.0.0 |
genkit_middleware, genkit_mcp, genkit_shelf |
1.0.0 |
genkit_firebase_ai, genkit_google_cloud |
0.3.0 |
genkit_chrome, genkit_otel, genkit_vertex_auth |
0.2.0 |
genkit_a2ui |
0.4.0 |
This release has a lot of breaking changes. Most of them are small renames and tightened types that came out of a full review of the public API before freezing it. The ones you are most likely to hit are GenkitRouter (if you used genkit_shelf), prompts, and GenerateResult.
The stable API is now clearly separated from experimental features. Stable libraries are covered by semver:
import 'package:genkit/genkit.dart';
import 'package:genkit/client.dart';
import 'package:genkit/lite.dart';
import 'package:genkit/plugin.dart';
import 'package:genkit/telemetry.dart';
import 'package:genkit/io.dart'; // new: HTTP serving (dart:io)
Experimental features have their own imports. They can change or be removed in any minor release:
import 'package:genkit/experimental.dart'; // agents, sessions, snapshots, live/bidi models
import 'package:genkit/experimental_client.dart'; // browser-safe agent client
import 'package:genkit/experimental_io.dart'; // FileSessionStore, GenkitRouter.addAgent
import 'package:genkit_middleware/agents.dart'; // agents() sub-agent delegation middleware
These libraries are annotated @experimental, so the analyzer warns (experimental_member_use) as soon as you import one. If you've accepted the instability, you can silence the warning:
# analysis_options.yaml
analyzer:
errors:
experimental_member_use: ignore
What moved:
AgentOutput, AgentInput, SessionSnapshot, TurnEnd, Artifact, JsonPatchOperation, and about 15 more) are no longer exported from the stable libraries. Import experimental.dart or experimental_client.dart. (#480)genkit_middleware no longer re-exports agents(), AgentsPlugin, AgentsOptions and related types. Import package:genkit_middleware/agents.dart directly. (#482)Action.streamBidi() now triggers the experimental warning. BidiActionStream and BidiActionFn are exported from experimental.dart. (#483)GenkitRouterHTTP serving now lives in core (package:genkit/io.dart) and runs on plain dart:io. genkit_shelf is now a thin adapter on top of it. startFlowServer and FlowWithContextProvider are gone. (#533)
import 'package:genkit/io.dart';
final genkit = GenkitRouter()
..addAction(helloFlow) // POST /hello
..addAction(secureFlow, contextProvider: bearerAuth) // per-action auth
..addAction(googleAI().model('gemini-flash-latest')); // models and tools can be served too
await genkit.serve(port: 8080, cors: const CorsOptions());
Context providers get a framework-neutral RequestData instead of a shelf Request. Header names are lowercased:
Future<Map<String, dynamic>> bearerAuth(RequestData request) async {
final user = await verifyToken(request.headers['authorization']);
if (user == null) {
throw GenkitException('Unauthorized', status: StatusCode.unauthenticated); // 401
}
return {'userId': user.id}; // becomes ctx.context
}
You can also mount it inside your own server, or serve a single action:
// your own dart:io server
await for (final request in server) {
if (await genkit.handleHttpRequest(request, basePath: '/api')) continue;
// ...your routes
}
// single action
final handleHello = ioHandler(helloFlow, contextProvider: bearerAuth);
// shelf
final app = Router()
..post('/hello', shelfHandler(helloFlow))
..mount('/api/', genkit.asShelfHandler());
Agents (experimental) mount with one call. You no longer need hand-written /getSnapshot and /abort routes:
import 'package:genkit/experimental_io.dart';
final api = GenkitRouter()
..addAgent(weatherAgent) // turn + /getSnapshot + /abort
..addAgent(bankingAgent, contextProvider: bearerAuth);
Migrating from startFlowServer:
// before
await startFlowServer(
flows: [helloFlow, FlowWithContextProvider(flow: secureFlow, context: bearerAuth)],
cors: {'origin': '*'},
);
// after
final genkit = GenkitRouter()
..addAction(helloFlow)
..addAction(secureFlow, contextProvider: bearerAuth);
await genkit.serve(cors: const CorsOptions());
Wire format change: streamed responses now use Content-Type: text/event-stream, and a failed stream ends with a data: {"error": ...} frame instead of error: {...}. This matches the Go and Python servers. Clients from genkit 0.17 and earlier only understand the old frame. If you have shipped apps (for example Flutter apps) that use an old client, turn on the legacy frame:
final genkit = GenkitRouter(sendLegacyErrorFrame: true);
See #533 for the full design and migration guide.
Some models don't support constrained (schema-enforced) output natively. For those, you can opt into simulateConstrainedGeneration(). It moves the output schema into the prompt as instructions, so structured output still works. It's built in, so you don't need to register a plugin. (#453, #519)
final response = await ai.generate(
model: someModel,
prompt: 'Describe a cat',
outputSchema: Cat.$schema,
use: [simulateConstrainedGeneration()],
);
// Lite API
await lite.generate(
model: model,
outputSchema: Cat.$schema,
use: [SimulateConstrainedGenerationMiddleware()],
);
Nothing is rewritten unless you add the middleware. If a model doesn't support constrained output (for example Chrome's built-in model), add the middleware or use the provider's own config option, such as Chrome's responseConstraint.
Prompts now have an Output type parameter, so they return typed structured output just like generate. ExecutablePrompt is renamed to Prompt. Call options are now named parameters, the same ones generate takes. (#527, #622)
final joke = ai.definePrompt(
name: 'joke',
inputSchema: JokeInput.$schema,
outputSchema: Joke.$schema,
prompt: 'Tell a joke about {{topic}}',
); // Prompt<JokeInput, Joke>
final Joke? j = (await joke(JokeInput(topic: 'cats'), config: {'temperature': 0.2})).output;
// typed lookup
final p = await ai.prompt<JokeInput, Joke>('joke');
// .prompt file with a schema but no Dart type
final s = await ai.prompt('summarize', outputParserSchema: Summary.$schema);
The Lite API's generate / generateStream also infer a typed output from outputSchema now. (#499)
ai.defineGenerateMiddleware registers middleware from app code, with no plugin needed. The top-level defineMiddleware used by plugin authors is renamed to generateMiddleware. (#571)
final logging = ai.defineGenerateMiddleware<LoggingOptions>(
name: 'logging',
configSchema: LoggingOptions.$schema,
create: (config, ctx) => LoggingMiddleware(config),
);
await ai.generate(prompt: 'hi', use: [logging(LoggingOptions(level: 'debug'))]);
retry() works out of the box. RetryPlugin is removed; delete it from plugins:. Delays are now Durations, and retryModel is now noRetryModel. (#531, #549)
use: [retry(maxRetries: 3, initialDelay: const Duration(milliseconds: 500))]
The middleware tool hook returns ToolResult. GenerateMiddleware.tool now returns Future<ToolResult>, and ToolInterruptException is removed. Return .interrupt(data) instead of throwing. (#503)
genkit)GenerateResponseHelper is renamed to GenerateResult. rawResponse is now modelResponse, rawChunk is now modelChunk, and jsonOutput is removed (use output). (#534)GenerateResult and GenerateResponseChunk are now read-only views. They no longer extend the wire types and have no setters or toJson(). To forward chunks to a flow, use onChunk: (c) => ctx.sendChunk(c.modelChunk). (#547)inputTokens, outputTokens, Candidate.index, ...) are now int instead of double. (#546)ExecutablePrompt<Input> is now Prompt<Input, Output>. Type parameter order is now payload types first, config last, everywhere: generate<Output, CustomOptions>, definePrompt<Input, Output, CustomOptions>, defineAgent<Input, State, CustomOptions>. (#527)Prompt.call / stream / render take named parameters. PromptGenerateOptions is removed. (#622)ExecutablePrompt.ref is now a PromptRef class instead of a record. PromptConfig is no longer exported. (#528, #529)| Before | After | PR |
|---|---|---|
StatusCodes.NOT_FOUND |
StatusCode.notFound (use .wireName for 'NOT_FOUND') |
#542 |
EvalStatusEnum.PASS |
EvalStatus.pass |
#545 |
GenkitException(underlyingException:) |
GenkitException(cause:). statusCode is removed (use status.value or status.httpStatus) |
#548 |
ToolFnArgs |
ToolFnArg |
#537 |
remoteModel(modelInfo:), modelMetadata(modelInfo:) |
info: |
#537 |
RemoteAction.dispose() |
close() |
#537 |
Tool(toolOutputSchema:) |
Tool(outputSchema:) |
#530 |
ai.embedMany(documents:) |
ai.embed(documents:) |
#535 |
cacheTtlMillis: 60000 |
cacheTtl: const Duration(minutes: 1) (also in genkit_mcp) |
#539 |
defineMiddleware(...) |
generateMiddleware(...) |
#571 |
toolChoice is now a ToolChoice open enum instead of String, for example toolChoice: .required. (#493)Role, FinishReason, ToolChoice, ...) are now const, so you can use them as switch cases. (#544)ActionFnArg, GenerateTurnState and GenerateMiddlewareContext are now final classes instead of record typedefs. Code that built them with record literals needs to use the constructors. (#484, #485, #486)Model, Flow, Tool, ...) are base. Handle types are final. Registry is final, and its plumbing methods are now @internal. (#487, #529)Model, Embedder, Evaluator and Flow constructors now take non-null input, so plugin authors no longer need req!. Evaluator drops its unused type parameter. (#536, #528)ActionStream.setResult / setError and the ActionMetadata.key setter are now @internal. BidiModel.customOptions and Embedder.customOptions are now final. (#488, #489, #528)GenerateMiddlewareDef is now a final, callable class. Build one with generateMiddleware or ai.defineGenerateMiddleware. (#571)ToolFnArgs.interrupt(). Return .interrupt(data) from the tool instead. (#497)ToolInterruptException. (#503)RetryPlugin. (#531)Formatter, FormatterHandlerResult, MessageParser and ChunkParser exports. (#491)createResourceMatcher from genkit.dart. It's now exported from plugin.dart. (#529)package:genkit/io.dart. The name is reused for the new HTTP serving library. (#498, #533)Types that appeared in public signatures but couldn't be named are now exported: ActionStream, Evaluator, ActionFn, StreamingCallback, Registry, and others. (#490)
.prompt files now use spec-compliant Picoschema:
tags(array): string is now an array of strings. It used to be a string with the description "array".(*): string now maps to additionalProperties.email(the email): string logs a warning at load time and fails at render time. Use email: string, the email instead.(#573)
genkit_shelfstartFlowServer and FlowWithContextProvider are removed. Use GenkitRouter with shelfHandler / asShelfHandler(). Context providers take RequestData. See Serving over HTTP. (#533)genkit_middlewarepackage:genkit_middleware/agents.dart. (#482)genkit_google_genai / genkit_vertexaiGoogleAiModels is removed. Name models by string: googleAI.gemini('gemini-flash-latest'), googleAI.geminiTts('gemini-3.8-flash-tts'). Catalog enums are no longer exported. (#524)ThinkingConfig is now GeminiThinkingConfig. The same applies to GeminiSafetySettings, GeminiFunctionCallingConfig, GeminiGoogleSearch, GeminiFileSearch, and the speech/voice config types. TextEmbedderOptions is now GoogleGenAiEmbedderOptions. (#572)genkit_anthropicThinkingConfig is now AnthropicThinkingConfig. (#572)toolChoice: required now maps to Anthropic's any. (#492)genkit_openaiOpenAIModels, OpenAIEmbedders, XaiModels and DeepSeekModels are removed. Use openAI.model('gpt-5.5'), xAI.model(...), deepSeek.model(...) and openAI.embedder(...). modelInfoFor and related functions are still exported. OpenAIModelKind is now a class. (#525)GenkitConverter, getModelType, the capability-set constants) are no longer exported. (#502)schemanticjson_schema_builder calls. $Schema and the SchemaValidation re-export are removed. Regenerate your .g.dart files with schemantic_builder 1.0.0. (#522)genkit)Interrupt tool class for human-in-the-loop patterns. Tool and the related types are now exported from the Lite API. (#399)genkit_openaitts-1, tts-1-hd and gpt-4o-mini-tts through openAI.speechModel(). (#405)whisper-1, gpt-4o-transcribe and gpt-4o-mini-transcribe through openAI.transcriptionModel(), including Whisper translation. (#406)reasoningEffort and verbosity options, plus reasoning output. (#430)genkit_anthropicapiVersion, betas) and native structured output through output_config.format. Structured output now works together with extended thinking and with your own tools. (#402)http.Client. (#226)genkit_google_genai / genkit_vertexaigemini-embedding-* embedders are discovered automatically and can embed media. (#394)genkit)defineSchema names in .prompt files are resolved at render time. (#570)package:logging instead of print(). (#508)genkit_middlewareToolApprovalPlugin(approvedTools:) is honored when toolApproval() is called without a list. (#538)toolChoice option. (#494, #495, #496)list() falls back to the curated catalog when model discovery fails. (#512)gemini-2.5-pro. (#509)example/ programs added for genkit_chrome, genkit_firebase_ai and genkit_google_cloud. (#505)Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.17.0...genkit-v1.0.0
Release genkit-v1.0.0-rc.3
Release genkit-v1.0.0-rc.3
Release genkit-v1.0.0-rc.2
Release genkit-v1.0.0-rc.2
Release genkit-v1.0.0-rc.1
Release genkit-v1.0.0-rc.1
We're moving fast towards a stable 1.0 release. This is a big release centered on making generate and agents resilient to failures and cancellation, a
We're moving fast towards a stable 1.0 release. This is a big release centered on making generate and agents resilient to failures and cancellation, a redesigned telemetry system, and a batch of plugin improvements.
generate no longer throws on model/tool errors, cancellation, or maxTurns. It now resolves to a GenerateResponse with a failed or aborted finish reason plus the last-good history, so you can inspect what happened and resume from where it stopped. (#397, #413)failed and aborted snapshots can be rerun. (#411, #413)Most of these are subtle behavior shifts rather than large API rewrites. Details and migration below.
generate resolves instead of throwing (#397, #413)Three related changes to how errors and cancellation surface:
maxTurns no longer throws. Previously a maxTurns overrun threw a GenkitException with ABORTED status. It now returns a response with finishReason: aborted carrying the last turn's history.GenerateResponse with finishReason: failed, carrying a structured error and the last-good history (the failing turn's partial output is dropped).fn that throws (or a tool-not-found) previously got swallowed into an Error: ... tool response and fed back to the model. It now fails the generation with finishReason: failed and the last-good history. A caller-token cancellation resolves to aborted.Migration: callers that wrapped generate() in try/catch to observe model or tool errors must now branch on the finish reason instead.
final res = await ai.generate(model: m, prompt: 'hi', toolNames: ['myTool']);
switch (res.finishReason) {
case FinishReason.failed:
print(res.error?.status); // structured, serializable error
print(res.cause); // raw thrown object, in-process only
// res.messages holds the last-good history; feed it back to resume.
case FinishReason.aborted:
// cancelled or maxTurns; res.messages is the resume point.
default:
print(res.text);
}
See #397 and #413 for the full walkthrough, including resuming a cancelled request.
aborting status and resumable terminal snapshots (#411, #413)Brings the Dart agent abort lifecycle in line with the Go reference implementation.
aborting snapshot status for the mid-flight abort window. It is transient and non-terminal: keep polling until a terminal status. DetachedTask.wait()/poll() already do this.abort() now returns the resulting status (pending -> aborting, already-terminal -> existing status, missing -> null) rather than the previous status. This diverges intentionally from JS.completed snapshots. Terminal failed and aborted snapshots that carry state can now be rerun.Migration: if you read the return value of abort(), note it now reflects the new state, not the prior one. When reading snapshots directly, branch on the status and re-read non-terminal ones (pending, aborting); a stale heartbeat surfaces as expired.
The agent stack (agents, sessions, snapshots) and the live/bidi model surface are no longer part of the stable, SemVer-covered API. They now live behind explicit opt-in imports so they can keep evolving without forcing major bumps.
Migration: add the relevant experimental import. Call sites are otherwise unchanged.
import 'package:genkit/genkit.dart';
import 'package:genkit/experimental.dart'; // agents, sessions, snapshots, bidi
import 'package:genkit/experimental_client.dart'; // browser-safe agent client
import 'package:genkit/experimental_io.dart'; // dart:io extras (FileSessionStore)
Experimental members are annotated with @experimental, so the analyzer flags their use. To opt out of the warning, set experimental_member_use: ignore in your analysis_options.yaml.
agent.send() now runs over the streaming transport (#457)AgentTransport.run has been removed. send() now calls sendStream() and drains it, which fixes server-managed agents returning null state from send() (they carry state through streamed patches). Matches JS and Go.
Migration: a third-party transport that overrode run will no longer compile; remove the override.
Brings the Dart dynamic action provider (DAP) to parity with JS across generate, the registry, reflection, and the MCP plugin. The getAction/getActionFn/resolveAction signatures changed, and dynamically provided action names are shortened (full name preserved in metadata.originalName). See the PR for details if you build on the registry directly.
Pluggable instrumentation provider system (#348). Instrumentation is now an externally configurable abstraction rather than a hardcoded OpenTelemetry dependency. By default Genkit is not instrumented; in dev, a built-in provider is auto-injected (when a telemetry server is available) so the Developer UI works out of the box. Third parties can implement the Instrumentation interface without an OTel dependency.
import 'package:genkit/telemetry.dart';
void main() {
configureInstrumentation(myInstrumentation());
final ai = Genkit(/* ... */);
}
ai.run and agent runTurn spans are now tagged with their action type (#445).
agents middleware gains a background delegation flag plus check_background_tasks, wait_for_background_tasks, abort_background_tasks, and continue_task tools. A background delegation detaches a server-managed sub-agent and returns a taskId immediately; the orchestrator collects results later. See testapps/agents/bin/async_agent_sample.dart.metadataOnly snapshot reads (#416). Fetch snapshot metadata without the full state payload.OpenAIModels gives a typed ModelRef per live model. Uncurated ids still resolve (now defaulting to full multimodal chat capability). Note some behavior shifts: -pro tiers are no longer curated (Responses-API only), retired models resolve but are never listed, and gpt-5-chat-latest is now listed.json_object sent for schemaless JSON output (#415, breaking). outputFormat: 'json' without a schema now sends json_object so the model is actually told to emit JSON. Also fixes jsonMode (was dead code) and strict-mode 400s. Breaking bit: strict: true is now strict: false on json_schema, so the schema becomes advisory rather than guaranteed. See #415.toAnthropicMessage had no reasoning branch, so thinking blocks were dropped from follow-up requests, breaking multi-turn thinking and tool loops. Now rebuilds thinking and redacted-thinking blocks. The signature metadata key is renamed from signature to thoughtSignature to match the Gemini plugins and Genkit JS; the old shape is still accepted on read. See #400.UNAVAILABLE (#459).seed is now sent in GenerationConfig (#452).generateContent support (#440).Rebuilt on mcp_dart for protocol handling (#341, breaking). Delegates protocol negotiation, request correlation, errors, and native stdio/Streamable HTTP handling to mcp_dart, mirroring how Genkit JS wraps the native MCP SDK. Prefers the stateless MCP 2026-07-28 protocol with automatic fallback to 2025-11-25. Breaking notes:
StreamableHttpClientTransport export removed; connect via McpServerConfig(url: ...), and custom client transports implement the new McpClientTransport interface.allowedHosts (and should set allowedOrigins).cacheTtlMillis semantics changed (positive overrides the server hint, negative disables caching, null/0 uses the protocol hint).See #341 for the full migration.
dart:io (#442).openai_dart to v8.0.0 (#418).Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.16.1...genkit-v0.17.0
failed responses (model + tool errors) + rerunnable failed snapshots (#413)aborting snapshot status + rerunnable aborted snapshots (Go parity) (#411)Release genkit-v0.17.0-rc.1
Release genkit-v0.17.0-rc.1
Agent session-store operations now receive the ambient request context. Previously the server-side agent runtime (defineAgent / defineCustomAgent) dro
genkit
defineAgent / defineCustomAgent) dropped the request context when calling SessionStore, so context-scoped stores like FirestoreSessionStore with snapshotPathPrefix always resolved the default "global" prefix instead of the correct per-tenant one. Context is now forwarded through session resolution, snapshot saves, detached tasks, heartbeats, snapshot reads, and abort, so multi-tenant isolation works as documented. (#410)AgentTransport.getSnapshot and AgentTransport.abort gained an optional context parameter. Third-party AgentTransport subclasses must update their overrides to accept it. See #410 for details. (#410)ctx.interrupt(...) still works but is soft-deprecated.
This release introduces A2UI (Agent-to-UI) support via the new genkit_a2ui package. An A2UI-enabled agent streams not just prose, but rich, interactive UI surfaces (components, layouts, forms) that a client (Flutter or Web) renders incrementally. The package ships the a2ui() middleware, a bundled basicCatalog, an incremental stream parser with configurable validation, and browser/Flutter-safe client helpers. A full runnable sample lives in testapps/a2ui (Shelf server plus a Flutter chat client rendering surfaces in real time). (#342, #401, #403, #404)
final uiAgent = ai.defineAgent(
name: 'uiAgent',
model: googleAI.gemini('gemini-flash-latest'),
system: 'You are a helpful assistant. Render UI when a result is clearer shown than told.',
use: [a2ui()],
);
ToolResult and multipart (#350)Tools now return a ToolResult<Output> instead of a bare value, using Dart dot-shorthand for ergonomics, and support multipart responses (structured output plus media parts). The stringly-typed actionType is now a typed ActionType. See the PR description for the full migration guide.
// BEFORE
fn: (input, ctx) async {
if (ctx.resumed == null) {
ctx.interrupt({'requiresConfirmation': true});
}
return 'Sunny in ${input.location}';
}
// AFTER
fn: (input, ctx) async {
if (ctx.resumed == null) {
return .interrupt({'requiresConfirmation': true});
}
return .response('Sunny in ${input.location}');
}
Key points:
tool.v2; anything running a tool by key must use /tool.v2/<name>.ctx.interrupt(...) still works but is soft-deprecated.tool.call) now yields a ToolResult: read (result as ToolResponseResult).output.actionType fields and params (including Registry.lookupAction) are now typed as ActionType; custom types via ActionType('my-type') still work.promptParts parameter across generate and generateStream (lite API, GenkitAI, and generateHelper), letting you build a user message from a list of Part objects (text and media) as an alternative to a string prompt. (#398)final response = await ai.generate(
promptParts: [
TextPart(text: 'Describe this image:'),
MediaPart(media: Media(url: 'data:image/png;base64,abc123')),
],
);
resolve() and list() now pick up curated ModelInfo (label, stage, capabilities), with typed GoogleAiModels refs and graceful fallback to dynamic discovery. (#329)ModelInfo, extended to 10 models with two-tier capability profiles, plus per-model thinking defaults. Unknown model names still resolve dynamically. (#322, #391, #396)lite.generate so the JSON formatter's constrained default and outputInstructions are applied to lite calls. (#377)user for Gemini API compatibility. (#340)ModelResponse.usage) for both streaming and non-streaming responses. (#373)INVALID_ARGUMENT error instead of a cryptic server 400. (#374)responseJsonSchema on constrained JSON mode and omit responseMimeType when unset. Also inherited by genkit_vertexai. (#375)HARM_CATEGORY_UNSPECIFIED (which the API rejects with 400). Also inherited by genkit_vertexai. (#392)image/png, parse the mime from the data URL, and reject malformed input locally. (#390)Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.15.1...genkit-v0.16.0
Nothing published for this version
Release genkit-v0.16.0-rc.1
Release genkit-v0.16.0-rc.1
fix: normalize nested models to JSON in generated setters by @pavelgj in #337
Full Changelog: genkit-v0.15.0...genkit-v0.15.1
Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.15.0...genkit-v0.15.1
This release introduces Agents : a first-class way to build stateful, multi-turn AI experiences in Dart. Agents wrap generate with durable sessions, t
This release introduces Agents: a first-class way to build stateful, multi-turn AI experiences in Dart. Agents wrap generate with durable sessions, tool calling, human-in-the-loop interrupts, sub-agent delegation, and a transport-agnostic client — so you can go from a one-shot prompt to a full conversational agent (running locally or served over HTTP) with a few lines of code.
Defining an agent is one call. It handles the model, tools, and session state for you:
import 'package:genkit/genkit.dart';
import 'package:genkit/io.dart';
import 'package:genkit_google_genai/genkit_google_genai.dart';
final ai = Genkit(
plugins: [googleAI()],
model: googleAI.gemini('gemini-flash-latest'),
);
final getWeather = ai.defineTool(
name: 'getWeather',
description: 'Get the current weather for a given location.',
inputSchema: GetWeatherInput.$schema,
outputSchema: GetWeatherOutput.$schema,
fn: (input, _) async =>
GetWeatherOutput(weather: 'Sunny in ${input.location}', temperature: '71F'),
);
final weatherAgent = ai.defineAgent(
name: 'weatherAgent',
system: 'You are an assistant helping with weather information. '
'Use the getWeather tool.',
tools: [getWeather],
store: FileSessionStore('.sessions'), // durable, multi-turn state
);Talk to it - streaming, multi-turn, with state carried automatically between turns:
final chat = weatherAgent.chat(sessionId: 'user-123');
// Stream the first turn.
final turn = chat.sendStream(text: 'What is the weather like in Tokyo?');
await for (final chunk in turn.stream) {
stdout.write(chunk.text);
}
// Follow-up turn — prior context is threaded automatically.
final res = await chat.send(text: 'What about Paris?');
print(res.text);Serve it over HTTP with genkit_shelf, and any client (Dart, JS, browser) can
drive it:
router.post('/api/weatherAgent', shelfHandler(weatherAgent.action));// From a Dart CLI or Flutter/web app — no server-side deps required.
import 'package:genkit/client.dart';
final weather = remoteAgent(url: 'http://localhost:8080/api/weatherAgent');
final chat = weather.chat(sessionId: 'user-123');
await for (final chunk in chat.sendStream(text: 'Weather in Tokyo?').stream) {
stdout.write(chunk.text);
}InMemorySessionStore, FileSessionStorepackage:genkit/io.dart), and FirestoreSessionStore (newgenkit_google_cloud package). Load any past turn from a snapshot, or fork asend / sendStream, with session statectx.interrupt(...)) and be resumed/restarted with an approval payload, sostateSchema and mutate structured sessioncustomPatch chunk to the client.agents() middleware auto-injectsdelegate_to_* tools, discovers sub-agent descriptions, and adds guard railsmaxDelegations, historyLength) for orchestrator/worker patterns.definePromptAgent wires a .prompt (dotprompt) filepromptInput.defineCustomAgent for multi-step flows withdetach + status polling + abort for long-runningremoteAgent from package:genkit/client.dartSee the full runnable showcase in testapps/agents - 11 demo pages covering
chat, interrupts, artifacts, background/detach, branching, task state, research,
delegation, and coding agents.
GenkitAI.Full Changelog: genkit-v0.14.1...genkit-v0.15.0
fix(ai): apply input and output schemas when loading .prompt files by @chrisraygill in https://github.com/genkit-ai/genkit-dart/pull/300
Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.14.0...genkit-v0.14.1
The code generator was moved from schemantic package to schemantic_builder. Run: dart pub add dev:schemantic_builder to re-add the builder.
The code generator was moved from schemantic package to schemantic_builder. Run: dart pub add dev:schemantic_builder to re-add the builder.
params not being defined by @kevmoo in https://github.com/genkit-ai/genkit-dart/pull/285allOf case by @pavelgj in https://github.com/genkit-ai/genkit-dart/pull/291system parameter to generate() by @chrisraygill in https://github.com/genkit-ai/genkit-dart/pull/289Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.13.2...genkit-v0.14.0
system parameter to generate() (#289)feat(reflection/v1): add listValues by @MichaelDoyle in https://github.com/genkit-ai/genkit-dart/pull/281
Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.13.1...genkit-v0.13.2
feat: generate docs for generated schemantic types by @pavelgj in https://github.com/genkit-ai/genkit-dart/pull/274
Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.13.0...genkit-v0.13.1
fix: support the latest pkg:analyzer in pkg:schemantic by @kevmoo in https://github.com/genkit-ai/genkit-dart/pull/236
Full Changelog: https://github.com/genkit-ai/genkit-dart/compare/genkit-v0.12.1...genkit-v0.13.0
support middleware and defaultModel in listValues
changed middleware tool hook return type to Part for greater flexibility
Allow asynchronous header generation for remote models
changed tool hook signature on middleware, pass toolRequest to tool
Packages with breaking changes:
remoteModel for defining remote AI models with lite api (#198).Packages with breaking changes:
Packages with other changes:
initial Preview release of Genkit Dart, see READMEs and docs (https://genkit.dev) for details
Packages with breaking changes:
extract function to support primitive JSON types (string and numbers) (#195).Packages with breaking changes:
Packages with other changes:
REFACTOR: Tweak RegExps and avoid non-linear complexity (#175).
final or base (#179).REFACTOR: hide package:json_schema_builder (#167).
REFACTOR: Introduce a dedicated plugin.dart entry point for plugin-related exports (#149).
FIX: prevent incorrect partial JSON repair by validating stack state (#144).
REFACTOR: automate telemetry exporter configuration (#131).
FIX: Wrap error responses in a JSON object under an 'error' key (#130).
Note: This release has breaking changes.
FEAT: introducing registered middleware (#87).
FIX: Coerce num values to double for generated double fields during JSON parsing. (#65).
num values to double for generated double fields during JSON parsing. (#65).generate and generateBidi to accept Tool objects directly in the tools list alongside tool names (#79).maxTurns error handling with a new default. (#75).$GenerateResponse type, refine schema types, and update generated class constructors to use late final and regular constructors. (#66).FEAT: updated AnyOf support for union types in Schemantic, including helper class generation and schema type handling. (#62).
REFACTOR: reimplement schema generation from extension types to classes, enhance PartExtension getters, and simplify GenerateResponse and tool invocat
PartExtension getters, and simplify GenerateResponse and tool invocation. (#53).$schema for unified schema access. (#60).Note: This release has breaking changes.
PartExtension getters, and simplify GenerateResponse and tool invocation. (#53).$schema for unified schema access. (#60).BREAKING REFACTOR: renamed JsonExtensionType to SchemanticType (#44).
Note: This release has breaking changes.
REFACTOR: Consolidate Google GenAI examples into a single file, fixed tools calling, and schema flattening helper (#43).
BREAKING FEAT: Refactor basic types into factory functions to support schema constraints (#34).
Note: This release has breaking changes.
REFACTOR: move the package-specific schema generator into a peer package (#31).
Note: This release has breaking changes.
REFACTOR: make generated JsonExtensionType factory classes (*TypeFactory) private (#29).
FEAT: bump analyzer dependency (#25).
Note: This release has breaking changes.
FIX: register generate action with the correct name.
BREAKING CHANGE: RemoteAction has 2 extra generic type parameters I and Init for the input and init types.
RemoteAction has 2 extra generic type parameters I and Init for the input and init types.Made fromResponse and fromStreamChunk optional in defineRemoteAction. If not provided, the response and stream chunks will be dynamic objects decoded
fromResponse and fromStreamChunk optional in defineRemoteAction. If not provided, the response and stream chunks will be dynamic objects decoded from JSON, instead of requiring a typed conversion function.BREAKING CHANGE: The .stream() method now returns an ActionStream instead of a FlowStreamResponse record. ActionStream is a Stream that provides two w…
BREAKING CHANGE: The .stream() method now returns an ActionStream instead of a FlowStreamResponse record. ActionStream is a Stream that provides two ways to access the flow's final, non-streamed response:
onResult: A Future that completes with the result. This is the recommended approach. It will complete with a GenkitException if the stream terminates with an error or is cancelled.result: A synchronous getter that should only be used after the stream is fully consumed. It will throw a GenkitException if the stream is not consumed, terminates with an error or is cancelled.Migration: Code that previously looked like this:
final (:stream, :response) = myAction.stream(input: ...);
await for (final chunk in stream) {
// ...
}
final finalResult = await response;
Should be updated to use onResult:
final stream = myAction.stream(input: ...);
await for (final chunk in stream) {
// ...
}
final finalResult = await stream.onResult;
// or
final finalResult = stream.result;
BREAKING CHANGE: The package has been renamed from package:genkit/genkit.dart to package:genkit/client.dart. You will need to update your import state…
package:genkit/genkit.dart to package:genkit/client.dart. You will need to update your import statements.response future returned by the .stream() method is now nullable (Future<O?>). This change supports improved error handling and cancellation.stream itself. This allows you to catch exceptions directly within a try/catch block surrounding an await for loop.Added standard Genkit data classes for working with generative models, including GenerateResponse, Message, and Part types.
GenerateResponse, Message, and Part types..text and .media for easier data extraction.- README cleanup
Enhance Genkit Dart client with type safety and converters by @nozomi-koborinai in https://github.com/genkit-ai/genkit-dart/pull/1
Full Changelog: https://github.com/genkit-ai/genkit-dart/commits/v0.5.0
GenkitException with detailed error information and HTTP status codesjson_serializable for object serialization- Initial version.
One column per month.