Skip to content

Commit 99059dd

Browse files
committed
update tasks queues and executor
1 parent 233ac15 commit 99059dd

6 files changed

Lines changed: 21 additions & 23 deletions

openai_agents/run_agents_as_tools_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def main():
2121
AgentsAsToolsWorkflow.run,
2222
"Translate to English: '¿Cómo estás?'",
2323
id="my-workflow-id",
24-
task_queue="my-task-queue",
24+
task_queue="openai-agents-task-queue",
2525
id_reuse_policy=WorkflowIDReusePolicy.TERMINATE_IF_RUNNING,
2626
)
2727

openai_agents/run_customer_service_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def main():
5050
await client.start_workflow(
5151
CustomerServiceWorkflow.run,
5252
id=args.conversation_id,
53-
task_queue="my-task-queue",
53+
task_queue="openai-agents-task-queue",
5454
id_reuse_policy=WorkflowIDReusePolicy.ALLOW_DUPLICATE,
5555
)
5656
history = []

openai_agents/run_hello_world_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def main():
2121
HelloWorldAgent.run,
2222
"Tell me about recursion in programming.",
2323
id="my-workflow-id",
24-
task_queue="my-task-queue",
24+
task_queue="openai-agents-task-queue",
2525
id_reuse_policy=WorkflowIDReusePolicy.TERMINATE_IF_RUNNING,
2626
)
2727
print(f"Result: {result}")

openai_agents/run_research_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def main():
2121
ResearchWorkflow.run,
2222
"Caribbean vacation spots in April, optimizing for surfing, hiking and water sports",
2323
id="research-workflow",
24-
task_queue="my-task-queue",
24+
task_queue="openai-agents-task-queue",
2525
id_reuse_policy=WorkflowIDReusePolicy.TERMINATE_IF_RUNNING,
2626
)
2727

openai_agents/run_tools_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async def main():
2121
ToolsWorkflow.run,
2222
"What is the weather in Tokio?",
2323
id="tools-workflow",
24-
task_queue="my-task-queue",
24+
task_queue="openai-agents-task-queue",
2525
id_reuse_policy=WorkflowIDReusePolicy.TERMINATE_IF_RUNNING,
2626
)
2727

openai_agents/run_worker.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,22 @@ async def main():
3939
)
4040

4141
model_activity = ModelActivity(model_provider=None)
42-
with concurrent.futures.ThreadPoolExecutor(max_workers=20) as activity_executor:
43-
worker = Worker(
44-
client,
45-
task_queue="my-task-queue",
46-
workflows=[
47-
HelloWorldAgent,
48-
ToolsWorkflow,
49-
ResearchWorkflow,
50-
CustomerServiceWorkflow,
51-
AgentsAsToolsWorkflow,
52-
],
53-
activities=[
54-
model_activity.invoke_model_activity,
55-
get_weather,
56-
],
57-
activity_executor=activity_executor,
58-
)
59-
await worker.run()
42+
worker = Worker(
43+
client,
44+
task_queue="openai-agents-task-queue",
45+
workflows=[
46+
HelloWorldAgent,
47+
ToolsWorkflow,
48+
ResearchWorkflow,
49+
CustomerServiceWorkflow,
50+
AgentsAsToolsWorkflow,
51+
],
52+
activities=[
53+
model_activity.invoke_model_activity,
54+
get_weather,
55+
],
56+
)
57+
await worker.run()
6058

6159

6260
if __name__ == "__main__":

0 commit comments

Comments
 (0)