How the Browser Operator Handles Search Engine Configurations in UI-TARS

The DefaultBrowserOperator class automatically navigates to a predefined search engine homepage—Google, Bing, or Baidu—based on a typed enum parameter passed during instantiation, while RemoteBrowserOperator leaves page selection to the remote endpoint.

The UI-TARS desktop client provides a browser operator abstraction that enables automated browser sessions with configurable starting pages. Understanding how the browser operator handles different search engine configurations requires examining the SearchEngine enum definition and the instantiation logic within the operator implementation. The system supports Google, Bing, and Baidu through a type-safe configuration mechanism that maps enum values to specific URLs during operator initialization.

Search Engine Enum Definition

In packages/ui-tars/operators/browser-operator/src/types.ts, the SearchEngine enum defines the supported search providers:

export enum SearchEngine {
  GOOGLE = 'google',
  BAIDU = 'baidu',
  BING = 'bing',
}

This enumeration provides compile-time safety for search engine selection. When developers instantiate the browser operator, they pass one of these enum values to specify which homepage the automated browser should load initially.

Configuration Through the getInstance Method

The DefaultBrowserOperator.getInstance method accepts a searchEngine parameter that defaults to SearchEngine.GOOGLE. Inside packages/ui-tars/operators/browser-operator/src/browser-operator.ts, the implementation constructs a URL mapping and automatically navigates to the corresponding homepage:

const searchEngineUrls = {
  [SearchEngine.GOOGLE]: 'https://www.google.com/',
  [SearchEngine.BING]:   'https://www.bing.com/',
  [SearchEngine.BAIDU]:  'https://www.baidu.com/',
};
const targetUrl = searchEngineUrls[searchEngine];
await openingPage?.goto(targetUrl, { waitUntil: 'networkidle2' });

This logic executes during operator instantiation unless isCallUser is set to true, which suppresses automatic navigation to allow custom URL handling by the caller.

Remote Browser Operator Behavior

Unlike the default implementation, RemoteBrowserOperator does not perform automatic navigation to search engine homepages. This design keeps the remote scenario minimal and avoids hard-coding start pages, leaving page selection entirely to the remote endpoint configuration.

Practical Implementation Examples

Starting with Google (Default)

When no search engine is specified, the operator defaults to Google:

import { DefaultBrowserOperator } from '@ui-tars/operators/browser-operator';

// Defaults to Google search engine
const operator = await DefaultBrowserOperator.getInstance(
  /*highlight=*/ true,
  /*showActionInfo=*/ false,
  /*showWaterFlow=*/ false,
  /*isCallUser=*/ false,
);

Configuring Bing as the Start Page

To start the browser on Bing, pass the SearchEngine.BING enum value:

import { DefaultBrowserOperator } from '@ui-tars/operators/browser-operator';
import { SearchEngine } from '@ui-tars/operators/browser-operator/src/types';

const operator = await DefaultBrowserOperator.getInstance(
  false,
  false,
  false,
  false,
  SearchEngine.BING,
);

Using Baidu for Regional Testing

For Chinese users or regional testing scenarios, specify SearchEngine.BAIDU:

import { DefaultBrowserOperator } from '@ui-tars/operators/browser-operator';
import { SearchEngine } from '@ui-tars/operators/browser-operator/src/types';

const operator = await DefaultBrowserOperator.getInstance(
  false,
  false,
  false,
  false,
  SearchEngine.BAIDU,
);

Skipping Automatic Navigation

To prevent the operator from automatically loading any search engine page, set isCallUser to true:

import { DefaultBrowserOperator } from '@ui-tars/operators/browser-operator';

const operator = await DefaultBrowserOperator.getInstance(
  false,
  false,
  false,
  true,  // isCallUser = true disables auto-navigation
);

This allows the caller to programmatically navigate to a custom URL after instantiation.

Summary

  • The SearchEngine enum in types.ts defines supported providers: Google, Bing, and Baidu.
  • DefaultBrowserOperator.getInstance accepts a searchEngine parameter that maps enum values to predefined URLs via an internal searchEngineUrls object.
  • Automatic navigation occurs during instantiation unless disabled by setting isCallUser to true.
  • RemoteBrowserOperator does not implement search engine auto-navigation, delegating page selection to remote endpoints.
  • Adding new search engines requires extending the enum and updating the URL mapping in browser-operator.ts.

Frequently Asked Questions

How do I add a new search engine to the browser operator?

To add a new search engine, extend the SearchEngine enum in packages/ui-tars/operators/browser-operator/src/types.ts with your desired key, then add the corresponding URL entry to the searchEngineUrls mapping in browser-operator.ts. This ensures type safety and consistent initialization across the UI-TARS desktop client.

Why does RemoteBrowserOperator not support automatic search engine navigation?

The RemoteBrowserOperator implementation intentionally omits auto-navigation logic to maintain a minimal footprint and avoid hard-coding assumptions about the remote endpoint's environment. This design allows the remote server to control the initial page state independently of the client's search engine configuration.

Can I start the browser without loading any search engine page?

Yes. Set the isCallUser parameter to true when calling DefaultBrowserOperator.getInstance. This prevents the automatic goto call to any search engine URL, allowing you to manually navigate to custom pages using the returned operator instance.

What happens if I pass an unsupported search engine value?

The TypeScript compiler enforces the SearchEngine enum type, preventing invalid values at compile time. If you attempt to pass a string or undefined value, the compiler will raise a type error before runtime, ensuring only supported search engines (Google, Bing, Baidu) can be specified.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →