Create app/agents/orchestrator.py
Browse files- app/agents/orchestrator.py +21 -0
app/agents/orchestrator.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app/agents/orchestrator.py
|
| 2 |
+
|
| 3 |
+
from app.core.router import route_agent
|
| 4 |
+
from app.workers.tasks import enqueue_task
|
| 5 |
+
|
| 6 |
+
def process_request(prompt: str, user_id: str):
|
| 7 |
+
agent = route_agent(prompt)
|
| 8 |
+
|
| 9 |
+
task = {
|
| 10 |
+
"agent": agent,
|
| 11 |
+
"prompt": prompt,
|
| 12 |
+
"user_id": user_id
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
task_id = enqueue_task(task)
|
| 16 |
+
|
| 17 |
+
return {
|
| 18 |
+
"status": "queued",
|
| 19 |
+
"task_id": task_id,
|
| 20 |
+
"agent": agent
|
| 21 |
+
}
|