Spaces:
Sleeping
Sleeping
Create orchestrator.py
Browse files- orchestrator.py +17 -0
orchestrator.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from context_graph import ContextMemoryGraph
|
| 2 |
+
|
| 3 |
+
class Orchestrator:
|
| 4 |
+
def __init__(self, agent_core):
|
| 5 |
+
self.agent_core = agent_core
|
| 6 |
+
self.graph = ContextMemoryGraph()
|
| 7 |
+
|
| 8 |
+
def route(self, prompt, context):
|
| 9 |
+
if "summarize" in prompt.lower():
|
| 10 |
+
result = "This agent summarizes and organizes context."
|
| 11 |
+
elif "memory" in prompt.lower():
|
| 12 |
+
result = f"Memory size: {len(context)}"
|
| 13 |
+
else:
|
| 14 |
+
result = f"Processed: {prompt}"
|
| 15 |
+
|
| 16 |
+
self.graph.link_context(self.agent_core.agent_id, prompt, result)
|
| 17 |
+
return result
|