--- title: Kortix Backend API emoji: 🤖 colorFrom: blue colorTo: purple sdk: docker pinned: false license: apache-2.0 --- # Kortix Backend API 🚀 Backend API لمنصة **Kortix** - منصة متكاملة لبناء وإدارة AI Agents المستقلة. ## 🌟 المميزات - ✅ **FastAPI Backend** - API سريع وفعال - ✅ **Multi-LLM Support** - دعم Anthropic Claude, OpenAI, وغيرها - ✅ **Agent Management** - إدارة متقدمة للـ AI Agents - ✅ **Thread Management** - إدارة المحادثات والـ sessions - ✅ **Supabase Integration** - قاعدة بيانات وتوثيق متكامل - ✅ **Background Tasks** - معالجة المهام في الخلفية - ✅ **Tool Integration** - دعم أدوات متعددة للـ agents ## 🔧 Environment Variables المطلوبة قبل تشغيل الـ Space، أضف هذه المتغيرات في **Settings → Secrets**: ### Required (مطلوب): ```bash # LLM Provider (واحد على الأقل) ANTHROPIC_API_KEY=sk-ant-xxxxx # Supabase Configuration SUPABASE_URL=https://xxxxx.supabase.co SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIs... SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIs... # Environment ENVIRONMENT=production ``` ### Optional (اختياري): ```bash # Additional LLM Providers OPENAI_API_KEY=sk-xxxxx # Redis for Caching REDIS_URL=redis://your-redis-url:6379 # Search APIs TAVILY_API_KEY=tvly-xxxxx FIRECRAWL_API_KEY=fc-xxxxx # Logging LOG_LEVEL=INFO ``` ## 🚀 كيفية الاستخدام ### 1. الوصول للـ API بعد تشغيل الـ Space، سيكون الـ API متاح على: ``` https://YOUR_USERNAME-kortix-backend.hf.space ``` ### 2. التحقق من الصحة (Health Check) ```bash curl https://YOUR_USERNAME-kortix-backend.hf.space/health ``` الرد المتوقع: ```json { "status": "healthy", "version": "1.0.0" } ``` ### 3. API Documentation FastAPI توفر documentation تفاعلية تلقائية: - **Swagger UI**: `https://YOUR_USERNAME-kortix-backend.hf.space/docs` - **ReDoc**: `https://YOUR_USERNAME-kortix-backend.hf.space/redoc` ## 📚 API Endpoints ### Core Endpoints: - `GET /health` - التحقق من صحة الـ API - `POST /api/v1/agents` - إنشاء agent جديد - `GET /api/v1/agents` - عرض جميع الـ agents - `POST /api/v1/threads` - إنشاء thread محادثة جديد - `POST /api/v1/messages` - إرسال رسالة ### Authentication: معظم endpoints تحتاج لـ JWT token من Supabase: ```bash curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \ https://YOUR_USERNAME-kortix-backend.hf.space/api/v1/agents ``` ## 🏗️ البنية التقنية ``` kortix-backend/ ├── api.py # Entry point ├── auth/ # Authentication & authorization ├── core/ # Core business logic ├── evals/ # Evaluation & testing ├── scripts/ # Utility scripts ├── supabase/ # Database migrations & functions └── tests/ # Unit & integration tests ``` ## 🔒 الأمان - ✅ JWT Authentication عبر Supabase - ✅ Rate limiting للـ API requests - ✅ Input validation مع Pydantic - ✅ Environment variables للـ secrets - ✅ CORS configuration ## 📊 المراقبة والـ Logs الـ Space يوفر logs مباشرة في الواجهة: - Application logs - Error tracking - Performance metrics ## ⚠️ ملاحظات مهمة 1. **Hugging Face Free Tier:** - موارد محدودة (CPU) - قد تحتاج لـ upgrade للأداء الأفضل 2. **Cold Start:** - أول request قد يأخذ وقت أطول - بعد ذلك السرعة تتحسن 3. **Persistence:** - البيانات مخزنة في Supabase - الملفات المؤقتة قد تُحذف عند إعادة التشغيل ## 🔗 روابط مفيدة - [المشروع الأصلي على GitHub](https://github.com/kortix-ai/suna) - [Discord Community](https://discord.com/invite/RvFhXUdZ9H) - [Kortix Website](https://www.kortix.com) - [Hugging Face Spaces Docs](https://huggingface.co/docs/hub/spaces) ## 🤝 المساهمة هذا الـ Space هو deployment للمشروع الأصلي [Kortix Suna](https://github.com/kortix-ai/suna). للمساهمة في المشروع: 1. Fork الـ repository الأصلي 2. إنشاء branch جديد 3. عمل Pull Request ## 📄 License Apache License 2.0 - See [LICENSE](https://github.com/kortix-ai/suna/blob/main/LICENSE) --- ## 🆘 الدعم واجهت مشكلة؟ 1. تحقق من الـ logs في الـ Space 2. تأكد من إضافة كل الـ Environment Variables 3. انضم لـ [Discord Server](https://discord.com/invite/RvFhXUdZ9H) للمساعدة --- Built with ❤️ by the Kortix Team Deployed on 🤗 Hugging Face Spaces