Python SDK for Fleeks services
Project description
Fleeks Python SDK
Production-ready Python SDK for the Fleeks AI Development Platform
Fleeks is a revolutionary AI-powered development platform that provides instant polyglot workspaces with 11+ languages, AI agents, and complete development environments.
✨ Key Features
- 🏃 Sub-Second Workspaces - Create complete dev environments in <200ms
- 🌐 11+ Languages - Python, Node, Go, Rust, Java, Ruby, PHP, and more
- 🤖 AI Agents - Code generation, debugging, testing, research
- 📁 Full File System - Complete CRUD operations with safety features
- 💻 Terminal Control - Sync/async command execution, background jobs
- 📦 Container Management - Real-time stats, process control
- 🔄 Real-time Streaming - WebSocket file watching and agent streaming
- ⚡ Async/Await - Built for high performance
- 🔐 Enterprise Security - API key auth with scopes
📦 Installation
pip install fleeks-sdk
🚀 Quick Start
import asyncio
from fleeks_sdk import FleeksClient
async def main():
# Initialize client
client = FleeksClient(api_key="fleeks_sk_your_key_here")
# Create workspace with Python - includes instant preview URLs!
workspace = await client.workspaces.create(
project_id="my-project",
template="python"
)
print(f"🌐 Preview URL: {workspace.preview_url}")
print(f"🔌 WebSocket URL: {workspace.websocket_url}")
# Create a web server
await workspace.files.create(
path="app.py",
content="""
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
return 'Hello from Fleeks!'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080)
"""
)
# Install Flask and start server
await workspace.terminal.execute("pip install flask")
await workspace.terminal.execute("python app.py", background=True)
# Get preview URL details
preview = await workspace.get_preview_url()
print(f"🚀 Your app is live at: {preview.preview_url}")
# Use AI agent
agent = await workspace.agents.execute(
task="Add unit tests",
agent_type="test"
)
await workspace.agents.wait_for_completion(agent.agent_id)
# Cleanup
await workspace.delete()
asyncio.run(main())
📖 Core Features
🌐 Preview URLs (NEW!)
Get instant HTTPS access to your workspace applications with zero configuration:
# Create workspace - preview URLs included automatically!
workspace = await client.workspaces.create("my-app", "python")
# Access preview URLs immediately
print(workspace.preview_url) # https://preview.fleeks.ai/my-app/
print(workspace.websocket_url) # wss://ws.fleeks.ai/my-app/
# Start your Flask/Express/React app
await workspace.terminal.execute("python app.py", background=True)
# Get detailed preview info
preview = await workspace.get_preview_url()
print(f"Status: {preview.status}")
print(f"Container: {preview.container_id}")
# Your app is now live at: https://preview.fleeks.ai/my-app/
Features:
- ✅ Automatic HTTPS with SSL certificates
- ✅ WebSocket support for real-time features
- ✅ Global CDN distribution
- ✅ Zero configuration required
- ✅ Works with any framework (Flask, Express, React, Next.js, etc.)
Workspaces
# Create with specific languages
workspace = await client.workspaces.create(
"my-app",
template="python",
pinned_versions={"python": "3.11", "node": "20"}
)
# Check health
health = await workspace.get_health()
print(f"Status: {health.status}, Uptime: {health.uptime_seconds}s")
Files
# Create, read, update, delete
await workspace.files.create("src/main.py", content="...")
content = await workspace.files.read("src/main.py")
await workspace.files.update("src/main.py", content="...")
await workspace.files.delete("src/main.py")
# Directories
await workspace.files.mkdir("src/utils")
listing = await workspace.files.list("/", recursive=True)
Terminal
# Sync execution
result = await workspace.terminal.execute("npm test")
# Background jobs
job = await workspace.terminal.start_background_job("npm run dev")
await workspace.terminal.wait_for_job(job.job_id)
AI Agents
# Execute agent task
agent = await workspace.agents.execute(
task="Create REST API with auth",
agent_type="code",
context={"framework": "FastAPI"}
)
# Monitor progress
status = await workspace.agents.get_status(agent.agent_id)
print(f"Progress: {status.progress}%")
# Get results
output = await workspace.agents.get_output(agent.agent_id)
print(f"Files created: {len(output.files_created)}")
📚 Documentation
- Full Documentation: See
SDK_IMPLEMENTATION_PLAN_VERIFIED.md - Examples: Check
examples/complete_examples.py - API Reference: All modules are fully documented with docstrings
Running Tests
pytest
Code Formatting
black fleeks_sdk tests
isort fleeks_sdk tests
Type Checking
mypy fleeks_sdk
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Support
For support, email support@fleeks.com or create an issue on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fleeks_sdk-0.2.6.tar.gz.
File metadata
- Download URL: fleeks_sdk-0.2.6.tar.gz
- Upload date:
- Size: 267.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e318eab6fb7d6d585c34eece6f70b627e0db6ffa0d60b7e966a3cd5046d65bf
|
|
| MD5 |
8a115a90ef9f282c4c202c481277c427
|
|
| BLAKE2b-256 |
81fe69f92c96863b5ce99d549455b907016ff7e5590c450b3b7906c3fa266ed2
|
File details
Details for the file fleeks_sdk-0.2.6-py3-none-any.whl.
File metadata
- Download URL: fleeks_sdk-0.2.6-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4653300818f2304af3ccf79b9b87073213e2849f8c3c6ff3cac884fb4593822a
|
|
| MD5 |
e557789a6f5ccb4e977f16a8d5a95131
|
|
| BLAKE2b-256 |
630d1af5d0f0216b3c7814bd9e03d65df264f4a15f5aeda154040320f1f96d39
|