Skip to content

Commit a0eb654

Browse files
committed
Fixed sandbox errors by explicitly passing through the __exit__ call.
1 parent d7c1556 commit a0eb654

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

langchain/langchain_interceptor.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ async def execute_workflow(
126126
# return await self.next.execute_workflow(input)
127127
with workflow.unsafe.sandbox_unrestricted():
128128
t = trace(name=f"execute_workflow:{name}", run_id=workflow.info().run_id)
129+
with workflow.unsafe.imports_passed_through():
130+
t.__enter__()
129131
try:
130132
return await self.next.execute_workflow(input)
131133
finally:
@@ -143,7 +145,8 @@ def start_activity(
143145
) -> workflow.ActivityHandle:
144146
with workflow.unsafe.sandbox_unrestricted():
145147
t = trace(name=f"start_activity:{input.activity}", run_id=workflow.uuid4())
146-
t.__enter__()
148+
with workflow.unsafe.imports_passed_through():
149+
t.__enter__()
147150
try:
148151
set_header_from_context(input, workflow.payload_converter())
149152
return self.next.start_activity(input)
@@ -156,6 +159,9 @@ async def start_child_workflow(
156159
) -> workflow.ChildWorkflowHandle:
157160
with workflow.unsafe.sandbox_unrestricted():
158161
t = trace(name=f"start_child_workflow:{input.workflow}", run_id=workflow.uuid4())
162+
with workflow.unsafe.imports_passed_through():
163+
t.__enter__()
164+
159165
try:
160166
set_header_from_context(input, workflow.payload_converter())
161167
return await self.next.start_child_workflow(input)

0 commit comments

Comments
 (0)