-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathrun_workflow.py
More file actions
30 lines (21 loc) · 849 Bytes
/
Copy pathrun_workflow.py
File metadata and controls
30 lines (21 loc) · 849 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
"""Start the structured output workflow."""
import asyncio
import os
from temporalio.client import Client
from temporalio.contrib.strands import StrandsPlugin
from strands_plugin.structured_output.workflow import StructuredOutputWorkflow
async def main() -> None:
# Plugin on the client so the pydantic data converter is installed.
client = await Client.connect(
os.environ.get("TEMPORAL_ADDRESS", "localhost:7233"),
plugins=[StrandsPlugin()],
)
person = await client.execute_workflow(
StructuredOutputWorkflow.run,
"John Smith is a 30 year-old software engineer.",
id="strands-structured-output",
task_queue="strands-structured-output",
)
print(f"name={person.name} age={person.age} occupation={person.occupation}")
if __name__ == "__main__":
asyncio.run(main())