updated quickstart mukti-agent workflows to integrate orchestrator as service change

This commit is contained in:
Roberto Rodriguez 2025-03-25 12:10:42 -04:00
parent 6ab4a73444
commit 7662302414
18 changed files with 93 additions and 17 deletions

View File

@ -95,7 +95,7 @@ async def main():
agent=hobbit_agent,
message_bus_name="messagepubsub",
agents_state_store_name="agentstatestore",
service_port8001,
service_port=8001,
)
await hobbit_service.start()
@ -130,7 +130,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await random_workflow.start()
except Exception as e:
print(f"Error starting workflow: {e}")
@ -173,10 +173,11 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-random/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py", "--orchestrator", "RandomOrchestrator"]
command: ["python3", "http_client.py"]
```
Start all services using the Dapr CLI:

View File

@ -25,7 +25,8 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-llm/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py"]
command: ["python3", "http_client.py"]

View File

@ -25,7 +25,8 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-random/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py", "--orchestrator", "RandomOrchestrator"]
command: ["python3", "http_client.py"]

View File

@ -25,7 +25,8 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-roundrobin/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py", "--orchestrator", "RoundRobinOrchestrator"]
command: ["python3", "http_client.py"]

View File

@ -0,0 +1,34 @@
#!/usr/bin/env python3
import requests
import time
import sys
if __name__ == "__main__":
workflow_url = "http://localhost:8004/start-workflow"
task_payload = {"task": "How to get to Mordor? We all need to help!"}
attempt = 1
while attempt <= 10:
try:
print(f"Attempt {attempt}...")
response = requests.post(workflow_url, json=task_payload, timeout=5)
if response.status_code == 202:
print("Workflow started successfully!")
sys.exit(0)
else:
print(f"Received status code {response.status_code}: {response.text}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
attempt += 1
print(f"Waiting 1s seconds before next attempt...")
time.sleep(1)
print(f"Maximum attempts (10) reached without success.")
print("Failed to get successful response")
sys.exit(1)

View File

@ -14,7 +14,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await llm_workflow.start()
except Exception as e:

View File

@ -14,7 +14,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await random_workflow.start()
except Exception as e:

View File

@ -14,7 +14,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await roundrobin_workflow.start()
except Exception as e:

View File

@ -131,7 +131,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await random_workflow_service.start()
except Exception as e:
print(f"Error starting service: {e}")
@ -171,10 +171,11 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-random/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py", "--orchestrator", "RandomOrchestrator"]
command: ["python3", "http_client.py"]
```
Start all services using the Dapr CLI:

View File

@ -22,7 +22,8 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-llm/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py"]
command: ["python3", "http_client.py"]

View File

@ -22,7 +22,8 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-random/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py", "--orchestrator", "RandomOrchestrator"]
command: ["python3", "http_client.py"]

View File

@ -22,7 +22,8 @@ apps:
- appID: WorkflowApp
appDirPath: ./services/workflow-roundrobin/
command: ["python3", "app.py"]
appPort: 8004
- appID: ClientApp
appDirPath: ./services/client/
command: ["python3", "client.py", "--orchestrator", "RoundRobinOrchestrator"]
command: ["python3", "http_client.py"]

View File

@ -0,0 +1,34 @@
#!/usr/bin/env python3
import requests
import time
import sys
if __name__ == "__main__":
workflow_url = "http://localhost:8004/start-workflow"
task_payload = {"task": "How to get to Mordor? We all need to help!"}
attempt = 1
while attempt <= 10:
try:
print(f"Attempt {attempt}...")
response = requests.post(workflow_url, json=task_payload, timeout=5)
if response.status_code == 202:
print("Workflow started successfully!")
sys.exit(0)
else:
print(f"Received status code {response.status_code}: {response.text}")
except requests.exceptions.RequestException as e:
print(f"Request failed: {e}")
attempt += 1
print(f"Waiting 1s seconds before next attempt...")
time.sleep(1)
print(f"Maximum attempts (10) reached without success.")
print("Failed to get successful response")
sys.exit(1)

View File

@ -14,7 +14,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await workflow_service.start()
except Exception as e:

View File

@ -14,7 +14,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await workflow_service.start()
except Exception as e:

View File

@ -14,7 +14,7 @@ async def main():
agents_registry_store_name="agentstatestore",
agents_registry_key="agents_registry",
max_iterations=3
)
).as_service(port=8004)
await workflow_service.start()
except Exception as e: