You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] openai_agents: FunctionTool metadata (defer_loading, namespace, ...) is lost in the model activity; some hosted tools hang the workflow #52
What are you really trying to do?
Use OpenAI Agents tool search with the Temporal plugin: function tools marked defer_loading=True,
grouped with tool_namespace(...), plus ToolSearchTool().
Describe the bug FunctionToolInput carries only name, description, params_json_schema and strict_json_schema,
so everything else on a FunctionTool is dropped when the tools cross the activity boundary
(_temporal_model_stub.make_tool_info -> _invoke_model_activity._build_tool): defer_loading, the tool namespace, allowed_callers, output_json_schema.
Observed by comparing the Responses tool payload from the original tools with the payload built from the
activity input, and with a mock-transport OpenAIResponsesModel in a real workflow:
namespaced tool: payload differs, the namespace wrapper is gone
[deferred_function_tool, ToolSearchTool()]: fails in the activity with UserError: ToolSearchTool() requires at least one searchable Responses surface
(the deferred tool arrives without defer_loading)
Separately, these tools fail while building the activity input and, because that fails the workflow task, the workflow hangs until its timeout instead of failing:
LocalShellTool(executor=fn): PydanticSerializationError: Unable to serialize unknown type: <class 'function'>
ProgrammaticToolCallingTool(): ValueError: Unsupported tool type: programmatic_tool_calling
(ComputerTool takes the same path)
CustomTool already round-trips defer_loading (sdk-python #1570, closing #1561) and ToolSearchTool
is passed through; FunctionTool is the missing sibling. Nothing in the plugin's tests covers tool_namespace, LocalShellTool, ComputerTool or ProgrammaticToolCallingTool.
Minimal Reproduction
fromagentsimportfunction_tool, ToolSearchToolfromagents.toolimporttool_namespace@function_tool(defer_loading=True)defdeferred(x: int) ->str:
"deferred tool"return"x"# Agent(tools=[deferred, ToolSearchTool()]) run through Runner.run inside a workflow with the plugin# -> UserError in the model activity.# tools=[tool_namespace(name="crm", description="crm tools", tools=[plain])] -> namespace lost.
Additional context
I have a fix (optional fields on FunctionToolInput with defaults, so recorded histories still decode;
and a clear non-retryable AgentsWorkflowError for tools that cannot cross the activity boundary).
Question for maintainers: is failing fast on LocalShellTool the behaviour you want, or would you
rather support it the way ShellTool is handled? The README already lists it as unsupported, so I
kept it unsupported.
Activity