{"owner":"sparckles","repo":"Robyn","hasSkills":true,"totalSkillsCount":1,"totalTokensCount":1975,"categories":["root-instruction"],"hasMcp":false,"mcpConfig":null,"found":["llms.txt"],"skills":{"llms.txt":"# Robyn\n\n> Robyn is a high-performance, community-driven, and innovator-friendly async web framework for Python with a Rust runtime. It combines Python's ease of use with Rust's performance.\n\n## Quick Facts\n\n- Version: 0.79.0\n- Python: >= 3.10\n- License: BSD 2.0\n- Repository: https://github.com/sparckles/robyn\n- Documentation: https://robyn.tech/documentation\n- Discord: https://discord.gg/rkERZ5eNU8\n\n## Installation\n\n```bash\npip install robyn\n```\n\n## Basic Usage\n\n```python\nfrom robyn import Robyn\n\napp = Robyn(__file__)\n\n@app.get(\"/\")\nasync def index(request):\n    return \"Hello, World!\"\n\napp.start(port=8080)\n```\n\n## Key Features\n\n- **Rust Runtime**: Core server written in Rust using actix-web for high performance\n- **Async/Sync Support**: Both async and sync route handlers supported\n- **Multi-Process Scaling**: Built-in multiprocess execution via `--processes` and `--workers`\n- **WebSockets**: Native WebSocket support\n- **Middlewares**: Before/after request middlewares\n- **Dependency Injection**: Built-in DI system\n- **OpenAPI/Swagger**: Automatic OpenAPI documentation generation\n- **Hot Reloading**: Development mode with `--dev` flag\n- **AI Agents**: Built-in AI agent routing via `robyn.ai`\n- **MCP Support**: Model Context Protocol server capabilities via `app.mcp`\n- **Templating**: Jinja2 templating support (optional)\n- **CORS**: Built-in CORS helper via `ALLOW_CORS()`\n- **Authentication**: AuthenticationHandler base class for custom auth\n- **Static Files**: Directory serving via `app.serve_directory()`\n- **SSE**: Server-Sent Events support via `SSEResponse`\n- **Easy Access Parameters**: Typed path/query params with automatic coercion in handler signatures\n- **Direct Rust Integration**: Embed Rust code directly in routes\n\n## Project Structure\n\n```\nrobyn/\n├── src/                    # Rust source code\n│   ├── lib.rs              # PyO3 module entry point\n│   ├── server.rs           # Main HTTP server implementation\n│   ├── types/              # Request, Response, Headers, Cookie types\n│   ├── routers/            # HTTP, WebSocket, middleware routers\n│   ├── executors/          # Route execution handlers\n│   └── websockets/         # WebSocket implementation\n├── robyn/                  # Python package\n│   ├── __init__.py         # Main Robyn and SubRouter classes\n│   ├── router.py           # Python router implementation\n│   ├── authentication.py   # AuthenticationHandler\n│   ├── dependency_injection.py\n│   ├── openapi.py          # OpenAPI generation\n│   ├── mcp.py              # MCP protocol support\n│   ├── ai.py               # AI agent support\n│   ├── responses.py        # Response helpers (serve_file, html, SSE)\n│   ├── ws.py               # WebSocket class\n│   └── robyn.pyi           # Type stubs\n├── integration_tests/      # Integration test suite\n├── unit_tests/             # Unit test suite\n├── docs_src/               # Documentation (Next.js)\n├── granian/                # Bundled Granian server (fork)\n└── examples/               # Example applications\n```\n\n## Core Classes\n\n### Robyn / SubRouter\nMain application class and sub-router for modular routes.\n\n```python\nfrom robyn import Robyn, SubRouter\n\napp = Robyn(__file__)\napi = SubRouter(__file__, prefix=\"/api\")\n\n@api.get(\"/users\")\ndef get_users(request):\n    return {\"users\": []}\n\napp.include_router(api)\n```\n\n### Request Object\n```python\nrequest.method      # HTTP method\nrequest.url         # Url object (scheme, host, path)\nrequest.headers     # Headers dict-like\nrequest.query_params # QueryParams\nrequest.path_params  # Dict of URL params\nrequest.body        # Raw bytes\nrequest.json()      # Parse JSON body\nrequest.form_data   # Multipart form data\nrequest.ip_addr     # Client IP\nrequest.identity    # Identity (if authenticated)\n```\n\n### Response Object\n```python\nfrom robyn import Response\n\nResponse(\n    status_code=200,\n    headers={\"Content-Type\": \"application/json\"},\n    description=\"body content\"  # or body bytes\n)\n```\n\n### Decorators\n```python\n@app.get(\"/path\")\n@app.post(\"/path\")\n@app.put(\"/path\")\n@app.delete(\"/path\")\n@app.patch(\"/path\")\n@app.head(\"/path\")\n@app.options(\"/path\")\n\n@app.before_request(\"/path\")  # Middleware before\n@app.after_request(\"/path\")   # Middleware after\n\n@app.startup_handler         # Server startup\n@app.shutdown_handler        # Server shutdown\n```\n\n### WebSockets\n```python\nfrom robyn import WebSocketDisconnect\n\n@app.websocket(\"/ws\")\nasync def handler(websocket):\n    try:\n        while True:\n            msg = await websocket.receive_text()\n            await websocket.send_text(f\"Echo: {msg}\")\n    except WebSocketDisconnect:\n        pass\n\n@handler.on_connect\ndef on_connect(websocket):\n    return \"Connected\"\n\n@handler.on_close\ndef on_close(websocket):\n    return \"Closed\"\n```\n\n### Easy Access Parameters\nDeclare typed path and query parameters directly in handler signatures. Works for both HTTP and WebSocket handlers.\n\n```python\nfrom typing import List, Optional\n\n# HTTP: path params + query params with type coercion\n@app.get(\"/items/:id\")\nasync def get_item(id: int, q: str, page: int = 1):\n    return {\"id\": id, \"q\": q, \"page\": page}\n\n# Optional, List, and bool params\n@app.get(\"/search\")\ndef search(name: str, tags: List[str], active: bool = False, age: Optional[int] = None):\n    return {\"name\": name, \"tags\": tags, \"active\": active, \"age\": age}\n\n# WebSocket: typed query params on handler and callbacks\n@app.websocket(\"/ws\")\nasync def handler(websocket, room: str = \"default\", page: int = 1):\n    while True:\n        msg = await websocket.receive_text()\n        await websocket.send_text(f\"room={room} page={page} msg={msg}\")\n\n@handler.on_connect\ndef on_connect(websocket, room: str = \"default\"):\n    return f\"connected to {room}\"\n```\n\n### MCP (Model Context Protocol)\n```python\n@app.mcp.resource(\"time://current\")\ndef get_time():\n    return datetime.now().isoformat()\n\n@app.mcp.tool(name=\"calc\", description=\"Calculate\", input_schema={...})\ndef calculate(args):\n    return eval(args[\"expression\"])\n\n@app.mcp.prompt(name=\"explain\", description=\"Explain code\", arguments=[...])\ndef explain_prompt(args):\n    return f\"Please explain: {args['code']}\"\n```\n\n## CLI Commands\n\n```bash\npython app.py                     # Start server\npython app.py --dev               # Development mode (hot reload)\npython app.py --processes 4       # Multi-process\npython app.py --workers 2         # Workers per process\npython app.py --log-level DEBUG   # Log level\npython app.py --open-browser      # Open browser on start\npython app.py --create            # Create new project scaffold\npython app.py --docs              # Open documentation\n```\n\n## Development Setup\n\n```bash\n# Clone\ngit clone https://github.com/sparckles/robyn.git\ncd robyn\n\n# Virtual environment\npython3 -m venv .venv && source .venv/bin/activate\n\n# Install tools\npip install pre-commit poetry maturin\n\n# Install dependencies\npoetry install --with dev --with test\n\n# Build Rust extension\nmaturin develop\n\n# Run tests\npytest\n```\n\n## Key Dependencies\n\n- **PyO3**: Rust-Python bindings\n- **actix-web**: Rust HTTP server (via cookie crate)\n- **orjson**: Fast JSON serialization\n- **multiprocess**: Multi-process support\n- **uvloop**: Fast event loop (non-Windows)\n- **watchdog**: File watching for hot reload\n\n## Configuration\n\nEnvironment variables:\n- `ROBYN_HOST`: Server host (default: 127.0.0.1)\n- `ROBYN_PORT`: Server port (default: 8080)\n- `ROBYN_DEV_MODE`: Enable dev mode\n- `ROBYN_BROWSER_OPEN`: Open browser on start\n- `ROBYN_CLIENT_TIMEOUT`: Client timeout seconds\n- `ROBYN_KEEP_ALIVE_TIMEOUT`: Keep-alive timeout\n\n## Documentation Structure\n\nMain docs at `docs_src/src/pages/documentation/`:\n- `api_reference/getting_started.mdx` - Quick start guide\n- `api_reference/request_object.mdx` - Request handling\n- `api_reference/middlewares.mdx` - Middleware usage\n- `api_reference/websockets.mdx` - WebSocket guide\n- `api_reference/authentication.mdx` - Auth patterns\n- `api_reference/openapi.mdx` - OpenAPI docs\n- `api_reference/agents.mdx` - AI agent integration\n- `api_reference/mcps.mdx` - MCP server guide\n- `example_app/` - Full example application tutorial\n"},"files":{"llms.txt":"# Robyn\n\n> Robyn is a high-performance, community-driven, and innovator-friendly async web framework for Python with a Rust runtime. It combines Python's ease of use with Rust's performance.\n\n## Quick Facts\n\n- Version: 0.79.0\n- Python: >= 3.10\n- License: BSD 2.0\n- Repository: https://github.com/sparckles/robyn\n- Documentation: https://robyn.tech/documentation\n- Discord: https://discord.gg/rkERZ5eNU8\n\n## Installation\n\n```bash\npip install robyn\n```\n\n## Basic Usage\n\n```python\nfrom robyn import Robyn\n\napp = Robyn(__file__)\n\n@app.get(\"/\")\nasync def index(request):\n    return \"Hello, World!\"\n\napp.start(port=8080)\n```\n\n## Key Features\n\n- **Rust Runtime**: Core server written in Rust using actix-web for high performance\n- **Async/Sync Support**: Both async and sync route handlers supported\n- **Multi-Process Scaling**: Built-in multiprocess execution via `--processes` and `--workers`\n- **WebSockets**: Native WebSocket support\n- **Middlewares**: Before/after request middlewares\n- **Dependency Injection**: Built-in DI system\n- **OpenAPI/Swagger**: Automatic OpenAPI documentation generation\n- **Hot Reloading**: Development mode with `--dev` flag\n- **AI Agents**: Built-in AI agent routing via `robyn.ai`\n- **MCP Support**: Model Context Protocol server capabilities via `app.mcp`\n- **Templating**: Jinja2 templating support (optional)\n- **CORS**: Built-in CORS helper via `ALLOW_CORS()`\n- **Authentication**: AuthenticationHandler base class for custom auth\n- **Static Files**: Directory serving via `app.serve_directory()`\n- **SSE**: Server-Sent Events support via `SSEResponse`\n- **Easy Access Parameters**: Typed path/query params with automatic coercion in handler signatures\n- **Direct Rust Integration**: Embed Rust code directly in routes\n\n## Project Structure\n\n```\nrobyn/\n├── src/                    # Rust source code\n│   ├── lib.rs              # PyO3 module entry point\n│   ├── server.rs           # Main HTTP server implementation\n│   ├── types/              # Request, Response, Headers, Cookie types\n│   ├── routers/            # HTTP, WebSocket, middleware routers\n│   ├── executors/          # Route execution handlers\n│   └── websockets/         # WebSocket implementation\n├── robyn/                  # Python package\n│   ├── __init__.py         # Main Robyn and SubRouter classes\n│   ├── router.py           # Python router implementation\n│   ├── authentication.py   # AuthenticationHandler\n│   ├── dependency_injection.py\n│   ├── openapi.py          # OpenAPI generation\n│   ├── mcp.py              # MCP protocol support\n│   ├── ai.py               # AI agent support\n│   ├── responses.py        # Response helpers (serve_file, html, SSE)\n│   ├── ws.py               # WebSocket class\n│   └── robyn.pyi           # Type stubs\n├── integration_tests/      # Integration test suite\n├── unit_tests/             # Unit test suite\n├── docs_src/               # Documentation (Next.js)\n├── granian/                # Bundled Granian server (fork)\n└── examples/               # Example applications\n```\n\n## Core Classes\n\n### Robyn / SubRouter\nMain application class and sub-router for modular routes.\n\n```python\nfrom robyn import Robyn, SubRouter\n\napp = Robyn(__file__)\napi = SubRouter(__file__, prefix=\"/api\")\n\n@api.get(\"/users\")\ndef get_users(request):\n    return {\"users\": []}\n\napp.include_router(api)\n```\n\n### Request Object\n```python\nrequest.method      # HTTP method\nrequest.url         # Url object (scheme, host, path)\nrequest.headers     # Headers dict-like\nrequest.query_params # QueryParams\nrequest.path_params  # Dict of URL params\nrequest.body        # Raw bytes\nrequest.json()      # Parse JSON body\nrequest.form_data   # Multipart form data\nrequest.ip_addr     # Client IP\nrequest.identity    # Identity (if authenticated)\n```\n\n### Response Object\n```python\nfrom robyn import Response\n\nResponse(\n    status_code=200,\n    headers={\"Content-Type\": \"application/json\"},\n    description=\"body content\"  # or body bytes\n)\n```\n\n### Decorators\n```python\n@app.get(\"/path\")\n@app.post(\"/path\")\n@app.put(\"/path\")\n@app.delete(\"/path\")\n@app.patch(\"/path\")\n@app.head(\"/path\")\n@app.options(\"/path\")\n\n@app.before_request(\"/path\")  # Middleware before\n@app.after_request(\"/path\")   # Middleware after\n\n@app.startup_handler         # Server startup\n@app.shutdown_handler        # Server shutdown\n```\n\n### WebSockets\n```python\nfrom robyn import WebSocketDisconnect\n\n@app.websocket(\"/ws\")\nasync def handler(websocket):\n    try:\n        while True:\n            msg = await websocket.receive_text()\n            await websocket.send_text(f\"Echo: {msg}\")\n    except WebSocketDisconnect:\n        pass\n\n@handler.on_connect\ndef on_connect(websocket):\n    return \"Connected\"\n\n@handler.on_close\ndef on_close(websocket):\n    return \"Closed\"\n```\n\n### Easy Access Parameters\nDeclare typed path and query parameters directly in handler signatures. Works for both HTTP and WebSocket handlers.\n\n```python\nfrom typing import List, Optional\n\n# HTTP: path params + query params with type coercion\n@app.get(\"/items/:id\")\nasync def get_item(id: int, q: str, page: int = 1):\n    return {\"id\": id, \"q\": q, \"page\": page}\n\n# Optional, List, and bool params\n@app.get(\"/search\")\ndef search(name: str, tags: List[str], active: bool = False, age: Optional[int] = None):\n    return {\"name\": name, \"tags\": tags, \"active\": active, \"age\": age}\n\n# WebSocket: typed query params on handler and callbacks\n@app.websocket(\"/ws\")\nasync def handler(websocket, room: str = \"default\", page: int = 1):\n    while True:\n        msg = await websocket.receive_text()\n        await websocket.send_text(f\"room={room} page={page} msg={msg}\")\n\n@handler.on_connect\ndef on_connect(websocket, room: str = \"default\"):\n    return f\"connected to {room}\"\n```\n\n### MCP (Model Context Protocol)\n```python\n@app.mcp.resource(\"time://current\")\ndef get_time():\n    return datetime.now().isoformat()\n\n@app.mcp.tool(name=\"calc\", description=\"Calculate\", input_schema={...})\ndef calculate(args):\n    return eval(args[\"expression\"])\n\n@app.mcp.prompt(name=\"explain\", description=\"Explain code\", arguments=[...])\ndef explain_prompt(args):\n    return f\"Please explain: {args['code']}\"\n```\n\n## CLI Commands\n\n```bash\npython app.py                     # Start server\npython app.py --dev               # Development mode (hot reload)\npython app.py --processes 4       # Multi-process\npython app.py --workers 2         # Workers per process\npython app.py --log-level DEBUG   # Log level\npython app.py --open-browser      # Open browser on start\npython app.py --create            # Create new project scaffold\npython app.py --docs              # Open documentation\n```\n\n## Development Setup\n\n```bash\n# Clone\ngit clone https://github.com/sparckles/robyn.git\ncd robyn\n\n# Virtual environment\npython3 -m venv .venv && source .venv/bin/activate\n\n# Install tools\npip install pre-commit poetry maturin\n\n# Install dependencies\npoetry install --with dev --with test\n\n# Build Rust extension\nmaturin develop\n\n# Run tests\npytest\n```\n\n## Key Dependencies\n\n- **PyO3**: Rust-Python bindings\n- **actix-web**: Rust HTTP server (via cookie crate)\n- **orjson**: Fast JSON serialization\n- **multiprocess**: Multi-process support\n- **uvloop**: Fast event loop (non-Windows)\n- **watchdog**: File watching for hot reload\n\n## Configuration\n\nEnvironment variables:\n- `ROBYN_HOST`: Server host (default: 127.0.0.1)\n- `ROBYN_PORT`: Server port (default: 8080)\n- `ROBYN_DEV_MODE`: Enable dev mode\n- `ROBYN_BROWSER_OPEN`: Open browser on start\n- `ROBYN_CLIENT_TIMEOUT`: Client timeout seconds\n- `ROBYN_KEEP_ALIVE_TIMEOUT`: Keep-alive timeout\n\n## Documentation Structure\n\nMain docs at `docs_src/src/pages/documentation/`:\n- `api_reference/getting_started.mdx` - Quick start guide\n- `api_reference/request_object.mdx` - Request handling\n- `api_reference/middlewares.mdx` - Middleware usage\n- `api_reference/websockets.mdx` - WebSocket guide\n- `api_reference/authentication.mdx` - Auth patterns\n- `api_reference/openapi.mdx` - OpenAPI docs\n- `api_reference/agents.mdx` - AI agent integration\n- `api_reference/mcps.mdx` - MCP server guide\n- `example_app/` - Full example application tutorial\n"},"items":[{"name":"llms.txt","path":"llms.txt","rawUrl":"https://raw.githubusercontent.com/sparckles/Robyn/HEAD/llms.txt","title":"LLM Index & Context Digest","category":"root-instruction","format":"text","content":"# Robyn\n\n> Robyn is a high-performance, community-driven, and innovator-friendly async web framework for Python with a Rust runtime. It combines Python's ease of use with Rust's performance.\n\n## Quick Facts\n\n- Version: 0.79.0\n- Python: >= 3.10\n- License: BSD 2.0\n- Repository: https://github.com/sparckles/robyn\n- Documentation: https://robyn.tech/documentation\n- Discord: https://discord.gg/rkERZ5eNU8\n\n## Installation\n\n```bash\npip install robyn\n```\n\n## Basic Usage\n\n```python\nfrom robyn import Robyn\n\napp = Robyn(__file__)\n\n@app.get(\"/\")\nasync def index(request):\n    return \"Hello, World!\"\n\napp.start(port=8080)\n```\n\n## Key Features\n\n- **Rust Runtime**: Core server written in Rust using actix-web for high performance\n- **Async/Sync Support**: Both async and sync route handlers supported\n- **Multi-Process Scaling**: Built-in multiprocess execution via `--processes` and `--workers`\n- **WebSockets**: Native WebSocket support\n- **Middlewares**: Before/after request middlewares\n- **Dependency Injection**: Built-in DI system\n- **OpenAPI/Swagger**: Automatic OpenAPI documentation generation\n- **Hot Reloading**: Development mode with `--dev` flag\n- **AI Agents**: Built-in AI agent routing via `robyn.ai`\n- **MCP Support**: Model Context Protocol server capabilities via `app.mcp`\n- **Templating**: Jinja2 templating support (optional)\n- **CORS**: Built-in CORS helper via `ALLOW_CORS()`\n- **Authentication**: AuthenticationHandler base class for custom auth\n- **Static Files**: Directory serving via `app.serve_directory()`\n- **SSE**: Server-Sent Events support via `SSEResponse`\n- **Easy Access Parameters**: Typed path/query params with automatic coercion in handler signatures\n- **Direct Rust Integration**: Embed Rust code directly in routes\n\n## Project Structure\n\n```\nrobyn/\n├── src/                    # Rust source code\n│   ├── lib.rs              # PyO3 module entry point\n│   ├── server.rs           # Main HTTP server implementation\n│   ├── types/              # Request, Response, Headers, Cookie types\n│   ├── routers/            # HTTP, WebSocket, middleware routers\n│   ├── executors/          # Route execution handlers\n│   └── websockets/         # WebSocket implementation\n├── robyn/                  # Python package\n│   ├── __init__.py         # Main Robyn and SubRouter classes\n│   ├── router.py           # Python router implementation\n│   ├── authentication.py   # AuthenticationHandler\n│   ├── dependency_injection.py\n│   ├── openapi.py          # OpenAPI generation\n│   ├── mcp.py              # MCP protocol support\n│   ├── ai.py               # AI agent support\n│   ├── responses.py        # Response helpers (serve_file, html, SSE)\n│   ├── ws.py               # WebSocket class\n│   └── robyn.pyi           # Type stubs\n├── integration_tests/      # Integration test suite\n├── unit_tests/             # Unit test suite\n├── docs_src/               # Documentation (Next.js)\n├── granian/                # Bundled Granian server (fork)\n└── examples/               # Example applications\n```\n\n## Core Classes\n\n### Robyn / SubRouter\nMain application class and sub-router for modular routes.\n\n```python\nfrom robyn import Robyn, SubRouter\n\napp = Robyn(__file__)\napi = SubRouter(__file__, prefix=\"/api\")\n\n@api.get(\"/users\")\ndef get_users(request):\n    return {\"users\": []}\n\napp.include_router(api)\n```\n\n### Request Object\n```python\nrequest.method      # HTTP method\nrequest.url         # Url object (scheme, host, path)\nrequest.headers     # Headers dict-like\nrequest.query_params # QueryParams\nrequest.path_params  # Dict of URL params\nrequest.body        # Raw bytes\nrequest.json()      # Parse JSON body\nrequest.form_data   # Multipart form data\nrequest.ip_addr     # Client IP\nrequest.identity    # Identity (if authenticated)\n```\n\n### Response Object\n```python\nfrom robyn import Response\n\nResponse(\n    status_code=200,\n    headers={\"Content-Type\": \"application/json\"},\n    description=\"body content\"  # or body bytes\n)\n```\n\n### Decorators\n```python\n@app.get(\"/path\")\n@app.post(\"/path\")\n@app.put(\"/path\")\n@app.delete(\"/path\")\n@app.patch(\"/path\")\n@app.head(\"/path\")\n@app.options(\"/path\")\n\n@app.before_request(\"/path\")  # Middleware before\n@app.after_request(\"/path\")   # Middleware after\n\n@app.startup_handler         # Server startup\n@app.shutdown_handler        # Server shutdown\n```\n\n### WebSockets\n```python\nfrom robyn import WebSocketDisconnect\n\n@app.websocket(\"/ws\")\nasync def handler(websocket):\n    try:\n        while True:\n            msg = await websocket.receive_text()\n            await websocket.send_text(f\"Echo: {msg}\")\n    except WebSocketDisconnect:\n        pass\n\n@handler.on_connect\ndef on_connect(websocket):\n    return \"Connected\"\n\n@handler.on_close\ndef on_close(websocket):\n    return \"Closed\"\n```\n\n### Easy Access Parameters\nDeclare typed path and query parameters directly in handler signatures. Works for both HTTP and WebSocket handlers.\n\n```python\nfrom typing import List, Optional\n\n# HTTP: path params + query params with type coercion\n@app.get(\"/items/:id\")\nasync def get_item(id: int, q: str, page: int = 1):\n    return {\"id\": id, \"q\": q, \"page\": page}\n\n# Optional, List, and bool params\n@app.get(\"/search\")\ndef search(name: str, tags: List[str], active: bool = False, age: Optional[int] = None):\n    return {\"name\": name, \"tags\": tags, \"active\": active, \"age\": age}\n\n# WebSocket: typed query params on handler and callbacks\n@app.websocket(\"/ws\")\nasync def handler(websocket, room: str = \"default\", page: int = 1):\n    while True:\n        msg = await websocket.receive_text()\n        await websocket.send_text(f\"room={room} page={page} msg={msg}\")\n\n@handler.on_connect\ndef on_connect(websocket, room: str = \"default\"):\n    return f\"connected to {room}\"\n```\n\n### MCP (Model Context Protocol)\n```python\n@app.mcp.resource(\"time://current\")\ndef get_time():\n    return datetime.now().isoformat()\n\n@app.mcp.tool(name=\"calc\", description=\"Calculate\", input_schema={...})\ndef calculate(args):\n    return eval(args[\"expression\"])\n\n@app.mcp.prompt(name=\"explain\", description=\"Explain code\", arguments=[...])\ndef explain_prompt(args):\n    return f\"Please explain: {args['code']}\"\n```\n\n## CLI Commands\n\n```bash\npython app.py                     # Start server\npython app.py --dev               # Development mode (hot reload)\npython app.py --processes 4       # Multi-process\npython app.py --workers 2         # Workers per process\npython app.py --log-level DEBUG   # Log level\npython app.py --open-browser      # Open browser on start\npython app.py --create            # Create new project scaffold\npython app.py --docs              # Open documentation\n```\n\n## Development Setup\n\n```bash\n# Clone\ngit clone https://github.com/sparckles/robyn.git\ncd robyn\n\n# Virtual environment\npython3 -m venv .venv && source .venv/bin/activate\n\n# Install tools\npip install pre-commit poetry maturin\n\n# Install dependencies\npoetry install --with dev --with test\n\n# Build Rust extension\nmaturin develop\n\n# Run tests\npytest\n```\n\n## Key Dependencies\n\n- **PyO3**: Rust-Python bindings\n- **actix-web**: Rust HTTP server (via cookie crate)\n- **orjson**: Fast JSON serialization\n- **multiprocess**: Multi-process support\n- **uvloop**: Fast event loop (non-Windows)\n- **watchdog**: File watching for hot reload\n\n## Configuration\n\nEnvironment variables:\n- `ROBYN_HOST`: Server host (default: 127.0.0.1)\n- `ROBYN_PORT`: Server port (default: 8080)\n- `ROBYN_DEV_MODE`: Enable dev mode\n- `ROBYN_BROWSER_OPEN`: Open browser on start\n- `ROBYN_CLIENT_TIMEOUT`: Client timeout seconds\n- `ROBYN_KEEP_ALIVE_TIMEOUT`: Keep-alive timeout\n\n## Documentation Structure\n\nMain docs at `docs_src/src/pages/documentation/`:\n- `api_reference/getting_started.mdx` - Quick start guide\n- `api_reference/request_object.mdx` - Request handling\n- `api_reference/middlewares.mdx` - Middleware usage\n- `api_reference/websockets.mdx` - WebSocket guide\n- `api_reference/authentication.mdx` - Auth patterns\n- `api_reference/openapi.mdx` - OpenAPI docs\n- `api_reference/agents.mdx` - AI agent integration\n- `api_reference/mcps.mdx` - MCP server guide\n- `example_app/` - Full example application tutorial\n","isInternal":false,"tokens":1975,"sizeBytes":8265}],"systemPromptSnippet":"<yakaai_skills repo=\"sparckles/Robyn\">\n<!-- File: llms.txt (Tokens: ~1975 | Category: root-instruction) -->\n# Robyn\n\n> Robyn is a high-performance, community-driven, and innovator-friendly async web framework for Python with a Rust runtime. It combines Python's ease of use with Rust's performance.\n\n## Quick Facts\n\n- Version: 0.79.0\n- Python: >= 3.10\n- License: BSD 2.0\n- Repository: https://github.com/sparckles/robyn\n- Documentation: https://robyn.tech/documentation\n- Discord: https://discord.gg/rkERZ5eNU8\n\n## Installation\n\n```bash\npip install robyn\n```\n\n## Basic Usage\n\n```python\nfrom robyn import Robyn\n\napp = Robyn(__file__)\n\n@app.get(\"/\")\nasync def index(request):\n    return \"Hello, World!\"\n\napp.start(port=8080)\n```\n\n## Key Features\n\n- **Rust Runtime**: Core server written in Rust using actix-web for high performance\n- **Async/Sync Support**: Both async and sync route handlers supported\n- **Multi-Process Scaling**: Built-in multiprocess execution via `--processes` and `--workers`\n- **WebSockets**: Native WebSocket support\n- **Middlewares**: Before/after request middlewares\n- **Dependency Injection**: Built-in DI system\n- **OpenAPI/Swagger**: Automatic OpenAPI documentation generation\n- **Hot Reloading**: Development mode with `--dev` flag\n- **AI Agents**: Built-in AI agent routing via `robyn.ai`\n- **MCP Support**: Model Context Protocol server capabilities via `app.mcp`\n- **Templating**: Jinja2 templating support (optional)\n- **CORS**: Built-in CORS helper via `ALLOW_CORS()`\n- **Authentication**: AuthenticationHandler base class for custom auth\n- **Static Files**: Directory serving via `app.serve_directory()`\n- **SSE**: Server-Sent Events support via `SSEResponse`\n- **Easy Access Parameters**: Typed path/query params with automatic coercion in handler signatures\n- **Direct Rust Integration**: Embed Rust code directly in routes\n\n## Project Structure\n\n```\nrobyn/\n├── src/                    # Rust source code\n│   ├── lib.rs              # PyO3 module entry point\n│   ├── server.rs           # Main HTTP server implementation\n│   ├── types/              # Request, Response, Headers, Cookie types\n│   ├── routers/            # HTTP, WebSocket, middleware routers\n│   ├── executors/          # Route execution handlers\n│   └── websockets/         # WebSocket implementation\n├── robyn/                  # Python package\n│   ├── __init__.py         # Main Robyn and SubRouter classes\n│   ├── router.py           # Python router implementation\n│   ├── authentication.py   # AuthenticationHandler\n│   ├── dependency_injection.py\n│   ├── openapi.py          # OpenAPI generation\n│   ├── mcp.py              # MCP protocol support\n│   ├── ai.py               # AI agent support\n│   ├── responses.py        # Response helpers (serve_file, html, SSE)\n│   ├── ws.py               # WebSocket class\n│   └── robyn.pyi           # Type stubs\n├── integration_tests/      # Integration test suite\n├── unit_tests/             # Unit test suite\n├── docs_src/               # Documentation (Next.js)\n├── granian/                # Bundled Granian server (fork)\n└── examples/               # Example applications\n```\n\n## Core Classes\n\n### Robyn / SubRouter\nMain application class and sub-router for modular routes.\n\n```python\nfrom robyn import Robyn, SubRouter\n\napp = Robyn(__file__)\napi = SubRouter(__file__, prefix=\"/api\")\n\n@api.get(\"/users\")\ndef get_users(request):\n    return {\"users\": []}\n\napp.include_router(api)\n```\n\n### Request Object\n```python\nrequest.method      # HTTP method\nrequest.url         # Url object (scheme, host, path)\nrequest.headers     # Headers dict-like\nrequest.query_params # QueryParams\nrequest.path_params  # Dict of URL params\nrequest.body        # Raw bytes\nrequest.json()      # Parse JSON body\nrequest.form_data   # Multipart form data\nrequest.ip_addr     # Client IP\nrequest.identity    # Identity (if authenticated)\n```\n\n### Response Object\n```python\nfrom robyn import Response\n\nResponse(\n    status_code=200,\n    headers={\"Content-Type\": \"application/json\"},\n    description=\"body content\"  # or body bytes\n)\n```\n\n### Decorators\n```python\n@app.get(\"/path\")\n@app.post(\"/path\")\n@app.put(\"/path\")\n@app.delete(\"/path\")\n@app.patch(\"/path\")\n@app.head(\"/path\")\n@app.options(\"/path\")\n\n@app.before_request(\"/path\")  # Middleware before\n@app.after_request(\"/path\")   # Middleware after\n\n@app.startup_handler         # Server startup\n@app.shutdown_handler        # Server shutdown\n```\n\n### WebSockets\n```python\nfrom robyn import WebSocketDisconnect\n\n@app.websocket(\"/ws\")\nasync def handler(websocket):\n    try:\n        while True:\n            msg = await websocket.receive_text()\n            await websocket.send_text(f\"Echo: {msg}\")\n    except WebSocketDisconnect:\n        pass\n\n@handler.on_connect\ndef on_connect(websocket):\n    return \"Connected\"\n\n@handler.on_close\ndef on_close(websocket):\n    return \"Closed\"\n```\n\n### Easy Access Parameters\nDeclare typed path and query parameters directly in handler signatures. Works for both HTTP and WebSocket handlers.\n\n```python\nfrom typing import List, Optional\n\n# HTTP: path params + query params with type coercion\n@app.get(\"/items/:id\")\nasync def get_item(id: int, q: str, page: int = 1):\n    return {\"id\": id, \"q\": q, \"page\": page}\n\n# Optional, List, and bool params\n@app.get(\"/search\")\ndef search(name: str, tags: List[str], active: bool = False, age: Optional[int] = None):\n    return {\"name\": name, \"tags\": tags, \"active\": active, \"age\": age}\n\n# WebSocket: typed query params on handler and callbacks\n@app.websocket(\"/ws\")\nasync def handler(websocket, room: str = \"default\", page: int = 1):\n    while True:\n        msg = await websocket.receive_text()\n        await websocket.send_text(f\"room={room} page={page} msg={msg}\")\n\n@handler.on_connect\ndef on_connect(websocket, room: str = \"default\"):\n    return f\"connected to {room}\"\n```\n\n### MCP (Model Context Protocol)\n```python\n@app.mcp.resource(\"time://current\")\ndef get_time():\n    return datetime.now().isoformat()\n\n@app.mcp.tool(name=\"calc\", description=\"Calculate\", input_schema={...})\ndef calculate(args):\n    return eval(args[\"expression\"])\n\n@app.mcp.prompt(name=\"explain\", description=\"Explain code\", arguments=[...])\ndef explain_prompt(args):\n    return f\"Please explain: {args['code']}\"\n```\n\n## CLI Commands\n\n```bash\npython app.py                     # Start server\npython app.py --dev               # Development mode (hot reload)\npython app.py --processes 4       # Multi-process\npython app.py --workers 2         # Workers per process\npython app.py --log-level DEBUG   # Log level\npython app.py --open-browser      # Open browser on start\npython app.py --create            # Create new project scaffold\npython app.py --docs              # Open documentation\n```\n\n## Development Setup\n\n```bash\n# Clone\ngit clone https://github.com/sparckles/robyn.git\ncd robyn\n\n# Virtual environment\npython3 -m venv .venv && source .venv/bin/activate\n\n# Install tools\npip install pre-commit poetry maturin\n\n# Install dependencies\npoetry install --with dev --with test\n\n# Build Rust extension\nmaturin develop\n\n# Run tests\npytest\n```\n\n## Key Dependencies\n\n- **PyO3**: Rust-Python bindings\n- **actix-web**: Rust HTTP server (via cookie crate)\n- **orjson**: Fast JSON serialization\n- **multiprocess**: Multi-process support\n- **uvloop**: Fast event loop (non-Windows)\n- **watchdog**: File watching for hot reload\n\n## Configuration\n\nEnvironment variables:\n- `ROBYN_HOST`: Server host (default: 127.0.0.1)\n- `ROBYN_PORT`: Server port (default: 8080)\n- `ROBYN_DEV_MODE`: Enable dev mode\n- `ROBYN_BROWSER_OPEN`: Open browser on start\n- `ROBYN_CLIENT_TIMEOUT`: Client timeout seconds\n- `ROBYN_KEEP_ALIVE_TIMEOUT`: Keep-alive timeout\n\n## Documentation Structure\n\nMain docs at `docs_src/src/pages/documentation/`:\n- `api_reference/getting_started.mdx` - Quick start guide\n- `api_reference/request_object.mdx` - Request handling\n- `api_reference/middlewares.mdx` - Middleware usage\n- `api_reference/websockets.mdx` - WebSocket guide\n- `api_reference/authentication.mdx` - Auth patterns\n- `api_reference/openapi.mdx` - OpenAPI docs\n- `api_reference/agents.mdx` - AI agent integration\n- `api_reference/mcps.mdx` - MCP server guide\n- `example_app/` - Full example application tutorial\n</yakaai_skills>"}