forked from temporalio/samples-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_workflow.py
More file actions
33 lines (23 loc) · 831 Bytes
/
run_workflow.py
File metadata and controls
33 lines (23 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Run the Activity from Node workflow.
Starts a workflow execution and waits for the result.
"""
import asyncio
import uuid
from temporalio.client import Client
from temporalio.envconfig import ClientConfig
from langgraph_plugin.activity_from_node.workflow import ActivityFromNodeWorkflow
async def main() -> None:
# Connect to Temporal
config = ClientConfig.load_client_connect_config()
config.setdefault("target_host", "localhost:7233")
client = await Client.connect(**config)
# Run the workflow
result = await client.execute_workflow(
ActivityFromNodeWorkflow.run,
"Hello from LangGraph",
id=f"activity-from-node-{uuid.uuid4()}",
task_queue="langgraph-activity-from-node",
)
print(f"Result: {result}")
if __name__ == "__main__":
asyncio.run(main())