Skip to content

Commit 25fd5fe

Browse files
committed
cleanup
1 parent 57b9d63 commit 25fd5fe

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

openai_agents/customer_service/workflows/customer_service_workflow.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,21 @@ def __init__(
5555
self.input_items = (
5656
customer_service_state.input_items if customer_service_state else []
5757
)
58-
self.continue_as_new_suggested = False
5958

6059
@workflow.run
6160
async def run(
6261
self, customer_service_state: CustomerServiceWorkflowState | None = None
6362
):
6463
await workflow.wait_condition(
65-
# lambda: workflow.info().is_continue_as_new_suggested()
66-
# and
67-
lambda: self.continue_as_new_suggested
64+
lambda: workflow.info().is_continue_as_new_suggested()
6865
and workflow.all_handlers_finished()
6966
)
70-
# Convert input_items to plain dictionaries for serialization
71-
serializable_input_items = []
72-
for item in self.input_items:
73-
if hasattr(item, "model_dump") and callable(getattr(item, "model_dump")):
74-
# Convert Pydantic objects to dictionaries
75-
serializable_input_items.append(item.model_dump()) # type: ignore
76-
else:
77-
# Already a plain Python object
78-
serializable_input_items.append(item)
7967
workflow.continue_as_new(
8068
CustomerServiceWorkflowState(
8169
printed_history=self.printed_history,
8270
current_agent_name=self.current_agent.name,
8371
context=self.context,
84-
input_items=serializable_input_items,
72+
input_items=self.input_items,
8573
)
8674
)
8775

@@ -130,7 +118,6 @@ async def process_user_message(self, input: ProcessUserMessageInput) -> list[str
130118
self.current_agent = result.last_agent
131119
workflow.set_current_details("\n\n".join(self.printed_history))
132120

133-
self.continue_as_new_suggested = True
134121
return self.printed_history[length:]
135122

136123
@process_user_message.validator

0 commit comments

Comments
 (0)