{"id":27137932,"url":"https://github.com/wassim249/fastapi-langgraph-agent-production-ready-template","last_synced_at":"2025-04-13T19:39:18.235Z","repository":{"id":286654019,"uuid":"962106649","full_name":"wassim249/fastapi-langgraph-agent-production-ready-template","owner":"wassim249","description":"A production-ready FastAPI template for building AI agent applications with LangGraph integration. This template provides a robust foundation for building scalable, secure, and maintainable AI agent services.","archived":false,"fork":false,"pushed_at":"2025-04-09T18:01:46.000Z","size":127,"stargazers_count":51,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T17:54:11.193Z","etag":null,"topics":["agent","agentic-ai","docker","fastapi","fastapi-template","langchain","langchain-python","langgraph","langgraph-python","llm","memory"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wassim249.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-07T16:54:25.000Z","updated_at":"2025-04-12T10:52:36.000Z","dependencies_parsed_at":"2025-04-10T00:27:23.715Z","dependency_job_id":null,"html_url":"https://github.com/wassim249/fastapi-langgraph-agent-production-ready-template","commit_stats":null,"previous_names":["wassim249/fastapi-langgraph-agent-production-ready-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wassim249%2Ffastapi-langgraph-agent-production-ready-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wassim249%2Ffastapi-langgraph-agent-production-ready-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wassim249%2Ffastapi-langgraph-agent-production-ready-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wassim249%2Ffastapi-langgraph-agent-production-ready-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wassim249","download_url":"https://codeload.github.com/wassim249/fastapi-langgraph-agent-production-ready-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610408,"owners_count":21132920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","agentic-ai","docker","fastapi","fastapi-template","langchain","langchain-python","langgraph","langgraph-python","llm","memory"],"created_at":"2025-04-08T04:37:18.421Z","updated_at":"2025-04-12T17:54:13.574Z","avatar_url":"https://github.com/wassim249.png","language":"Python","funding_links":[],"categories":["📋 Templates \u0026 Starters","FastAPI","Agent Integration \u0026 Deployment Tools"],"sub_categories":["🟩 Development Tools 🛠️","Table of Content","AI Agent Operating System"],"readme":"# FastAPI LangGraph Agent Template\n\nA production-ready FastAPI template for building AI agent applications with LangGraph integration. This template provides a robust foundation for building scalable, secure, and maintainable AI agent services.\n\n## 🌟 Features\n\n- **Production-Ready Architecture**\n  - FastAPI for high-performance async API endpoints\n  - LangGraph integration for AI agent workflows\n  - Langfuse for LLM observability and monitoring\n  - Structured logging with environment-specific formatting\n  - Rate limiting with configurable rules\n  - PostgreSQL for data persistence\n  - Docker and Docker Compose support\n  - Prometheus metrics and Grafana dashboards for monitoring\n\n- **Security**\n  - JWT-based authentication\n  - Session management\n  - Input sanitization\n  - CORS configuration\n  - Rate limiting protection\n\n- **Developer Experience**\n  - Environment-specific configuration\n  - Comprehensive logging system\n  - Clear project structure\n  - Type hints throughout\n  - Easy local development setup\n\n- **Model Evaluation Framework**\n  - Automated metric-based evaluation of model outputs\n  - Integration with Langfuse for trace analysis\n  - Detailed JSON reports with success/failure metrics\n  - Interactive command-line interface\n  - Customizable evaluation metrics\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- Python 3.13+\n- PostgreSQL\n- Docker and Docker Compose (optional)\n\n### Environment Setup\n\n1. Clone the repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd \u003cproject-directory\u003e\n```\n\n2. Create and activate a virtual environment:\n```bash\nuv sync\n```\n\n3. Copy the example environment file:\n```bash\ncp .env.example .env.[development|staging|production] # e.g. .env.development\n```\n\n4. Update the `.env` file with your configuration (see `.env.example` for reference)\n\n### Running the Application\n\n#### Local Development\n\n1. Install dependencies:\n```bash\nuv sync\n```\n\n2. Run the application:\n```bash\nmake [dev|staging|production] # e.g. make dev\n```\n\n1. Go to Swagger UI:\n```bash\nhttp://localhost:8000/docs\n```\n\n#### Using Docker\n\n1. Build and run with Docker Compose:\n```bash\nmake docker-build-env ENV=[development|staging|production] # e.g. make docker-build-env ENV=development\nmake docker-run-env ENV=[development|staging|production] # e.g. make docker-run-env ENV=development\n```\n\n2. Access the monitoring stack:\n```bash\n# Prometheus metrics\nhttp://localhost:9090\n\n# Grafana dashboards\nhttp://localhost:3000\nDefault credentials:\n- Username: admin\n- Password: admin\n```\n\nThe Docker setup includes:\n- FastAPI application\n- PostgreSQL database\n- Prometheus for metrics collection\n- Grafana for metrics visualization\n- Pre-configured dashboards for:\n  - API performance metrics\n  - Rate limiting statistics\n  - Database performance\n  - System resource usage\n\n## 📊 Model Evaluation\n\nThe project includes a robust evaluation framework for measuring and tracking model performance over time. The evaluator automatically fetches traces from Langfuse, applies evaluation metrics, and generates detailed reports.\n\n### Running Evaluations\n\nYou can run evaluations with different options using the provided Makefile commands:\n\n```bash\n# Interactive mode with step-by-step prompts\nmake eval [ENV=development|staging|production]\n\n# Quick mode with default settings (no prompts)\nmake eval-quick [ENV=development|staging|production]\n\n# Evaluation without report generation\nmake eval-no-report [ENV=development|staging|production]\n```\n\n### Evaluation Features\n\n- **Interactive CLI**: User-friendly interface with colored output and progress bars\n- **Flexible Configuration**: Set default values or customize at runtime\n- **Detailed Reports**: JSON reports with comprehensive metrics including:\n  - Overall success rate\n  - Metric-specific performance\n  - Duration and timing information\n  - Trace-level success/failure details\n\n### Customizing Metrics\n\nEvaluation metrics are defined in `evals/metrics/prompts/` as markdown files:\n\n1. Create a new markdown file (e.g., `my_metric.md`) in the prompts directory\n2. Define the evaluation criteria and scoring logic\n3. The evaluator will automatically discover and apply your new metric\n\n### Viewing Reports\n\nReports are automatically generated in the `evals/reports/` directory with timestamps in the filename:\n\n```\nevals/reports/evaluation_report_YYYYMMDD_HHMMSS.json\n```\n\nEach report includes:\n- High-level statistics (total trace count, success rate, etc.)\n- Per-metric performance metrics\n- Detailed trace-level information for debugging\n\n## 🔧 Configuration\n\nThe application uses a flexible configuration system with environment-specific settings:\n\n- `.env.development`\n- ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwassim249%2Ffastapi-langgraph-agent-production-ready-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwassim249%2Ffastapi-langgraph-agent-production-ready-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwassim249%2Ffastapi-langgraph-agent-production-ready-template/lists"}