# Middleware (/examples/agent-os/middleware/overview)



Current v3.0.4 examples:

| Example                                                                                                            | Description                                                                                                                      |
| ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| [Add rate-limit and request-log middleware to AgentOS](/examples/agent-os/customize/custom-middleware)             | Custom Starlette middleware can wrap the FastAPI app returned by `AgentOS.get_app()`.                                            |
| [Observe AgentOS run responses without private response classes](/examples/agent-os/customize/response-middleware) | 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](/examples/agent-os/security/cookie-auth)                             | 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](/examples/agent-os/security/jwt-claims)                     | 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](/examples/agent-os/security/service-accounts)             | Mint an opaque agno\_pat\_ token, use its current default scopes, and revoke it.                                                 |
