Stagehand icon

Stagehand

Control browser using Stagehand with AI automation

Close Session

AI-generated

Summary

Close the active browser session managed by Stagehand, releasing all associated resources and clearing the session state for the current workflow.

Inputs

  • AI Provider — Selects the AI provider for operations that require AI context, though this parameter is unused in the close session operation itself.
  • Advanced Options — Optional settings such as model selection, caching, logging verbosity, timeouts, and resource blocking, which have no direct effect on closing the session but exist for uniformity across operations.

Output shape

A single JSON object indicating success of the close session operation, optionally including Stagehand logs if enabled.

The output includes fields: operation (value 'closeSession'), success (boolean), and message (string confirming session closure). If logging is enabled, log messages are included. The operation clears the session state internally, so subsequent operations will require re-initialization via a navigate call.

Examples

Example 1: Close an existing Stagehand browser session to free resources after completing automated browsing tasks.

Set operation to 'Close Session'. AI Provider and advanced options may be left as default or configured uniformly with previous operations in the workflow.

Discussion