Google ने इस हफ़्ते Genkit में middleware layer add किया — तीन programmable hook points (generation calls, model calls, tool execution) जहाँ cross-cutting concerns application logic को छुए बिना agent loop में plug हो जाते हैं। Shape उन्हें familiar लगेगा जिन्होंने Express या Connect middleware लिखा हो: components defined execution order में stack होते हैं, हर एक request को देखता है, उसे mutate या short-circuit कर सकता है, फिर control chain में आगे pass कर देता है। Release में prebuilt middleware ship हुए: retry handling with exponential backoff, automatic model fallbacks, sensitive tool calls के लिए approval gates, filesystem access controls, और dynamic instruction injection के लिए एक "skills" system। Genkit खुद TypeScript, Go और Dart support करता है, Python जल्द आ रहा है।
Interception model इसलिए matter करता है क्योंकि यह कुछ ऐसा standardise करता है जो ज़्यादातर agent shops हाथ से बना रहे थे। Model output generate करता है, tools execute करता है, results process करता है, completion तक continue करता है — वही loop है, और middleware हर stage पर hook कर सकता है। Model-call layer पर retry-with-backoff मतलब transient API failures agent run को blow up नहीं करते। Model fallback मतलब primary-API rate-limit hit होने पर एक degraded-but-functional backup model पर जाता है बिना orchestration glue के। Tool-execution layer पर approval gates मतलब agent के `delete_database` call या funds transfer करने से पहले human paged होता है — वो safety primitive जो builders custom dispatchers में ad-hoc लिख रहे थे। FS access controls files छूने वाले tools के blast radius को bound करते हैं। और skills system तुम्हें per invocation context-dependent instructions inject करने देता है prompt template rebuild किए बिना।
Ecosystem read: यह Google की agent strategy का application-layer side है। Release में Google engineer Michael Doyle ने कहा: Genkit "application-layer AI feature integration" target करता है, जबकि Agent Development Kit (ADK) "complex, standalone, multi-agent systems" को dedicated infrastructure पर target करता है। यह split standard SDK-vs-platform सवाल पर land करता है — Genkit use करो जब तुम existing app के अंदर AI features add कर रहे हो, ADK use करो जब तुम agent platform build कर रहे हो। Middleware composability ही वो है जो Genkit को first case के लिए काम कराती है: retries, fallbacks, approval gates और observability hooks वो cross-cutting concerns हैं जो हर production agent को परेशान करते हैं, और उन्हें hookable layer में push करना सही architectural call है। LangChain callbacks, OpenAI Agents SDK hooks और Anthropic SDK middleware के साथ comparison exercise के तौर पर छोड़ दिया गया — InfoQ piece यह head-to-heads नहीं करता।
Monday सुबह: अगर तुम Genkit चला रहे हो, evaluate करो prebuilt middleware components में से कौनसे तुम ख़ुद लिख रहे थे। Sensitive tool calls के लिए approval gates ख़ास तौर पर — अगर तुम्हारे agent के पास कोई ऐसा tool है जो real money cost कर सकता है, message भेज सकता है, या shared state modify कर सकता है, gate plug करो। Developer UI middleware execution trace करती है और stack interactions debug करने देती है, जो matter करता है क्योंकि order-of-execution bugs से middleware stacks break होते हैं। अगर तुम Genkit पर नहीं बल्कि LangChain या custom harness पर हो, three-hook-point taxonomy (generation / model / tool) portable design vocabulary है — तुम्हारे callbacks या interceptors को explicitly उन तीन layers पर hit करना चाहिए, और tool layer पर approval gates production safety के लिए सबसे underrated primitive है।
