Skip to content

OpenAI Agents plugin doesn't support apply_patch with SandboxAgent #1561

@guadalupe-duolingo

Description

@guadalupe-duolingo

What are you really trying to do?

I’m trying to run OpenAI Agents SDK SandboxAgents through the Temporal plugin.
The agent uses the OpenAI Agents SDK sandbox filesystem capability. Filesystem() exposes SandboxApplyPatchTool by default for editing files in the sandbox workspace.

Describe the bug

temporalio.contrib.openai_agents fails when a SandboxAgent exposes the default sandbox apply_patch tool.

The failure is:

Unsupported tool type: apply_patch
The issue appears to be that the OpenAI Agents SDK sandbox filesystem capability has the SandboxApplyPatchTool tool but it's not supported by the Temporal plugin so an error is raised while serializing tools before the model activity is scheduled.

The relevant failure path is in:
temporalio/contrib/openai_agents/_temporal_model_stub.py
Specifically, make_tool_info(...) falls through to:
raise ValueError(f"Unsupported tool type: {tool.name}")

Minimal Reproduction

from __future__ import annotations

import asyncio
from datetime import timedelta

from agents import ModelSettings, ModelTracing
from agents.sandbox.capabilities.tools import SandboxApplyPatchTool
from temporalio.contrib.openai_agents._model_parameters import ModelActivityParameters
from temporalio.contrib.openai_agents._temporal_model_stub import _TemporalModelStub


class FakeSandboxSession:
    pass


async def main() -> None:
    tool = SandboxApplyPatchTool(session=FakeSandboxSession())
    model = _TemporalModelStub(
        "gpt-5.5",
        model_params=ModelActivityParameters(start_to_close_timeout=timedelta(seconds=1)),
        agent=None,
    )

    print(f"Tool class: {tool.__class__.__module__}.{tool.__class__.__name__}")
    print(f"Tool name: {tool.name}")
    print(f"Tool type: {tool.type}")
    print("Calling Temporal model stub with sandbox apply_patch tool...")

     await model.get_response(
          system_instructions="You are a test agent.",
          input="hello",
          model_settings=ModelSettings(),
          tools=[tool],
          output_schema=None,
          handoffs=[],
          tracing=ModelTracing.DISABLED,
          previous_response_id=None,
          conversation_id=None,
          prompt=None,
      )

asyncio.run(main())

Environment/Versions

OS and processor: M3 Max Mac
Temporal Python SDK: temporalio==1.27.0
OpenAI Agents SDK: openai-agents==0.15.2

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions