openfang / api /agents.py
Jules
Ensure api and helpers directories are included in the build
67b6ab0
from helpers.api import ApiHandler, Input, Output, Request
from helpers import subagents
class Agents(ApiHandler):
async def process(self, input: Input, request: Request) -> Output:
action = input.get("action", "")
try:
if action == "list":
data = subagents.get_all_agents_list()
else:
raise Exception("Invalid action")
return {
"ok": True,
"data": data,
}
except Exception as e:
return {
"ok": False,
"error": str(e),
}