Skip to main content
niadraMiddleware(session) is a model middleware for Genkit’s generate({ use }) (Firebase Genkit for JavaScript), and niadraTools(session) returns the kit as Genkit tools. TypeScript only.

Install

The integration ships with @niadra/sdk 0.3.0, ready on main and on npm when it is published; until then the npm package is 0.1.1.

The five primitives

Minimal example

Agent memory

niadraMiddleware(convo, { agentMemory: true }) and niadraTools(convo, { agentMemory: true }) put the agent’s own notes before the customer’s context and add the two tools. See Agent memory.

Limits

  • The middleware takes a conversation, a task or a function that finds the one each call belongs to; when it returns null, the call passes through untouched.
  • Without model in the options, the agent’s turn is recorded without usage.
  • Nothing here stops the call: with Niadra slow or down, the request goes to the model as it came.
  • Tested against genkit 1.42.0 with Genkit’s own test model, tool loop included, and Niadra on the emulator.

Next steps

Google GenAI

the client wrapper, for calling Gemini without Genkit.

History navigation

the three tools the agent receives.