Optional
afterOptional
beforeOptional
contextOptional
stateOptional
toolsOptional
afterOptional
beforeOptional
modifyRuns before each LLM call, can modify call parameters, changes are not persistent
e.g. if you change model
, it will only be changed for the next model call
Current state (read-only in this phase)
Runtime context and metadata
Modified options or undefined to pass through
Base middleware interface.