---
description: Customize the system prompt to control agent behavior and capabilities
---

# System prompt

#### Overview <a href="#overview" id="overview"></a>

You can customize the system prompt by extending the `SystemPrompt` class. Internally, this adds extra instructions to the default system prompt (which is general and quite optimized at this point).

{% hint style="info" %}
Custom system prompts allow you to modify the agent’s behavior at a fundamental level. Use this feature carefully as it can significantly impact the agent’s performance and reliability.
{% endhint %}

#### [​](https://docs.browser-use.com/customize/system-prompt#basic-customization)Basic Customization <a href="#basic-customization" id="basic-customization"></a>

Create a custom system prompt by inheriting from the base class.

Copy

```
from browser_use import Agent, SystemPrompt

class MySystemPrompt(SystemPrompt):
    def important_rules(self) -> str:
        # Get existing rules from parent class
        existing_rules = super().important_rules()

        # Add your custom rules
        new_rules = """
9. MOST IMPORTANT RULE:
- ALWAYS open first a new tab and go to wikipedia.com no matter the task!!!
"""

        # Make sure to use this pattern otherwise the exiting rules will be lost
        return f'{existing_rules}\n{new_rules}'
```

The `important_rules()` are written in format like this. Keeping the format consistent helps with redundancy and readability.

Copy

```
8. ACTION SEQUENCING:
   - Actions are executed in the order they appear in the list
   - ...
```

{% hint style="info" %}
Try not to override other methods unless you have a specific need.
{% endhint %}

#### [​](https://docs.browser-use.com/customize/system-prompt#using-custom-system-prompt)Using Custom System Prompt <a href="#using-custom-system-prompt" id="using-custom-system-prompt"></a>

Apply your custom system prompt when creating an agent:

Copy

```
from langchain_openai import ChatOpenAI

# Initialize the model
model = ChatOpenAI(model='gpt-4')

# Create agent with custom system prompt
agent = Agent(
    task="Your task here",
    llm=model,
    system_prompt_class=MySystemPrompt
)
```
