agents-runtime/test_orchestrator.py

27 lines
958 B
Python

import asyncio
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from src.orchestrator import CentralOrchestratorWorkflow
from src.agent import run_agent_activity
async def main():
async with await WorkflowEnvironment.start_time_skipping() as env:
async with Worker(
env.client,
task_queue="agent-task-queue",
workflows=[CentralOrchestratorWorkflow],
activities=[run_agent_activity],
):
print("Submitting workflow...")
result = await env.client.execute_workflow(
CentralOrchestratorWorkflow.run,
"Remind me to call John at 4pm and send me a WhatsApp about it",
id="test-workflow",
task_queue="agent-task-queue",
)
print(f"Workflow Result: {result}")
if __name__ == "__main__":
asyncio.run(main())