Prompting
Best practices for prompting your browser agents
Variables
To insert variables into your AI Browser agent, use the following:
{{.USER_INFO}}
To have the AI understand better the variable you are entering, wrap it:
You will have to supply the variable at the start of the run
Playwright Variables
To have the AI agent insert a variable into a Playwright node use:
Credentials
If you want to securely store credential information, enter them in the Credentials
tab of the agent.
Credentials are encrypted in transit and at rest and cannot be viewed after creation. You can let your agent use credentials by referencing them by their name in your agent prompt.
To reference a credential in your agent prompt, prepend the capitalized credential name with CREDENTIAL_
For example:
Your task is to make a request to the API. Here's the API key: CREDENTIAL_MYAPIKEY
Usage: Use this tool to store sensitive information such as passwords and API keys. For more information about security, visit Security
Best Practices
Be Specific and Clear
- State your goal directly: “Fill out this contact form with my business details”
- Specify the action: “Click the blue ‘Submit’ button” instead of “submit this”
- Include context: “Navigate to the pricing page and compare the Pro vs Enterprise plans”
Use Natural Language
- Write as if talking to a human assistant
- Avoid technical jargon or programming syntax
- Example: “Find the cheapest flight to Paris next week” not “query flight API for CDG destination”
Break Down Complex Tasks
- Split multi-step processes into smaller, clear instructions Example: “First, log into the account. Then go to settings. Finally, update the email address.”
Provide Necessary Details
- Include specific information the agent needs
- “Enter ‘john.doe@company.com’ in the email field”
- “Select ‘Premium’ from the subscription dropdown”
Handle Errors Gracefully
- If something fails, describe what you expected vs. what happened
- “The form should submit but I’m seeing a red error message”
- Give the agent permission to try alternative approaches