MVP / Backend /api /server.py
github-actions[bot]
Deploy application
1f0fa9b
Raw History Blame Contribute Delete
703 Bytes
import sys
from pathlib import Path
# Ensure Backend directory is in sys.path and load root .env
BACKEND_DIR = Path(__file__).resolve().parent.parent
if str(BACKEND_DIR) not in sys.path:
sys.path.insert(0, str(BACKEND_DIR))
import config
from fastapi import FastAPI, HTTPException
from schemas.agent_spec import AgentSpec
from executor.executor import execute_spec
app = FastAPI(title="Agent Execution API")
@app.post("/execute")
def execute(spec: AgentSpec):
try:
result = execute_spec(spec)
return {"result": result}
except Exception as e:
raise HTTPException(
status_code=500,
detail=f"Error executing agent spec: {str(e)}"
)