MCPcopy Create free account
hub / github.com/openai/openai-agents-python / ComputerTool

Class ComputerTool

src/agents/tool.py:715–743  ·  view source on GitHub ↗

A local computer harness exposed through the Responses API computer tool.

Source from the content-addressed store, hash-verified

713
714@dataclass(eq=False)
715class ComputerTool(Generic[ComputerT]):
716 """A local computer harness exposed through the Responses API computer tool."""
717
718 computer: ComputerT | ComputerCreate[ComputerT] | ComputerProvider[ComputerT]
719 """The computer implementation, or a factory that produces a computer per run."""
720
721 on_safety_check: Callable[[ComputerToolSafetyCheckData], MaybeAwaitable[bool]] | None = None
722 """Optional callback to acknowledge computer tool safety checks."""
723
724 custom_data_extractor: ComputerToolCustomDataExtractor | None = field(
725 default=None,
726 kw_only=True,
727 )
728 """Optional callback that attaches SDK-only custom data to the tool output item."""
729
730 def __post_init__(self) -> None:
731 _store_computer_initializer(self)
732
733 @property
734 def name(self):
735 # Keep the released preview-era runtime name for hooks and persisted
736 # RunState compatibility. The Responses serializer selects the actual
737 # wire tool type separately.
738 return "computer_use_preview"
739
740 @property
741 def trace_name(self):
742 # Tracing should display the GA tool alias even while runtime names preserve compatibility.
743 return "computer"
744
745
746@dataclass

Calls

no outgoing calls