Skip to main content
The TypeScript SDK is the canonical Webcompute SDK today.
import { Web, WebcomputeError } from "@webcompute/sdk";

const web = new Web({
  apiKey: process.env.WEBCOMPUTE_API_KEY!,
});
This reference covers the SDK entry point, shared configuration, errors, warnings, and export inventory. The deeper references cover:
AreaPage
Browser agentsSDK agent reference
Managed browsers and Playwright executionSDK browser reference
Files, downloads, dialogs, permissions, recordings, events, and CAPTCHASDK resources reference
Deterministic scrape, screenshot, and PDF actionsSDK quick actions reference
Browser navigation policyPolicy reference
Custom proxiesProxy reference
The Python package currently contains a stub module only. Use the TypeScript SDK for the full public SDK surface. Python users should call the REST API directly until the Python SDK graduates from stub status.

Constructor

new Web(options?: Partial<WebcomputeConfig>)
Web exposes browser lifecycle helpers, deterministic quick actions, health checks, and web.agent().
Property or methodSignatureDescription
web.browserWebBrowserResourceManaged browser lifecycle and browser handles.
web.health.check() => Promise<{ status: string; version?: string; uptime?: number }>Gateway health check.
web.scrape(options: ScrapeInput) => Promise<ScrapeResponse>Read a URL through an ephemeral browser.
web.screenshot(options: ScreenshotOptions) => Promise<ScreenshotResponse>Capture an image through an ephemeral browser.
web.pdf(options: PdfOptions) => Promise<PdfResponse>Generate a PDF through an ephemeral browser.
web.agent<TOutput = unknown>(config: WebAgentConfig<TOutput>) => WebAgentCreate a model-backed browser agent.

WebcomputeConfig

FieldTypeDefaultDescription
apiKeystringWEBCOMPUTE_API_KEYWebcompute API key. Required through either explicit config or environment.
serverUrlstringWEBCOMPUTE_SERVER_URL or https://api.webcompute.devGateway base URL. http is accepted only for localhost or loopback hosts.
timeoutMsnumberWEBCOMPUTE_TIMEOUT or 120000Default request timeout in milliseconds.
retryConfigRetryConfigDEFAULT_RETRY_CONFIGRetry behavior for retryable HTTP failures.
debugbooleanWEBCOMPUTE_DEBUG === "true"Enables debug logging.
policyBrowserNavigationPolicyNoneDefault browser policy for browsers and quick actions.
onWarningWarningCallbackNoneCallback invoked once per structured warning returned by Gateway responses. Callback errors are caught and logged only when debug is enabled.

Errors

All SDK HTTP errors extend WebcomputeError.
try {
  const browser = await web.browser.get("browser_missing");
} catch (error) {
  if (error instanceof WebcomputeError) {
    console.error(error.code, error.type, error.next, error.retryable);
  }
}
WebcomputeError fields:
FieldTypeDescription
statusCodenumberHTTP status code.
typeSdkErrorTypeNormalized category such as authentication, not_found, rate_limit, or upstream_timeout.
codeSdkErrorCodeNormalized machine code. Legacy codes are mapped to current codes.
requestIdstring | undefinedRequest ID when provided by the server.
retryablebooleanWhether the SDK considers the error retryable.
nextSdkErrorNextSuggested next action such as authenticate, retry, retry_after, refresh_browser, change_request, contact_support, or abort.
paramstring | undefinedRequest parameter associated with a validation failure when known.
detailsRecord<string, unknown> | nullRedacted structured details.
helpUrlstring | undefinedDocumentation URL for common errors when available.
Exported error classes:
ClassCommon statusDescription
AuthenticationError401Missing or invalid API key.
ValidationError400Invalid request parameters.
NotFoundError404Browser or artifact was not found.
ConflictError409Operation conflicts with current browser state.
RateLimitError429Rate limit or quota backoff case.
PayloadTooLargeError413Request or payload exceeds size limits.
ResourceLimitErrorvariesResource or concurrency limit.
TimeoutError504Upstream timeout.
BrowserUnavailableErrorvariesBrowser runtime is unavailable or unhealthy.
RequestAbortedErrorvariesCaller aborted the request.
ConnectionErrorvariesNetwork or connection failure.
InternalError5xxServer-side failure.
BrowserPolicyTipError400Browser policy produced a blocking policy tip.

Warnings

