[Bug]: function-call "computer" tool calls are never executed — ToolError: Function computer not found
Primary area
MCP or agent integration
Summary
When ComputerAgent's configured model routes to the function-calling "computer" tool schema (_is_native_computer_use_model() returns False — any model not literally matching computer-use-preview), every resulting function_call named "computer" fails with ToolError: Function computer not found. The tool schema is built correctly and the model calls it correctly, but there is no execution path for it — _get_tool() only looks up user-registered custom tools, not the native computer-action semantics that computer_call-type items get.
Reproduction
- Construct a
ComputerAgentwith a model that does not matchcomputer-use-preview(e.g.openai/gpt-5.4, or any newer OpenAI model whose name isn'tcomputer-use-preview) and a realcomputertool via a computer handler, soopenai.py's loop selects the function-calling schema (_map_computer_tool_to_openai(use_native_tool=False)). - Run any task that needs a UI action, e.g. "Open a terminal and check the Python version."
- Observe the model correctly call the
computerfunction with well-formed arguments (verified independently with a rawPOST /v1/responsescall against the same tool schema — the model returns{"type": "function_call", "name": "computer", "arguments": {"action": "screenshot", ...}}correctly). - Watch the agent loop dispatch that
function_callitem.
Expected behavior
The function_call named "computer" executes the requested action (click/type/screenshot/keypress/etc.) against the computer handler, the same way a native computer_call item would.
Actual behavior
agent.py's dispatch loop raises ToolError:
# libs/python/agent/cua_agent/agent.py (same on PyPI 0.8.4 and current `main`, lines 850-855)
if item_type == "function_call":
await self._on_function_call_start(item)
function = self._get_tool(item.get("name"))
if not function:
raise ToolError(f"Function {item.get('name')} not found")
_get_tool() (same file, ~line 598) only searches self.tools for a caller-registered BaseTool/callable matching the name — "computer" is never registered there, since the built-in computer-action handling is normally reached only through the separate computer_call item type (handled at ~line 753), not function_call. So every function-call-style computer invocation raises ToolError, which is caught and fed back to the model as a tool error. After one or two such failures the model typically gives up and reports the tool as unavailable — an accurate description of what actually happened, from its perspective.
This means the function-calling harness added for GPT-5.4 support (#1150) has never actually been able to execute a computer action — only the native computer_use_preview path (models literally named computer-use-preview) works.
Environment
- Cua component and version/commit:
cua-agent0.8.4 (PyPI, latest); confirmed the same code is present onmainat commit visible viarepos/trycua/cua/contents/libs/python/agent/cua_agent/agent.pyas of 2026-09. - Operating system and architecture: macOS (client driving the agent loop); target sandbox was an E2B Linux desktop sandbox (Ubuntu), reached via
gl-computer-use(a downstream SDK: https://github.com/GDP-ADMIN/gl-sdk/tree/main/libs/gl-computer-use). - Application/browser/window system/image: N/A — desktop automation via the
computertool against a remote Linux desktop sandbox.
Evidence
Confirmed via three independent checks:
- Raw API call (bypassing
cua-agententirely) —POST /v1/responseswithmodelset to a non-computer-use-previewOpenAI model and the same function-tool schema_map_computer_tool_to_openai(use_native_tool=False)builds — the model returns a correctfunction_call:{"type": "function_call", "name": "computer", "arguments": "{\"action\":\"screenshot\"}", ...} - Full agent loop trace — the same well-formed
function_callitems are visible in the loop's output (e.g.{'arguments': '{"action":"keypress",...,"keys":["ctrl","alt","t"],...,"status":"success"}', 'name': 'computer', 'type': 'function_call', 'status': 'completed'}— a "computer" function_call the model believes succeeded), yet the task's final text output reports the tool as unavailable, because it never actually ran. - Source read —
_get_tool()implementation confirmed to only checkself.tools(a caller-supplied list of custom tools), with no special-casing for"computer". No fork or private modification was made anywhere in this chain; onlycua-agentas installed from PyPI was exercised.
None of the above involves credentials, private data, or sensitive screenshots — evidence is limited to tool schemas, function-call payloads, and source excerpts.
Workaround and additional context
- No workaround exists for the
cua-agent(ComputerAgent) path itself for affected models — switching to a different agent framework (e.g. Agent-S/gui-agents) sidesteps it, since that framework calls providers generically rather than through this per-model dispatch table, but that's a different library, not a fix here. - Confirmed the native
computer_use_previewtool type is genuinely unsupported by at least one such model on a live account (400 "Tool 'computer_use_preview' is not supported with <model>."), so for models in this situation, function-calling is the only valid tool format — making this dispatch gap a hard blocker for actual computer-use with those models, not just a fallback-path nicety. - Related: #2136 (asking about a newer native
computertool flow for a different model) references the function-call harness path as an existing mode without mentioning it doesn't execute — this issue may be relevant context there too. - Suspected fix location: in the
item_type == "function_call"branch of the dispatch loop, special-caseitem.get("name") == "computer"to route through the same execution logic already used for nativecomputer_callitems, instead of falling through to_get_tool(). - Discovered and reported via GDP-ADMIN/gl-sdk#6521, a downstream SDK that wraps
cua-agent.
Opened #3633 for this.
Implemented the fix location you suspected: a function_call named computer now routes through the same action semantics as a native computer_call (shared _execute_computer_action, so the two item types can't drift). Notes on the details that turned out to matter:
- Both argument shapes are accepted — the flat schema the function tool advertises, and the native action dict that
replace_failed_computer_calls_with_function_callsre-emits. - Flat
start_x/start_y/end_x/end_ydrags map onto the handler'spath; null and non-applicable fields are dropped, since the flat parameter object is shared by every action (your trace'skeypresscarryingstatus: "success"would otherwise fail argument validation). - The reply is a
function_call_output, not acomputer_call_output— the model holds the function tool, notcomputer_use_preview. That output is text-only, so the post-action screenshot is delivered as its own user message, andImageRetentionCallbacknow trims those captures too. - A caller-registered tool named
computerstill takes precedence.
13 new tests; verified 11 of them fail on unmodified main (the 2 that pass are the deliberate no-change guards). Full agent suite green.