Skip to main content
Agents can use middleware to process requests and responses - for logging, validation, or transformation.

Quick Start

1

Simple Usage

2

With Configuration


User Interaction Flow


Configuration Levels


Common Uses


API Reference

HooksConfig

Hooks configuration (middleware pattern)

Best Practices

Each middleware should do one thing well.
Middleware runs in order - put validation first.
Forgetting next() breaks the chain.

Hooks

Lifecycle hooks

Guardrails

Input validation