Gateway responses may include structured warnings. The SDK exposes them in response fields where the response type includes warnings, and can centralize handling through onWarning.
const web = new Web({
  apiKey: process.env.WEBCOMPUTE_API_KEY!,
  onWarning: (warning, context) => {
    console.warn(context.path, warning.code, warning.message);
  },
});
Use parseWarning when you need to normalize unknown warning payloads, and redactValueForObservability before logging data that may contain credentials, tokens, cookies, proxy URLs, signed URLs, or local file paths.

Export inventory

This inventory is generated from packages/sdk-typescript/src/index.ts and grouped by reader task.

Client and config

Web, WebcomputeConfig, RetryConfig, DEFAULT_RETRY_CONFIG, ErrorResponseBody.

Agent exports

WebAgent, WebAgentApprovalMode, WebAgentApprovalRisk, WebAgentArtifact, WebAgentArtifactOptions, WebAgentBrowserConfig, WebAgentCaptchaResolutionOptions, WebAgentCaptchaResolutionSummary, WebAgentCaptureOptions, WebAgentCodePolicy, WebAgentConfig, WebAgentConfirmationDecision, WebAgentConfirmationHandler, WebAgentConfirmationRequest, WebAgentEnvironment, WebAgentError, WebAgentJsonSchemaObject, WebAgentModelAccessFlags, WebAgentModelConfig, WebAgentModelProfile, WebAgentModelProfileConfig, WebAgentModelRoute, WebAgentRawJsonSchema, WebAgentResult, WebAgentRoute, WebAgentRunInput, WebAgentSchema, WebAgentSchemaIssue, WebAgentSchemaMetadata, WebAgentSchemaValidationResult, WebAgentSession, WebAgentStandardSchema, WebAgentStep, WebAgentStreamEvent, WebAgentTranscriptItem, WebAgentToolCall, WebAgentToolCompletionSummary, WebAgentToolProgressReturnedSummary, WebAgentToolProgressSummary, WebAgentToolResult, WebAgentToolResultSummary, WebAgentToolResultSummaryItem, WebAgentUsage, WebAgentVariable, WebAgentVariables, WebAgentZodLikeSchema. Agent helper exports: inferWebAgentModelRoute, normalizeOutputSchema, normalizeWebAgentModelProfile, parseWebAgentModelRoute, resolveWebAgentModelAccess, WEB_AGENT_APPROVAL_RISK_VALUES, webAgentModelConfigForAccess, webAgentModelSetupMessage. Model-profile helpers work with profile-shaped config supplied by application code. They do not load CLI model profiles automatically; see SDK agent reference for explicit agent model config.

Model profile exports

NormalizedWebAgentModelProfile, ResolvedWebAgentModelAccess, ResolveWebAgentModelAccessOptions.

Browser and runtime exports

Browser, BrowserId, BrowserArtifactListOptions, BrowserCaptcha, BrowserCaptchaResolveOptions, BrowserCreateOptions, BrowserDialogs, BrowserDownloadSaveOptions, BrowserDownloadSaveResult, BrowserDownloads, BrowserEvent, BrowserEventCategory, BrowserEventSeverity, BrowserEventStreamOptions, BrowserEventsOptions, BrowserEventType, BrowserEventVisibility, BrowserFiles, BrowserLifecycleMeta, BrowserLifecycleResponse, BrowserListOptions, BrowserListResponse, BrowserNavigationPolicy, BrowserPageSummary, BrowserPermissions, BrowserPlaywright, BrowserPlaywrightActivityCaptureOptions, BrowserPlaywrightExecuteOptions, BrowserPlaywrightExecuteRequest, BrowserPlaywrightExecuteResponse, BrowserPlaywrightExecutionActivity, BrowserRecordings, BrowserRuntimeStatusSummary, BrowserStatusOptions, BrowserStatusResponse, CreateBrowserFileFromPathOptions, CreateBrowserFileOptions, FileId, PageId, RecordingDownloadResult, RecordingEventsOptions, RecordingListOptions, WebBrowserResource.

Policy and warning exports

BrowserPolicyMode, BrowserPolicyTip, BrowserPrivateAccess, WebcomputeWarning, ParsedWarning, WarningCallback, parseWarning, RedactValueForObservabilityOptions, redactValueForObservability.

Error exports

AuthenticationError, BrowserPolicyTipError, BrowserUnavailableError, ConflictError, ConnectionError, InternalError, mapResponseToError, NotFoundError, PayloadTooLargeError, RateLimitError, RequestAbortedError, ResourceLimitError, TimeoutError, ValidationError, WebcomputeError.