1- from typing import Any , Callable
1+ from typing import Any , Callable , Optional
22
33from agents import (
44 Agent ,
1717from durable_ai_agent_context import DurableAIAgentContext
1818
1919
20- def activity_as_tool (context : DurableAIAgentContext , activity_func : Callable ) -> Tool :
20+ def activity_as_tool (
21+ context : DurableAIAgentContext ,
22+ activity_func : Callable ,
23+ * ,
24+ description : Optional [str ] = None ,
25+ ) -> Tool :
2126 """
2227 Convert an Azure Durable Functions activity to an OpenAI Agents SDK Tool.
23-
28+
2429 Args:
2530 activity_func: The Azure Functions activity function to convert
26-
31+
2732 Returns:
2833 Tool: An OpenAI Agents SDK Tool object
2934 """
@@ -38,14 +43,14 @@ async def run_activity(ctx: RunContextWrapper[Any], input: str) -> Any:
3843 func = activity_func ._function ._func ,
3944 name_override = activity_name ,
4045 docstring_style = None ,
41- description_override = None ,
42- use_docstring_info = False ,
46+ description_override = description ,
47+ use_docstring_info = True ,
4348 strict_json_schema = False ,
4449 )
4550
4651 return FunctionTool (
47- name = activity_name ,
48- description = "" ,
52+ name = schema . name ,
53+ description = schema . description or "" ,
4954 params_json_schema = schema .params_json_schema ,
5055 on_invoke_tool = run_activity ,
5156 strict_json_schema = False ,
0 commit comments