agent-sandbox / app.py
mimipynb's picture
Create app.py
afd7056 verified
raw
history blame
294 Bytes
# agent_server.py
from fastapi import FastAPI, Body
app = FastAPI()
@app.post("/run")
def run_code(payload: dict = Body(...)):
code = payload.get("code", "")
try:
result = eval(code)
return {"output": result}
except Exception as e:
return {"error": str(e)}