@@ -46,6 +46,7 @@ def activity_as_tool(
46
46
versioning_intent : Optional [VersioningIntent ] = None ,
47
47
summary : Optional [str ] = None ,
48
48
priority : Priority = Priority .default ,
49
+ strict_json_schema : bool = True ,
49
50
) -> Tool :
50
51
"""Convert a single Temporal activity function to an OpenAI agent tool.
51
52
@@ -61,6 +62,8 @@ def activity_as_tool(
61
62
62
63
Args:
63
64
fn: A Temporal activity function to convert to a tool.
65
+ strict_json_schema: Whether the tool should follow a strict schema.
66
+ See https://openai.github.io/openai-agents-python/ref/tool/#agents.tool.FunctionTool.strict_json_schema
64
67
For other arguments, refer to :py:mod:`workflow` :py:meth:`start_activity`
65
68
66
69
Returns:
@@ -151,7 +154,7 @@ async def run_activity(ctx: RunContextWrapper[Any], input: str) -> Any:
151
154
description = schema .description or "" ,
152
155
params_json_schema = schema .params_json_schema ,
153
156
on_invoke_tool = run_activity ,
154
- strict_json_schema = True ,
157
+ strict_json_schema = strict_json_schema ,
155
158
)
156
159
157
160
@@ -161,6 +164,7 @@ def nexus_operation_as_tool(
161
164
service : Type [Any ],
162
165
endpoint : str ,
163
166
schedule_to_close_timeout : Optional [timedelta ] = None ,
167
+ strict_json_schema : bool = True ,
164
168
) -> Tool :
165
169
"""Convert a Nexus operation into an OpenAI agent tool.
166
170
@@ -177,6 +181,7 @@ def nexus_operation_as_tool(
177
181
fn: A Nexus operation to convert into a tool.
178
182
service: The Nexus service class that contains the operation.
179
183
endpoint: The Nexus endpoint to use for the operation.
184
+ strict_json_schema: Whether the tool should follow a strict schema
180
185
181
186
Returns:
182
187
An OpenAI agent tool that wraps the provided operation.
@@ -237,7 +242,7 @@ async def run_operation(ctx: RunContextWrapper[Any], input: str) -> Any:
237
242
description = schema .description or "" ,
238
243
params_json_schema = schema .params_json_schema ,
239
244
on_invoke_tool = run_operation ,
240
- strict_json_schema = True ,
245
+ strict_json_schema = strict_json_schema ,
241
246
)
242
247
243
248
0 commit comments