Learn how to configure the agent
Agent
class is the core component of Browsernode that handles browser automation. Here are the main configuration options you can use when initializing an agent.
task
: The instruction for the agent to executellm
: A LangChain chat model instance. See LangChain Models for supported models.controller
: Registry of functions the agent can call. Defaults to base Controller. See Custom Functions for details.useVision
: Enable/disable vision capabilities. Defaults to True
.
saveConversationPath
: Path to save the complete conversation history. Useful for debugging.systemPromptClass
: Custom system prompt class. See System Prompt for customization options.overrideSystemMessage
: Completely replace the default system prompt with a custom one.extendSystemMessage
: Add additional instructions to the default system prompt.page
, browserContext
, browser
, browserSession
, or browserProfile
.
These all get passed down to create a BrowserSession
for the Agent
:
BrowserSession
after an agent has completed running.
If you do nothing, the browser will be automatically closed on run()
completion only if it was launched by us.run()
method:
maxSteps
(default: 100
)
Maximum number of steps the agent can take during execution. This prevents infinite loops and helps control execution time.AgentHistoryList
object containing the complete execution history. This history is invaluable for debugging, analysis, and creating reproducible scripts.
AgentHistoryList
provides many helper methods to analyze the execution:
finalResult()
: Get the final extracted contentisDone()
: Check if the agent completed successfullyhasErrors()
: Check if any errors occurredmodelThoughts()
: Get the agent’s reasoning processactionResults()
: Get results of all actionsplannerLLM
: A LangChain chat model instance used for high-level task planning. Can be a smaller/cheaper model than the main LLM.useVisionForPlanner
: Enable/disable vision capabilities for the planner model. Defaults to True
.plannerInterval
: Number of steps between planning phases. Defaults to 1
.messageContext
: Additional information about the task to help the LLM understand the task better.initialActions
: List of initial actions to run before the main task.maxActionsPerStep
: Maximum number of actions to run in a step. Defaults to 10
.maxFailures
: Maximum number of failures before giving up. Defaults to 3
.retryDelay
: Time to wait between retries in seconds when rate limited. Defaults to 10
.generateGif
: Enable/disable GIF generation. Defaults to False
. Set to True
or a string path to save the GIF.mem0
) is no longer needed or supported.
The agent maintains its context and task progress through:
enableMemory
parameter has been removed as the new system provides better context management by default.
enableMemory
, simply remove this parameter. The agent will automatically use the improved context management system.