Docs/SDK/Permissions

Permissions

Avoid browser permission bubbles (outside the DOM and invisible to snapshots) by setting a policy at startup, and applying explicit permission changes mid-run when supported.

This guide covers:

Treat permissions as part of verification.

Permission prompts are not actionable UI. Prefer a startup policy and explicit mid-run tools so your trace shows what you granted, when, and why.

Table of Contents

  1. What problem this solves
  2. Startup: PermissionPolicy
  3. Mid-run: permission tools
  4. Examples
  5. Troubleshooting

What problem this solves

On Chrome (and Chromium-based browsers), site permission prompts (geolocation, notifications, etc.) are often native browser UI. They are:

If your agent “hangs” at a permission prompt, it’s usually because it can’t see or reason about it. The fix is to treat permissions as context configuration.


Startup: PermissionPolicy

PermissionPolicy is applied when the browser context is created — before any navigation.

FieldMeaning
default

Default behavior on context creation: "clear", "deny", or "grant". ("clear"/"deny" clears existing permissions; "grant" keeps defaults and lets autoGrant add more.)

autoGrant / auto_grantPermissions to grant up front (e.g., ["geolocation"]).
geolocationOptional geolocation to set on the browser context.
originOptional origin scope for permission grants (when supported).

Mid-run: permission tools

When you’re using the Tool Registry, you can change permissions explicitly as part of a step.

ToolWhat it does
grant_permissionsGrant one or more permissions for the current context.
clear_permissionsClear permissions for the current context.
set_geolocationSet geolocation on the current context (lat/lng, optional accuracy).

Examples

from predicate import PredicateBrowser, PermissionPolicy

policy = PermissionPolicy(
    default="clear",
    auto_grant=["geolocation", "notifications"],
    geolocation={"latitude": 37.7749, "longitude": -122.4194},
)

browser = PredicateBrowser(permission_policy=policy)
browser.start()

Mid-run tools (explicit + traceable)

from predicate.tools import ToolRegistry, ToolContext, register_default_tools

registry = ToolRegistry()
register_default_tools(registry, runtime)

ctx = ToolContext(runtime)

await registry.execute("grant_permissions", {"permissions": ["geolocation"]}, ctx=ctx)
await registry.execute("set_geolocation", {"latitude": 37.77, "longitude": -122.41}, ctx=ctx)

Troubleshooting