Home›Gemini / Gemma›Genkit Middlewareを発表、エージェントアプリを保護・拡張
Announcing Genkit Middleware: Intercept, extend, and harden your agentic apps

Genkit Middlewareを発表、エージェントアプリを保護・拡張Announcing Genkit Middleware: Intercept, extend, and harden your agentic apps

元記事を読むRead original articledevelopers.googleblog.com(新しいタブで開きます)(opens in a new tab)
AI 要約AI summary

GoogleはオープンソースAI開発フレームワークGenkitに、モデル呼び出しやフロー実行へロギング・認証・レート制限・安全性チェックを差し込めるMiddleware機構を導入した。横断的関心事を一元化し、エージェント型アプリの堅牢化と運用性向上を実現する。

Google introduced a middleware system in Genkit, its open-source agentic AI framework, letting developers inject logging, auth, rate limiting, and safety checks into model calls and flows for more robust, maintainable apps.

AI 生成の要約と解説(解説は要約と収集メタデータに基づく)で、元記事全文の転載・翻訳ではありません。日本語版と英語版は言語ごとに独立して生成しています。正確性は元記事 (developers.googleblog.com) でご確認ください。AI-generated summary and explainer (the latter based on the summaries and collected metadata), not a copy or translation of the full source article. Generated independently for each language. Verify accuracy at the original source (developers.googleblog.com).

Googleは、オープンソースのフレームワークGenkitにMiddlewareの仕組みを導入した。モデルの呼び出しやフローにロギング、認証、レート制限、安全性チェックといった処理を差し込めるようにするもので、エージェント型アプリの堅牢性と保守性を高めることが狙いとされる。

本番運用の要件

Genkitは、TypeScript、Go、Dart、Pythonに対応し、あらゆるプラットフォーム向けにフルスタックのAI搭載アプリやエージェント型アプリを構築するためのフレームワークである。ただし、本番環境で動かすエージェントアプリやAI機能には、高性能なモデルと丁寧なプロンプトだけでは足りないと説明されている。

たとえば、信頼性を高めるためのリトライやフォールバック、破壊的なツール呼び出しの前に求める人間の承認、あらゆる層にまたがるオブザーバビリティなどが必要になりうる。

Middlewareとは

Genkitはこれらの課題にMiddlewareで対応するとしている。Middlewareは、生成呼び出しに割り込んで独自の振る舞いを差し込める、組み合わせ可能なフックである。割り込みの対象にはツール実行ループも含まれる。ロギングや認証のような横断的な関心事を一箇所にまとめられる点が特徴とされる。

提供状況としては、現時点でTypeScript、Go、Dartで利用でき、Pythonへの対応は近日中とされている。

ツールループ

Middlewareがどこに介入するかを理解するには、Genkitの生成処理の流れを知っておく必要がある。Genkitでは、generate()を呼び出すたびにツールループが回る。まずモデルが出力を生成し、要求されたツールが実行される。その結果は新たなモデル呼び出しへ戻され、モデルが処理を終えるまでこのサイクルが繰り返される。

Middlewareは、この繰り返しの中で動くツール実行も含めて介入できるフックとして位置づけられている。

Google has introduced middleware in Genkit, its open-source framework for building full-stack, AI-powered and agentic applications. The announcement frames the feature around a practical problem: a production-ready agentic app needs more than a capable model and careful prompting.

Genkit Middleware Explained

Genkit is described as a framework for any platform, with support for TypeScript, Go, Dart, and Python. According to the announcement, production use can call for retries and fallbacks for maximum reliability, human approval before destructive tool calls, and observability across every layer. Genkit's answer to these needs is middleware.

The announcement defines middleware as composable hooks that intercept generation calls, including the tool execution loop, and inject custom behaviors. Google's summary of the release lists logging, authentication, rate limiting, and safety checks as examples of what developers can insert into model calls and flows. The stated aim is to make apps more robust and maintainable by centralizing these cross-cutting concerns.

The Tool Loop

The interception point matters because of how generation works in Genkit. Every generate() call runs a tool loop. The model produces output, any requested tools execute, and the results feed back into a new model call. The cycle repeats until the model is done.

Because middleware can intercept generation calls and the tool execution loop itself, custom behavior can apply to this repeating cycle rather than only to a single request. That is the layer where something like approval before a destructive tool call would take effect, according to the examples the announcement gives.

Available Today

The middleware system is available today in TypeScript, Go, and Dart. Python support is listed as coming soon, so developers working in Python cannot use it yet.

The announcement does not describe the API surface in the material provided here, so the details of how hooks are written and composed are best confirmed in Genkit's own documentation. What the announcement does establish is the core idea: reliability, safety, and visibility concerns are added as composable pieces around generation calls instead of being built into each application's own logic.

ポコとTECHガイドPoko & TECH Guide

ポコと当サイトのTECHガイドが、記事の要約と収集した情報から読みどころを語るAI生成の対話です。Poko and TECH Dashboard's own TECH Guide discuss the article's highlights in an AI-generated conversation based on its summary and collected source details.

  1. ポコPokoミドルウェアって、Genkitの中で何をするものなの?What does middleware actually do inside Genkit?
  2. TECHガイドTECH Guideモデルを呼ぶ処理に割り込んで、独自の動きを差し込める部品だよ。ツールを実行するループも対象なんだ。It's a hook that steps into generation calls and lets you add custom behavior. This even covers the tool execution loop.
  3. ポコPokoじゃあ、リトライや人の承認みたいなものを、あとから足せるってこと?So you could add things like retries or human approval later on, right?
  4. TECHガイドTECH Guideそうだね。この記事では、リトライやフォールバック、破壊的なツール呼び出し前の人の承認、各層の可観測性が例に挙がっているよ。Right. The article lists retries and fallbacks, human approval before destructive tool calls, and observability across every layer as examples.
  5. ポコPoko本番で使うアプリを、安心して動かすための仕組みなんだね。So it's a way to run production apps with more confidence.
  6. TECHガイドTECH Guideうん。ただ今は TypeScript、Go、Dart で使えて、Python は近日対応予定だよ。Yes. For now it's available in TypeScript, Go, and Dart, with Python coming soon.
記事情報・収集記録Article details & collection record
出典Source
Google Developers Blog公式Official
公開日時 (JST)Published (JST)
収集日時 (JST)Collected (JST)
配信形式Format
ブログBlog
原文言語Source language
英語English
重要度の位置づけImportance in this lane
MediumMedium priority(Gemini / Gemma 151件中、同等以上 151件)(151 of 151 Gemini / Gemma entries are equal or higher)
出典の平均重要度(掲載直近 30 件・最大 30 件)Source average (last 30 listed, up to 30)
2.2 / 31=情報 · 2=中 · 3=高1=Info · 2=Medium · 3=High
情報の寿命Half-life
短命 (ニュース)Short-lived (news)

✨Gemini / Gemma の他の記事More from Gemini / Gemmaもっと見る →View more →

ページ上部へScroll to top