> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Middleware

> AgentOS middleware examples for authentication, request context, rate limiting, and custom request handling.

Current v3.0.4 examples:

| Example | Description |
| - | - |
| [Add rate-limit and request-log middleware to AgentOS](https://agno-v2.mintlify.site/examples/agent-os/customize/custom-middleware.md) | Custom Starlette middleware can wrap the FastAPI app returned by `AgentOS.get_app()`. |
| [Observe AgentOS run responses without private response classes](https://agno-v2.mintlify.site/examples/agent-os/customize/response-middleware.md) | This middleware captures non-streaming JSON bodies and streaming SSE content for `POST .../runs` requests carrying `X-APP-UUID`. |
| [JWT authentication from an HTTP-only cookie](https://agno-v2.mintlify.site/examples/agent-os/security/cookie-auth.md) | Mount login/logout routes on the base FastAPI app, read JWTs from a secure cookie, and enforce AgentOS scopes normally. |
| [JWT claims into request state and agent dependencies](https://agno-v2.mintlify.site/examples/agent-os/security/jwt-claims.md) | Extract trusted claims into request.state, session state, and the dependencies carried by the RunContext passed to agent tools. |
| [Service accounts for machine-to-machine authentication](https://agno-v2.mintlify.site/examples/agent-os/security/service-accounts.md) | Mint an opaque agno\_pat\_ token, use its current default scopes, and revoke it. |


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