File size: 294 Bytes
afd7056
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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)}