Handle sensitive information securely and avoid sending PII & passwords to the LLM.
Agent(sensitiveData=...)
parameter to provide sensitive strings that the model can use in actions without ever seeing directly.
BrowserSession(allowedDomains=...)
to prevent the Agent from visiting URLs not needed for the task.x_member_number
and x_passphrase
placeholders in promptshttps://*.example.com
https://travel.example.com
is better than *.example.com
BrowserSession(allowedDomains=[...])
to only the domains the agent needs to visit to accomplish its task. This helps guard against prompt injection attacks, jailbreaks, and LLM mistakes.sensitiveData
for strings that can be inputted verbatim as text. The LLM never sees the actual values, so it can’t “understand” them, adapt them, or split them up for multiple input fields. For example, you can’t ask the Agent to click through a datepicker UI to input the sensitive value 1990-12-31
. For these situations you can implement a custom function the LLM can call that updates the DOM using Python / JS.sensitiveData
for login credentials, it’s better to use storageState
or a userDataDir
to log into the sites the agent needs in advance & reuse the cookies:Agent(useVision=false)
when working with sensitiveData
.sensitiveData
follow the same format as allowedDomains
:
example.com
- Matches only https://example.com/*
*.example.com
- Matches https://example.com/*
and any subdomain https://*.example.com/*
http*://example.com
- Matches both http://
and https://
protocols for example.com/*
chrome-extension://*
- Matches any Chrome extension URL e.g. chrome-extension://anyextensionid/options.html
Security Warning: For security reasons, certain patterns are explicitly rejected:The default protocol when no scheme is specified is now
- Wildcards in TLD part (e.g.,
example.*
) are not allowed (google.*
would matchgoogle.ninja
,google.pizza
, etc. which is a bad idea)- Embedded wildcards (e.g.,
g*e.com
) are rejected to prevent overly broad matches- Multiple wildcards like
*.*.domain
are not supported currently, open an issue if you need this feature
https://
for enhanced security.
For convenience the system will validate that all domain patterns used in Agent(sensitiveData)
are also included in BrowserSession(allowedDomains)
.
<secret>key_name</secret>
) is missing from your sensitiveData
dictionary, a warning will be logged but the substitution tag will be preserved.sensitiveData
dictionary, it will be treated the same as a missing key.x_email
and x_pass
) will only be used on Google domains (any subdomain, https only)x_api_key
) will only be used on pages served by the specific Chrome extension abcd1243
x_authcode
) will only be used on http://example.com/*
or https://example.com/*