Skip to content

[Bug] openai_agents: FunctionTool metadata (defer_loading, namespace, ...) is lost in the model activity; some hosted tools hang the workflow #52

Closed

Description

@avanish-garg

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

from agents import function_tool, ToolSearchTool
from agents.tool import tool_namespace

@function_tool(defer_loading=True)
def deferred(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.

(Same result on openai-agents 0.22.3 and 0.23.1.)

Environment/Versions
macOS arm64, Python 3.11, temporalio 1.34.0, openai-agents 0.22.3 / 0.23.1, plugin at main.

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

  1. added
    bug
    on Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions