Spaces:
Running
Running
Download api/agents.py from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 621 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/agents.py
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/api/agents.py
-
curl -L -o agents.py https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/agents.py
621 Bytes
| 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), | |
| } | |