MCPcopy
hub / github.com/openai/openai-agents-python / function_tool

Function function_tool

src/agents/tool.py:1851–1872  ·  view source on GitHub ↗

Overload for usage as @function_tool (no parentheses).

(
    func: ToolFunction[...],
    *,
    name_override: str | None = None,
    description_override: str | None = None,
    docstring_style: DocstringStyle | None = None,
    use_docstring_info: bool = True,
    failure_error_function: ToolErrorFunction | None = None,
    strict_mode: bool = True,
    is_enabled: bool | Callable[[RunContextWrapper[Any], AgentBase], MaybeAwaitable[bool]] = True,
    needs_approval: bool
    | Callable[[RunContextWrapper[Any], dict[str, Any], str], Awaitable[bool]] = False,
    tool_input_guardrails: list[ToolInputGuardrail[Any]] | None = None,
    tool_output_guardrails: list[ToolOutputGuardrail[Any]] | None = None,
    timeout: float | None = None,
    timeout_behavior: ToolTimeoutBehavior = "error_as_result",
    timeout_error_function: ToolErrorFunction | None = None,
    defer_loading: bool = False,
    custom_data_extractor: FunctionToolCustomDataExtractor | None = None,
)

Source from the content-addressed store, hash-verified

1849
1850@overload
1851def function_tool(
1852 func: ToolFunction[...],
1853 *,
1854 name_override: str | None = None,
1855 description_override: str | None = None,
1856 docstring_style: DocstringStyle | None = None,
1857 use_docstring_info: bool = True,
1858 failure_error_function: ToolErrorFunction | None = None,
1859 strict_mode: bool = True,
1860 is_enabled: bool | Callable[[RunContextWrapper[Any], AgentBase], MaybeAwaitable[bool]] = True,
1861 needs_approval: bool
1862 | Callable[[RunContextWrapper[Any], dict[str, Any], str], Awaitable[bool]] = False,
1863 tool_input_guardrails: list[ToolInputGuardrail[Any]] | None = None,
1864 tool_output_guardrails: list[ToolOutputGuardrail[Any]] | None = None,
1865 timeout: float | None = None,
1866 timeout_behavior: ToolTimeoutBehavior = "error_as_result",
1867 timeout_error_function: ToolErrorFunction | None = None,
1868 defer_loading: bool = False,
1869 custom_data_extractor: FunctionToolCustomDataExtractor | None = None,
1870) -> FunctionTool:
1871 """Overload for usage as @function_tool (no parentheses)."""
1872 ...
1873
1874
1875@overload

Calls 1

_create_function_toolFunction · 0.85