> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browsernode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# System Prompt

> Customize the system prompt to control agent behavior and capabilities

## Overview

You can customize the system prompt in two ways:

1. Extend the default system prompt with additional instructions
2. Override the default system prompt entirely

<Note>
  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.
</Note>

### Extend System Prompt (recommended)

To add additional instructions to the default system prompt:

```js theme={null}
const extendSystemMessage = `
REMEMBER the most important RULE:
ALWAYS open first a new tab and go first to url wikipedia.com no matter the task!!!
`;
```

### Override System Prompt

<Warning>
  Not recommended! If you must override the [default system
  prompt](https://github.com/leoning60/browsernode/blob/main/src/agent/system_prompt.md),
  make sure to test the agent yourself.
</Warning>

Anyway, to override the default system prompt:

```js theme={null}
import { Agent } from "browsernode";
import { ChatOpenAI } from "browsernode/llm";

const overrideSystemMessage = `
You are an AI agent that helps users with web browsing tasks.

[Your complete custom instructions here...]
`;

// Create agent with custom system prompt
const agent = new Agent(
    {
        task: "Your task here",
        llm: llm,
        overrideSystemMessage: overrideSystemMessage,
    }
);

```

### Extend Planner System Prompt

You can customize the behavior of the planning agent by extending its system prompt:

```js theme={null}
const extendPlannerSystemMessage = `
PRIORITIZE gathering information before taking any action.
Always suggest exploring multiple options before making a decision.
`;

// Create agent with extended planner system prompt
const llm = new ChatOpenAI(model: "gpt-4o");
const plannerLLM = new ChatOpenAI(model: "gpt-4o-mini");

const agent = new Agent(
    {
        task: "Your task here",
        llm: llm,
        plannerLLM: plannerLLM,
        extendPlannerSystemMessage: extendPlannerSystemMessage,
    }
);
```
