@@ -46,6 +46,7 @@ def activity_as_tool(
4646 versioning_intent : Optional [VersioningIntent ] = None ,
4747 summary : Optional [str ] = None ,
4848 priority : Priority = Priority .default ,
49+ strict_json_schema : bool = True ,
4950) -> Tool :
5051 """Convert a single Temporal activity function to an OpenAI agent tool.
5152
@@ -61,6 +62,8 @@ def activity_as_tool(
6162
6263 Args:
6364 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
6467 For other arguments, refer to :py:mod:`workflow` :py:meth:`start_activity`
6568
6669 Returns:
@@ -151,7 +154,7 @@ async def run_activity(ctx: RunContextWrapper[Any], input: str) -> Any:
151154 description = schema .description or "" ,
152155 params_json_schema = schema .params_json_schema ,
153156 on_invoke_tool = run_activity ,
154- strict_json_schema = True ,
157+ strict_json_schema = strict_json_schema ,
155158 )
156159
157160
@@ -161,6 +164,7 @@ def nexus_operation_as_tool(
161164 service : Type [Any ],
162165 endpoint : str ,
163166 schedule_to_close_timeout : Optional [timedelta ] = None ,
167+ strict_json_schema : bool = True ,
164168) -> Tool :
165169 """Convert a Nexus operation into an OpenAI agent tool.
166170
@@ -177,6 +181,7 @@ def nexus_operation_as_tool(
177181 fn: A Nexus operation to convert into a tool.
178182 service: The Nexus service class that contains the operation.
179183 endpoint: The Nexus endpoint to use for the operation.
184+ strict_json_schema: Whether the tool should follow a strict schema
180185
181186 Returns:
182187 An OpenAI agent tool that wraps the provided operation.
@@ -237,7 +242,7 @@ async def run_operation(ctx: RunContextWrapper[Any], input: str) -> Any:
237242 description = schema .description or "" ,
238243 params_json_schema = schema .params_json_schema ,
239244 on_invoke_tool = run_operation ,
240- strict_json_schema = True ,
245+ strict_json_schema = strict_json_schema ,
241246 )
242247
243248
0 commit comments