Skip to content
Effloow
← Back to article
EFFLOOW LAB LAB-RUN

Genkit Middleware Agentic Pipeline Hardening Poc 2026

Evidence notes document the bounded local or source-based checks behind an Effloow article. They are not product endorsements, legal advice, or benchmark claims.

Date: 2026-06-01
Track: sandbox-poc
Slug: genkit-middleware-agentic-pipeline-hardening-poc-2026
Environment: macOS 15.6, Node.js v25.9.0, npm 11.12.1

Package Verification

npm install @genkit-ai/middleware
  • Package: @genkit-ai/middleware
  • Version: 0.6.0
  • License: Apache-2.0
  • Repository: git+https://github.com/genkit-ai/genkit.git
  • Dependencies: ['mime-types']
  • 471 packages installed in /tmp/effloow-genkit-middleware-poc

API Surface Verified

Ran poc-verify.js loading each middleware module via require():

toolApproval: function
ToolApprovalOptionsSchema shape keys: [ 'approved' ]
ToolApprovalOptionsSchema.shape.approved type: ZodArray

retry: function
RetryOptionsSchema fields: [
  'maxRetries', 'statuses', 'initialDelayMs', 'maxDelayMs', 'backoffFactor'
]

skills: function
filesystem: function
fallback: function

All middleware modules loaded successfully (no API key required)

Source Code Inspection

toolApproval

  • Config schema: { approved: z.array(z.string()) }
  • Behavior: throws ToolInterruptError if tool name not in approved list and metadata.resumed.toolApproved !== true
  • Error message: "Tool not in approved list: {toolName}"
  • Resume mechanism: caller sets resume: { restart: [restartTool(interrupt, { toolApproved: true })] }

retry

  • Config schema: { maxRetries, statuses, initialDelayMs, maxDelayMs, backoffFactor, disableJitter }
  • Defaults: maxRetries=3, statuses=[UNAVAILABLE, DEADLINE_EXCEEDED, RESOURCE_EXHAUSTED, ABORTED, INTERNAL], initialDelayMs=1000, maxDelayMs=60000, backoffFactor=2
  • Note: only the model call is retried; the surrounding tool loop is NOT replayed

filesystem

  • Injects tools: list_files, read_file, write_file, search_and_replace
  • All ops restricted to rootDirectory
  • Write access requires allowWriteAccess: true (default false)

skills

  • Scans directory for SKILL.md files + YAML frontmatter
  • Injects found skills into system prompt
  • Provides use_skill tool for on-demand skill retrieval

fallback

  • Model fallback on API error
  • Configurable fallback chain

Not Tested

  • No LLM API calls (no API key in environment)
  • No hosted Genkit endpoint
  • No live model generation
  • Python support still listed as "coming soon" (TypeScript/Go/Dart available)

Sources

  • Official announcement: developers.googleblog.com/announcing-genkit-middleware-intercept-extend-and-harden-your-agentic-apps/
  • InfoQ coverage: infoq.com/news/2026/05/google-genkit-middleware/
  • DEV Community: dev.to/gde/genkit-middleware-intercept-extend-and-harden-your-gen-ai-pipelines-4k03
  • npm: npmjs.com/package/@genkit-ai/middleware
  • Official docs: genkit.dev/docs/js/middleware/

Read the article

This note supports the public article and records what was actually checked.

Open article →