File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from datetime import timedelta
44
5- from agents import Agent , Runner , trace
5+ from agents import Agent , Runner
66from temporalio import workflow
77from temporalio .contrib import openai_agents as temporal_agents
88
1313class ToolsWorkflow :
1414 @workflow .run
1515 async def run (self , question : str ) -> str :
16- with trace ("Activity as tool" ):
17- agent = Agent (
18- name = "Hello world" ,
19- instructions = "You are a helpful agent." ,
20- tools = [
21- temporal_agents .workflow .activity_as_tool (
22- get_weather , start_to_close_timeout = timedelta (seconds = 10 )
23- )
24- ],
25- )
16+ agent = Agent (
17+ name = "Hello world" ,
18+ instructions = "You are a helpful agent." ,
19+ tools = [
20+ temporal_agents .workflow .activity_as_tool (
21+ get_weather , start_to_close_timeout = timedelta (seconds = 10 )
22+ )
23+ ],
24+ )
2625
27- result = await Runner .run (agent , input = question )
28- return result .final_output
26+ result = await Runner .run (agent , input = question )
27+ return result .final_output
You can’t perform that action at this time.
0 commit comments