跳转到主要内容
在您的基础设施上部署AG-Kit服务器,以全面掌控您的Agent应用程序。

独立服务器

将AG-Kit作为独立服务运行:
from ag_kit_py.server import AGKitAPIApp

def create_agent():
    return {"agent": my_agent}

# One-line server startup
AGKitAPIApp().run(create_agent, port=8000)

框架集成

与现有Python/TypeScript应用程序集成:
from fastapi import FastAPI
from ag_kit_py.server import AGKitAPIApp

# Your existing FastAPI app
app = FastAPI(title="My Application")

# Add AG-Kit routes
agkit_app = AGKitAPIApp().build(create_agent, base_path="/api/agent")
app.mount("/api/agent", agkit_app)

生产环境部署

使用进程管理器进行生产环境部署:
# Install Gunicorn
pip install gunicorn

# Run with multiple workers
gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app

后续步骤