langchain.js
    Preparing search index...
    • Creates and configures a Computer Use Agent.

      Type Parameters

      • StateModifier extends AnnotationRoot<any> = any

      Parameters

      • params: {
            authStateId?: string;
            environment?: "web" | "ubuntu" | "windows";
            nodeAfterAction?: (
                state: any,
                config: LangGraphRunnableConfig<any>,
            ) => Promise<any>;
            nodeBeforeAction?: (
                state: any,
                config: LangGraphRunnableConfig<any>,
            ) => Promise<any>;
            prompt?: string | SystemMessage<MessageStructure>;
            recursionLimit?: number;
            scrapybaraApiKey?: string;
            stateModifier?: StateModifier;
            timeoutHours?: number;
            uploadScreenshot?: (screenshot: string) => Promise<string>;
            zdrEnabled?: boolean;
        } = {}

        The parameters for the Computer Use Agent.

        • OptionalauthStateId?: string

          The ID of the authentication state. If defined, it will be used to authenticate with Scrapybara. Only applies if 'environment' is set to 'web'.

          undefined
          
        • Optionalenvironment?: "web" | "ubuntu" | "windows"

          The environment to use.

          "web"
          
        • OptionalnodeAfterAction?: (state: any, config: LangGraphRunnableConfig<any>) => Promise<any>

          A custom node to run after the computer action.

          undefined
          
        • OptionalnodeBeforeAction?: (state: any, config: LangGraphRunnableConfig<any>) => Promise<any>

          A custom node to run before the computer action.

          undefined
          
        • Optionalprompt?: string | SystemMessage<MessageStructure>

          The prompt to use for the model. This will be used as the system prompt for the model.

          undefined
          
        • OptionalrecursionLimit?: number

          The maximum number of recursive calls the agent can make.

          100
          
        • OptionalscrapybaraApiKey?: string

          The API key to use for Scrapybara. This can be provided in the configuration, or set as an environment variable (SCRAPYBARA_API_KEY).

          process.env.SCRAPYBARA_API_KEY
          
        • OptionalstateModifier?: StateModifier

          Optional state modifier for customizing the agent's state.

          undefined
          
        • OptionaltimeoutHours?: number

          The number of hours to keep the virtual machine running before it times out. Must be between 0.01 and 24.

          1
          
        • OptionaluploadScreenshot?: (screenshot: string) => Promise<string>

          A custom function to handle uploading screenshots to an external store, instead of saving them as base64 in state. Must accept a base64 string and return a URL.

          undefined
          
        • OptionalzdrEnabled?: boolean

          Whether or not Zero Data Retention is enabled in the user's OpenAI account. If true, the agent will not pass the 'previous_response_id' to the model, and will always pass it the full message history for each request. If false, the agent will pass the 'previous_response_id' to the model, and only the latest message in the history will be passed.

          false
          

      Returns any

      The configured graph.