Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Class References
Function References
Interface References
Type Alias References
Variable References

ChatMiddlewarePhase

Type Alias: ChatMiddlewarePhase

ts
type ChatMiddlewarePhase = "init" | "beforeModel" | "modelStream" | "beforeTools" | "afterTools";
type ChatMiddlewarePhase = "init" | "beforeModel" | "modelStream" | "beforeTools" | "afterTools";

Defined in: packages/typescript/ai/src/activities/chat/middleware/types.ts:15

Phase of the chat middleware lifecycle.

  • 'init': Initial config transform before the chat engine starts
  • 'beforeModel': Before each adapter chatStream call (per agent iteration)
  • 'modelStream': During model streaming
  • 'beforeTools': Before tool execution phase
  • 'afterTools': After tool execution phase