Skip to content

Commit 10cda63

Browse files
committed
Pass DurableAIAgentContext instead of DurableOrchestrationContext to the wrapped orchestrator
1 parent 3f0ffb0 commit 10cda63

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from functools import wraps
22
from agents.run import set_default_agent_runner
3+
from azure.durable_functions.models.DurableOrchestrationContext import DurableOrchestrationContext
34
from durable_openai_runner import DurableOpenAIRunner
45
from yield_exception import YieldException
56
from durable_ai_agent_context import DurableAIAgentContext
@@ -8,19 +9,19 @@
89

910
def durable_openai_agent_orchestrator(func):
1011
@wraps(func)
11-
def wrapper(context):
12+
def wrapper(durable_orchestration_context: DurableOrchestrationContext):
1213
event_loop.ensure_event_loop()
13-
context = DurableAIAgentContext(context)
14-
durable_openai_runner = DurableOpenAIRunner(context=context)
14+
durable_ai_agent_context = DurableAIAgentContext(durable_orchestration_context)
15+
durable_openai_runner = DurableOpenAIRunner(context=durable_ai_agent_context)
1516
set_default_agent_runner(durable_openai_runner)
1617

1718
try:
18-
result = func(context)
19+
result = func(durable_ai_agent_context)
1920
return result
2021
except YieldException as e:
21-
yield from context.yield_and_clear_tasks()
22+
yield from durable_ai_agent_context.yield_and_clear_tasks()
2223
yield e.task
2324
finally:
24-
yield from context.yield_and_clear_tasks()
25-
25+
yield from durable_ai_agent_context.yield_and_clear_tasks()
26+
2627
return wrapper

0 commit comments

Comments
 (0)