Skip to content

Commit 0603b3b

Browse files
brianstrauchclaude
authored andcommitted
Use datetime.timedelta in openai_agents samples (#312)
workflow.timedelta was an incidental re-export from temporalio's old workflow.py module. The refactor to a workflow package in temporalio/sdk-python#1488 dropped it, so use datetime.timedelta directly (matches the rest of the repo). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b713c08 commit 0603b3b

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

openai_agents/basic/workflows/local_image_workflow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from datetime import timedelta
2+
13
from agents import Agent, Runner
24
from temporalio import workflow
35

@@ -24,7 +26,7 @@ async def run(
2426
b64_image = await workflow.execute_activity(
2527
read_image_as_base64,
2628
image_path,
27-
start_to_close_timeout=workflow.timedelta(seconds=30),
29+
start_to_close_timeout=timedelta(seconds=30),
2830
)
2931

3032
agent = Agent(

openai_agents/reasoning_content/workflows/reasoning_content_workflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from dataclasses import dataclass
2+
from datetime import timedelta
23

34
from temporalio import workflow
45

@@ -22,7 +23,7 @@ async def run(self, prompt: str, model_name: str | None = None) -> ReasoningResu
2223
reasoning_content, regular_content = await workflow.execute_activity(
2324
get_reasoning_response,
2425
args=[prompt, model_name],
25-
start_to_close_timeout=workflow.timedelta(minutes=5),
26+
start_to_close_timeout=timedelta(minutes=5),
2627
)
2728

2829
return ReasoningResult(

0 commit comments

Comments
 (0)