diff --git a/openai_agents/run_customer_service_client.py b/openai_agents/run_customer_service_client.py index f129d0d4..be081c1e 100644 --- a/openai_agents/run_customer_service_client.py +++ b/openai_agents/run_customer_service_client.py @@ -32,12 +32,13 @@ async def main(): # Query the workflow for the chat history # If the workflow is not open, start a new one start = False + history = [] try: history = await handle.query( CustomerServiceWorkflow.get_chat_history, reject_condition=QueryRejectCondition.NOT_OPEN, ) - except WorkflowQueryRejectedError as e: + except WorkflowQueryRejectedError: start = True except RPCError as e: if e.status == RPCStatusCode.NOT_FOUND: diff --git a/openai_agents/run_hello_world_workflow.py b/openai_agents/run_hello_world_workflow.py index ee5dee90..566d525a 100644 --- a/openai_agents/run_hello_world_workflow.py +++ b/openai_agents/run_hello_world_workflow.py @@ -4,7 +4,6 @@ from temporalio.contrib.pydantic import pydantic_data_converter from openai_agents.workflows.hello_world_workflow import HelloWorldAgent -from openai_agents.workflows.research_bot_workflow import ResearchWorkflow async def main(): diff --git a/openai_agents/run_worker.py b/openai_agents/run_worker.py index de2693f4..9dbaef91 100644 --- a/openai_agents/run_worker.py +++ b/openai_agents/run_worker.py @@ -7,6 +7,7 @@ from temporalio.contrib.openai_agents import ( ModelActivity, ModelActivityParameters, + OpenAIAgentsTracingInterceptor, set_open_ai_agent_temporal_overrides, ) from temporalio.contrib.pydantic import pydantic_data_converter @@ -46,6 +47,7 @@ async def main(): ModelActivity().invoke_model_activity, get_weather, ], + interceptors=[OpenAIAgentsTracingInterceptor()], ) await worker.run() diff --git a/openai_agents/workflows/research_agents/research_manager.py b/openai_agents/workflows/research_agents/research_manager.py index 19bdd224..356da1d7 100644 --- a/openai_agents/workflows/research_agents/research_manager.py +++ b/openai_agents/workflows/research_agents/research_manager.py @@ -6,7 +6,7 @@ with workflow.unsafe.imports_passed_through(): # TODO: Restore progress updates - from agents import RunConfig, Runner, custom_span, gen_trace_id, trace + from agents import RunConfig, Runner, custom_span, trace from openai_agents.workflows.research_agents.planner_agent import ( WebSearchItem, @@ -28,8 +28,7 @@ def __init__(self): self.writer_agent = new_writer_agent() async def run(self, query: str) -> str: - trace_id = gen_trace_id() - with trace("Research trace", trace_id=trace_id): + with trace("Research trace"): search_plan = await self._plan_searches(query) search_results = await self._perform_searches(search_plan) report = await self._write_report(query, search_results)