37 lines
679 B
Python
37 lines
679 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
import uvicorn
|
|
from ag_ui_crewai.endpoint import add_crewai_flow_fastapi_endpoint
|
|
from dotenv import load_dotenv
|
|
from fastapi import FastAPI
|
|
from src.agent import SampleAgentFlow
|
|
|
|
load_dotenv(Path(__file__).resolve().parent.parent / ".env")
|
|
load_dotenv()
|
|
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "ok"}
|
|
|
|
|
|
add_crewai_flow_fastapi_endpoint(app, SampleAgentFlow(), "/")
|
|
|
|
|
|
def main():
|
|
"""Run the uvicorn server."""
|
|
port = int(os.getenv("PORT", "8000"))
|
|
uvicorn.run(
|
|
"main:app",
|
|
host="0.0.0.0",
|
|
port=port,
|
|
reload=True,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|