ai-core/middleware - Manage chat lifecycle with middleware hooks
Provides middleware hooks for chat configuration, streaming, tool calls, usage, completion, abortion, and errors.
Tags
Updated: 2026-11-26Capabilities
Typical Inputs
Typical Outputs
What this skill does
- Configure chat middleware
- Observe lifecycle events
- Transform streamed chunks
- Control tool calls
- Track usage events
- Handle terminal states
- Modify model configuration
Inputs
- Chat configuration
- Middleware hook implementations
- Model adapter
- Chat messages
- Tool calls
- Output schema
Outputs
- Streamed chat chunks
- Analytics events
- Log entries
- Trace events
- Tool call decisions
- Modified chat configuration
- Completion state
- Abort state
- Error state
Requirements
- TanStack AI 0.42.0
- ai-core skill
- Middleware support in chat()
