mirror of https://github.com/dapr/dapr-agents.git
updated quickstart mukti-agent workflows to integrate orchestrator as service change
This commit is contained in:
parent
6ab4a73444
commit
7662302414
|
@ -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:
|
||||
|
|
|
@ -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"]
|
|
@ -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"]
|
|
@ -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"]
|
|
@ -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)
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"]
|
|
@ -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"]
|
|
@ -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"]
|
|
@ -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)
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue