GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ADK for TypeScript: API Reference

This view

  • Original page
  • New address

GeezerVison is showing adk.dev — ComputerUseTool | ADK for TypeScript: API Reference - v2.5.0

  • ComputerUseTool

Class ComputerUseTool

A tool that wraps computer control functions for use with LLMs.

This tool scales coordinates from a virtual coordinate space (by default 1000x1000) to the actual screen size. This lets the model work with a consistent coordinate system regardless of the actual screen dimensions, which makes its output more predictable.

When the wrapped function returns a ComputerState, the tool returns {image: {mimetype, data}, url} with the screenshot base64-encoded; the agent then sends the image to the model as part of the function response.

When the model marks a call with a safety_decision of require_confirmation, the tool asks the user to confirm before it runs and adds safety_acknowledgement: 'true' to the response once confirmed.

Hierarchy (View Summary)

  • FunctionTool<Schema>
    • ComputerUseTool
  • Defined in core/src/tools/computer_use/computer_use_tool.ts:110

Constructors

constructor

  • new ComputerUseTool(options: ComputerUseToolOptions): ComputerUseTool

    Parameters

    • options: ComputerUseToolOptions

      The options for the tool.

    Returns ComputerUseTool

    Throws

    If screenSize or virtualScreenSize is not a pair of positive numbers.

    Overrides FunctionTool.constructor

    • Defined in core/src/tools/computer_use/computer_use_tool.ts:126

Properties

Readonly[BASE_TOOL_SIGNATURE_SYMBOL]

"[BASE_TOOL_SIGNATURE_SYMBOL]": true

A unique symbol to identify ADK base tool class.

Inherited from FunctionTool.[BASE_TOOL_SIGNATURE_SYMBOL]

  • Defined in core/src/tools/base_tool.ts:83

Readonly[COMPUTER_USE_TOOL_SIGNATURE_SYMBOL]

"[COMPUTER_USE_TOOL_SIGNATURE_SYMBOL]": true

A unique symbol to identify ADK computer use tool class.

  • Defined in core/src/tools/computer_use/computer_use_tool.ts:112

Readonly[FUNCTION_TOOL_SIGNATURE_SYMBOL]

"[FUNCTION_TOOL_SIGNATURE_SYMBOL]": true

A unique symbol to identify ADK function tool class.

Inherited from FunctionTool.[FUNCTION_TOOL_SIGNATURE_SYMBOL]

  • Defined in core/src/tools/function_tool.ts:220

Readonlydescription

description: string

Inherited from FunctionTool.description

  • Defined in core/src/tools/base_tool.ts:86

Readonlyfunc

func: ComputerUseFunction

The wrapped computer control function.

  • Defined in core/src/tools/computer_use/computer_use_tool.ts:115

ReadonlyisLongRunning

isLongRunning: boolean

Inherited from FunctionTool.isLongRunning

  • Defined in core/src/tools/base_tool.ts:87

Readonlyname

name: string

Inherited from FunctionTool.name

  • Defined in core/src/tools/base_tool.ts:85

ReadonlyscreenSize

screenSize: readonly [number, number]

The actual screen size as (width, height) in pixels.

  • Defined in core/src/tools/computer_use/computer_use_tool.ts:117

ReadonlyvirtualScreenSize

virtualScreenSize: readonly [number, number]

The virtual coordinate space as (width, height).

  • Defined in core/src/tools/computer_use/computer_use_tool.ts:119

Accessors

apiVariant

  • get apiVariant(): GoogleLLMVariant

    The Google API LLM variant to use.

    Returns GoogleLLMVariant

    Inherited from FunctionTool.apiVariant

    • Defined in core/src/tools/base_tool.ts:198

Methods

_callLive

  • _callLive(req: CallLiveToolRequest): AsyncGenerator<unknown, void, void>

    Invokes the tool in live streaming mode, injecting any active input stream from the invocation context and yielding items from the returned stream.

    Parameters

    • req: CallLiveToolRequest

      The live tool invocation request.

    Returns AsyncGenerator<unknown, void, void>

    Inherited from FunctionTool._callLive

    • Defined in core/src/tools/function_tool.ts:309

_getDeclaration

  • _getDeclaration(): FunctionDeclaration

    Returns the function declaration derived from the tool's name, description, and parameter schema.

    Returns FunctionDeclaration

    Inherited from FunctionTool._getDeclaration

    • Defined in core/src/tools/function_tool.ts:257

checkRequireConfirmation

  • checkRequireConfirmation(
        args: Record<string, unknown>,
        toolContext?: Context,
    ): Promise<boolean>

    Whether this call needs user confirmation: when the model marked it with a safety_decision of require_confirmation, or when the base tool says so.

    Parameters

    • args: Record<string, unknown>

      The arguments the tool would run with.

    • OptionaltoolContext: Context

      The context of the call, when there is one.

    Returns Promise<boolean>

    Whether the call requires confirmation.

    Overrides FunctionTool.checkRequireConfirmation

    • Defined in core/src/tools/computer_use/computer_use_tool.ts:212

processLlmRequest

  • processLlmRequest(_request: ToolProcessLlmRequest): Promise<void>

    Adds nothing to the request: ComputerUseToolset adds the single computer use configuration and registers its tools by name.

    Parameters

    • _request: ToolProcessLlmRequest

    Returns Promise<void>

    Overrides FunctionTool.processLlmRequest

    • Defined in core/src/tools/computer_use/computer_use_tool.ts:226

runAsync

  • runAsync(request: RunAsyncToolRequest): Promise<unknown>

    Runs the computer control function with scaled coordinates.

    Parameters

    • request: RunAsyncToolRequest

      The tool request containing arguments and tool context.

    Returns Promise<unknown>

    The function's result, with a ComputerState converted to a response carrying the base64-encoded screenshot.

    Throws

    If a coordinate is not numeric, or the function returns a state with no screenshot.

    Overrides FunctionTool.runAsync

    • Defined in core/src/tools/computer_use/computer_use_tool.ts:154
Constructors
constructor
Properties
[BASE_TOOL_SIGNATURE_SYMBOL][COMPUTER_USE_TOOL_SIGNATURE_SYMBOL][FUNCTION_TOOL_SIGNATURE_SYMBOL]descriptionfuncisLongRunningnamescreenSizevirtualScreenSize
Accessors
apiVariant
Methods
_callLive_getDeclarationcheckRequireConfirmationprocessLlmRequestrunAsync
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.