> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xpertai.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Built-in Middleware

Built-in middleware for common proxy use cases

XpertAI provides built-in middleware for common use cases. Each middleware is production-tested and can be configured according to your specific needs.

## Model Provider Agnostic Middleware

The following middleware works with any LLM provider:

| Middleware | Description |
| - | - |
| [Context Compression](#context-compression) | Automatically summarizes conversation history when approaching session limit. |
| [Browser Automation Middleware](https://docs.xpertai.cn/en/ai/agent/middleware/built-in/browser-automation.md) | Lets ChatKit clients execute safe browser-page actions such as snapshot, click, fill, scroll, screenshot, and wait. |
| [Ralph Loop Middleware](https://docs.xpertai.cn/en/ai/agent/middleware/built-in/ralph-loop.md) | Retries an agent from a clean message context until it emits the completion promise or reaches the retry limit. |
| [Human-in-the-Loop Middleware](https://docs.xpertai.cn/en/ai/agent/middleware/built-in/human-in-the-loop.md) | Pauses configured tool calls for human approval, editing, or rejection before execution. |
| [Sensitive Filter Middleware](https://docs.xpertai.cn/en/ai/agent/middleware/built-in/sensitive-filter.md) | Filters sensitive input/output content using rule-based or LLM policies. |
| [Agent Behavior Monitor Middleware](https://docs.xpertai.cn/en/ai/agent/middleware/built-in/agent-behavior-monitor.md) | Detects prompt injection, risky instructions, high-frequency tool calls, and repeated failures. |

### Context Compression

Automatically summarizes conversation history when approaching token limits, preserving recent messages while compressing older context. The summarization feature is suitable for the following scenarios:

* Long conversations that exceed the context window.
* Multi-turn dialogues with extensive history.
* Applications that need to retain full conversation context.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.