AI agent instructions
AI agent instructions
How Profiles Work
A profile is a saved snapshot of a browser’s cookies, local storage, and session storage. Other browser data, such as the HTTP cache, history, and extensions, is not saved. By default, each Notte session uses a fresh browser state to ensure isolation. When you create a profile and use it in a session withpersist=True, Notte saves that session’s browser state when the session ends. You can also save any running session into a profile at any time with save_profile(). You can then attach the profile to future sessions to restore the saved state.
Create a Profile
Create a profile to store browser state. Optionally, give it a name to keep track of different profiles:create_profile.py
Use a Profile in a Session
Attach a profile to a session to load saved browser state:use_profile.py
Persist Changes
Thepersist parameter controls whether session changes are saved back to the profile:
True- Save browser state to the profile when the session endsFalse(default) - Use the profile as read-only; don’t save changes
Set
persist=True the first time you use a new profile to save the initial browser state. After that, you can use persist=False to reuse the profile without modifying it.Profile Login Example
Step 1: Login and Save to Profile
First, create a profile and perform a login. When the session ends withpersist=True, all cookies and browser state are saved to the profile:
persist_profile.py
Save a Running Session
If you only decide to keep the browser state after the session has started, save it directly.save_profile() snapshots the running session into a new profile (name) or an existing one (profile_id) and the session keeps running. It works on any session, including one started without a profile or with persist=False. With neither argument, it saves into the profile the session was started with.
save_profile() does not change the session’s persist setting. A session started with persist=True still saves again when it ends.Step 2: Reuse the Saved Profile
Use the saved profile in a new session. The browser automatically loads the saved state, so you’re already authenticated:reuse_profile.py
- A new session is created using the same profile ID
- The browser loads saved cookies and state from the profile
- You navigate directly without needing to log in again
- The session picks up right where the previous one left off
This pattern is useful for:
- Avoiding repeated logins across automation runs
- Testing authenticated user flows
- Managing multiple accounts with separate profiles
- Maintaining session state over time
Using Profiles with Agents
Profiles work seamlessly with Notte Agents. An agent running with a pre-authenticated profile can access authenticated resources immediately:profile_with_agent.py
Managing Profiles
List Profiles
Retrieve all your profiles with optional filtering:list_profiles.py
Get Profile Details
Retrieve information about a specific profile:get_profile.py
Delete a Profile
Delete a profile when you no longer need it:delete_profile.py
Read-Only Profile Usage
Load a profile without saving changes by settingpersist=False:
use_profile.py
- Test workflows without affecting saved state
- Run parallel sessions with the same profile safely
- Maintain a clean baseline profile for repeated use
By default,
persist is False, so you don’t have to explicitly specify it for read-only access.Best Practices
Profile Management
- Use descriptive names to identify profiles by their purpose (e.g.,
github-login,twitter-bot-1) - Create separate profiles for different accounts or services
- Periodically verify that saved sessions are still valid
Security
- Profiles contain sensitive session data; treat profile IDs as secrets
- Delete profiles for accounts that are no longer needed
- Use separate profiles for production and development environments
Comparison: Profiles vs Cookies
Use profiles when you need to preserve cookies and web storage together. Use cookies when you only need to inject specific authentication tokens.
Next Steps
Session Lifecycle
Manage session lifecycle
Cookies
Manual cookie management
Vaults
Secure credential storage
Session Configuration
All session options