Browser Use
Learn how to use Julep browser automation capabilities
Overview
This tutorial demonstrates how to:
- Set up browser automation with Julep
- Navigate web pages programmatically
- Execute browser actions like clicking and typing
- Process visual feedback through screenshots
- Create goal-oriented browser automation tasks
Task Structure
Let’s break down the task into its core components:
1. Input Schema
First, we define what inputs our task expects:
This schema specifies that our task expects a goal string describing what the browser automation should accomplish.
2. Tools Configuration
Next, we define the external tools our task will use:
3. Main Workflow Steps
Create Julep Session
This step initializes a new Julep session for the AI agent. The session serves as a container for the conversation history and enables the agent to maintain context throughout the interaction.
Store Session ID
After creating the session, we store its unique identifier for future reference.
Create Browser Session
This step establishes a new browser session using BrowserBase. It creates an isolated, headless Chrome browser instance that the agent can control.
Store Browser Session Info
We store both the browser session ID and connect URL in a single evaluation step.
Get Session View URLs
This step retrieves various URLs associated with the browser session, including debugging interfaces and live view URLs.
Store Debugger URL
We specifically store the debugger URL, which provides access to Chrome DevTools Protocol debugging interface.
Initial Navigation
This step navigates to Google’s homepage to avoid sending a blank screenshot when computer use starts.
Start Browser Workflow
Finally, we initiate the interactive browser workflow with system capabilities and user goal.
Run Browser Workflow
The run_browser
workflow is a crucial component that handles the interactive browser automation. It consists of three main parts:
Agent Interaction
This step engages the AI agent in conversation, allowing it to:
- Process and understand the user’s goal
- Plan appropriate browser actions
- Generate responses based on the current browser state
- Make decisions about next steps
Action Execution
This component:
- Iterates through planned actions sequentially
- Executes browser commands (navigation, clicking, typing)
- Handles different types of interactions (text input, mouse clicks)
- Captures screenshots for visual feedback
Goal Evaluation
This final part:
- Assesses progress toward the user’s goal
- Determines if additional actions are needed
- Maintains conversation context
- Decides whether to continue or conclude the workflow
Check Goal Status Workflow
The check_goal_status
workflow is a recursive component that ensures continuous operation until the goal is achieved:
Check Goal Status
This workflow:
- Checks if there are any messages to process (
len(_.messages) > 0
) - If messages exist, recursively calls the
run_browser
workflow - Passes along the current session context and connection details
- Maintains the conversation flow until the goal is achieved
- Automatically terminates when no more messages need processing
This recursive pattern ensures that the browser automation continues until either:
- The goal is successfully achieved
- No more actions are needed
- An error occurs that prevents further progress
Example Usage
Here’s how to use this task with the Julep SDK:
Key Features
- Browser Automation: Performs web interactions like navigation, clicking, and typing
- Visual Feedback: Captures screenshots to verify actions and understand page state
- Goal-Oriented: Continues executing actions until the user’s goal is achieved
- Secure Sessions: Uses BrowserBase for isolated browser instances
- Interactive Workflow: Uses run_browser subworkflow for continuous interaction
Next Steps
To try this task yourself:
- Get your API keys for BrowserBase
- Create a new agent using the Julep SDK
- Create and execute the task with your desired goal
- Experiment with different browser automation scenarios
For more examples and task patterns, check out our other cookbooks.