Skill hosting
Overview
Section titled “Overview”The Skill environment of Agent.zio provides a lightweight serverless hosting platform that allows users to instantly run and deploy various scripts they write, such as Python, Shell, Node.js, etc. When you set up a web server (FastAPI, Flask, etc.), the system automatically assigns a port and offers a secure URL exposed externally.
🚀 Core Features and Highlights
Section titled “🚀 Core Features and Highlights”| Feature | Description |
|---|---|
| Dynamic Port Allocation (Zero‑Config) | When writing a web server, use os.environ.get("PORT", 8000) instead of a fixed port. The system finds an empty port in 0.1 seconds and automatically performs a cold start. |
| One‑Stop Preview (Built‑in IDE) | Clicking the preview icon in the upper right corner of the editor allows you to test the running screen immediately inside the IDE, without opening a new browser window. |
| Automatic External Deployment URL | A finished web skill will have an externally accessible deployment address immediately. (e.g., https://<instance‑address>:7010/skills/[skill-name]/[path]) |
| State‑Preserving Process | Regular scripts have a 30‑second timeout, but code identified as a web server framework (FastAPI, Flask, etc.) runs in a separate process permanently and automatically restarts (Auto‑Reload) when the code changes (saved). |
Implementation Example
Section titled “Implementation Example”This is a basic skeleton of a simple web server that uses dynamic ports.
import osimport uvicornfrom fastapi import FastAPIfrom fastapi.staticfiles import StaticFilesfrom pathlib import Path
app = FastAPI(title="My Custom Skill")
@app.get("/api/hello")def hello(): return {"message": "Hello from Serverless Skill!"}
# 웹 페이지 렌더링을 위한 정적 폴더 마운트 (폴더명: admin 권장)admin_dir = Path(__file__).parent / "admin"if admin_dir.exists(): app.mount("/", StaticFiles(directory=str(admin_dir), html=True), name="admin")
if __name__ == "__main__": # 시스템이 주입하는 PORT 환경변수를 반드시 읽어와야 합니다. port = int(os.environ.get("PORT", 8000)) uvicorn.run(app, host="0.0.0.0", port=port)Tip: Name the folder containing your frontend static files as admin or static if possible. The console will automatically detect HTML files in that folder and generate shortcut links for you.