# Website Analysis and Marketing Strategy Agent

**Introduction**

This guide showcases an example of a powerful **Website Analysis and Marketing Strategy Agent** built on Integrail. This agent is just one of the many potential agents users can create using the tools and features offered by the Integrail platform. With Integrail, users can design, build, and deploy AI-driven agents without any coding experience, empowering businesses and individuals to automate complex tasks and processes.

<figure><img src="/files/pVObC7tmtIrWOHJXgU3B" alt=""><figcaption></figcaption></figure>

#### **How Integrail Empowers Users to Build Custom AI Agents**

Integrail provides a visual, no-code platform where users can create AI-driven agents by linking nodes that perform various functions, such as scraping websites, processing data, and generating strategic outputs. The platform supports the integration of different commands, inputs, and outputs, allowing users to build agents for tasks like:

* Website analysis and strategy generation
* Content summarization
* Process automation
* Data retrieval and analytics

***

### **Node: Agent Inputs**

**Functionality:**

The **Agent Inputs** node serves as the entry point for user interaction with the agent. It collects user-provided data and establishes a session context. Here’s what happens:

1. **User Prompt**:\
   The user enters their request or prompt, such as a URL to be analyzed. In our example, the prompt is:\
   `"let's analyze https://integrail.ai"`
2. **Session Name**:\
   The session name is set to `"data"`, which is critical because the agent will save and retrieve data during this session. As the process flows through subsequent nodes, this session name ensures that all data and context are associated with the correct interaction.
3. **Saved Prompts**:\
   Although in this case we are using a live input (i.e., the user provides the URL at the time of use), the system can also use saved prompts if needed. Saved prompts allow for repeated analysis or interactions without requiring the user to re-enter data.

***

### **Node: Caller 2**

This node processes the user’s input and determines if the agent should analyze a website or continue interacting in a conversation.

<figure><img src="/files/L4TU6w39UO93xy5DYNtf" alt=""><figcaption></figcaption></figure>

* **Label**: Caller 2
* **Model**: In this example, we use *gpt-4o-2024-05-13*. However, you can select any other model that fits your specific requirements.
* **User Prompt**:\
  `{{inputs.userPrompt}}`\
  This input takes the value from the **Agent Inputs** node (in this case, the URL provided by the user).
* **System Prompt**:

  ```plaintext
  plaintextCopy codeYour task is to understand the user's intent and call one of these commands. You MUST respond with a well-formatted JSON of the following format:

  {
    "name": <command_name>,
    "inputs": <object describing inputs>
  }

  The commands you have are:

  1. readSite. Only call this if a user wants you to read a URL and start a new planning session, e.g., by saying "let's discuss the new site: integrail.ai". You have to extract the URL from the user's message and respond with the following command. Only put the URL in the "url" field, nothing else!
  {
    "name": "readSite",
     "inputs": { "url": <URL to the website the user wants you to analyze> }
  }

  2. Interact. Call this when the user is interacting with you as normal:
  {
    "name": "interact",
     "inputs": { "userPrompt": <user input without any changes> }
  }

  Return ONLY JSON, without any additional text or formatting outside of the JSON.
  ```
* **Connected**:\
  `{{inputs.userPrompt}}`\
  The user prompt from the **Agent Inputs** node is passed through this connection.
* **Command Results**:\
  Output in JSON format:

  ```json
  jsonCopy code{
    "name": "readSite",
    "inputs": { "url": "https://integrail.ai" }
  }
  ```

***

### **Node: Save Session (First)**

This node saves the extracted website features into the session for future use.

* **Label**: Save Session
* **Text to Save**:\
  `{{13.output.2-output}}`\
  The output from the **Site to Features** node (likely the extracted website features) is saved into the session.
* **Unique Name for this Item**: `"data"`\
  This session is named `"data"` to allow for the retrieval of the extracted information in future nodes.

***

### **Node: Chat History**

The **Chat History** node stores the conversation between the user and the agent. This ensures that any inputs or requests from the user are remembered during the session.

* **Label**: Chat History
* **User Prompt**:\
  `{{7.command.interact}}`\
  This field captures the user’s interactions, allowing the system to process both conversations and commands.

***

### **Node: LLM Brain**

This node uses the marketing document's current state and user requests to update or provide suggestions for the marketing strategy.

<figure><img src="/files/hsXXIa92gpm1hNecQUB6" alt=""><figcaption></figcaption></figure>

* **Label**: LLM Brain
* **Model**: In this example, we use *gpt-4o-2024-05-13*

  . Feel free to select any other model that suits your project needs.
* **System Prompt**:

  ```plaintext
  plaintextCopy codeYou are the best strategic marketing consultant in the world. You are working on the marketing positioning document with the user, that includes at least descriptions of the product features, target segments, and business value messages, but can be expanded with strategy, plans, etc. When the user asks you to make certain changes or suggestions, analyze the current document and provide the answer to the best of your ability.

  The current marketing document state is:

  {{4.output}}

  If the user says "STATUS" you MUST respond with the current state of the document as above.
  ```
* **Connected Document**:\
  `{{4.output}}`\
  This connection references the document stored in the **Site to Features** or previous nodes, ensuring that the most up-to-date version is available.
* **Messages**:\
  `{{3.messages}}`\
  This connects the node to the **Chat History** node, so that any relevant user input is incorporated into the response.

***

### **Node: Summarizer**

The **Summarizer** node is responsible for refining and updating the marketing positioning document based on the latest discussions and changes from the conversation history. It plays a pivotal role in ensuring that the document remains up to date with the user's ongoing interactions.

<figure><img src="/files/ofTYgw1ZjCBUTk51oTtu" alt=""><figcaption></figcaption></figure>

* **Label**: Summarizer
* **Model**: In this example, we are using *gpt-4o-2024-05-13*

  , but you can select any other model that suits your needs. The model chosen will impact the quality and focus of the summarization process.
* **Size of Context**: 128,000 tokens\
  This large context size allows the model to handle extensive conversation histories and complex documents, ensuring that no information is missed during the summarization.
* **Input Price**: $5 per 1M tokens
* **Output Price**: $15 per 1M tokens\
  These costs refer to the processing and generation of input/output data.

#### **System Prompt**

The system prompt guides the model in acting as a strategic marketing consultant, specifically tasked with updating the marketing document based on the current document state and the conversation history.

**System Prompt**:

```plaintext
plaintextCopy codeYou are the best strategic marketing consultant in the world. You are working on the marketing positioning document with the user, that includes at least descriptions of the product features, target segments, and business value messages, but can be expanded with strategy, plans, etc.

Your task is to analyze the current marketing document state and the conversation history with the user, and UPDATE the marketing document so that it includes all the latest discussions, additions, changes, etc, from the conversation history.

The current marketing document state is:

{{12.output}}

Respond ONLY with the updated marketing document.
```

* **Connected Document**:\
  `{{12.output}}`\
  The current state of the marketing document is connected through this field, ensuring that the model works with the most up-to-date version of the document.

#### **Key Functionality**:

1. **Document Update**:\
   The **Summarizer** analyzes both the current state of the document and the conversation history. Its primary task is to update the document with new insights, discussions, and changes provided by the user during the interaction.
2. **Role of the Model**:\
   Acting as the best marketing consultant, the model refines the document with strategic suggestions, such as product features, target segments, and business value messages. The document can also be expanded with additional elements like marketing strategies and plans.
3. **Strict Output**:\
   The system prompt ensures that the output is **only** the updated marketing document, without any additional commentary or irrelevant data, making it clean and ready for use.

***

### Node: LLM

The **Brains** node is designed to act as the interface between the user and the agent. It processes user inputs and generates responses based on the state of the marketing document and conversation history. Essentially, it functions as the "thinking" part of the agent, providing insightful responses that guide the user through the strategic marketing process.

#### **System Prompt**

The **System Prompt** defines the role of the **Brains** node and how it should respond to user inputs. It sets the behavior for the agent and instructs it on how to interact with the marketing document and the user.

**System Prompt Breakdown:**

```sql
sqlCopy codeYou are the best strategic marketing consultant in the world. You are working on the marketing positioning document with the user, that includes at least descriptions of the product features, target segments, and business value messages, but can be expanded with strategy, plans, etc. When the user asks you to make certain changes or suggestions, analyze the current document and provide the answer to the best of your ability.

The current marketing document state is:

{{4.output}}

If the user says "STATUS" you MUST respond with the current state of the document as above.
```

***

**Detailed Breakdown of the System Prompt:**

1. **Role Definition**:
   * The model is instructed to act as **the best strategic marketing consultant**, providing guidance and updates on the marketing positioning document based on the user's questions or requests.
2. **Document Handling**:
   * The marketing positioning document includes essential elements such as **product features**, **target segments**, and **business value messages**. However, the user may request more detailed additions, such as strategies and plans, and the model should respond accordingly.
3. **Responding to User Requests**:
   * The prompt specifies that whenever the user asks for changes or suggestions, the model must analyze the **current document** and provide a response that reflects the latest state of the document.
4. **STATUS Command**:
   * If the user asks for a **"STATUS"** update, the model is required to return the current state of the document exactly as it is. This ensures that the user can track progress and see any updates made during the interaction.
5. **Input Reference**:
   * The document's current state is provided through the reference `{{4.output}}`, which connects to a previous node's output. This ensures that the **Brains** node is always working with the most up-to-date version of the document.

#### **Connected Inputs**:

* **Connected Input: {{4.output}}**\
  This input provides the current state of the marketing document, ensuring that the **Brains** node has access to the latest version of the document to analyze and use in its responses.
* **Messages: {{3.messages}}**\
  This input is linked to the conversation history, allowing the node to incorporate any updates or context from the user’s previous messages.

#### **Flow of Information**:

1. **User Input**:
   * The user may ask for changes or updates to the marketing document or inquire about the document's current state using the **STATUS** command.
2. **Document and Message Processing**:
   * The **Brains** node retrieves the current state of the marketing document via the `{{4.output}}` reference.
   * It also accesses the conversation history via `{{3.messages}}` to ensure any relevant context is considered when generating a response.
3. **Generating a Response**:
   * The node analyzes the document and the conversation, generates a response based on the user’s input, and provides either an update or a status report.
   * If the user requests **STATUS**, the node returns the current document as-is.
4. **Output**:
   * The node generates and delivers the final response to the user, either confirming the status of the document or incorporating the requested changes.

***

### **Node: Read Session**

The **Read Session** node is used to retrieve the saved session data from previous steps. This ensures that the agent can maintain the context of the conversation or any saved data throughout the interaction.

* **Label**: Read Session
* **Item Name**:\
  The session name is set to `"data"`, so it retrieves any information saved in previous nodes (such as extracted website features or conversation history).

***

### **Node: Save Session**&#x20;

This final **Save Session** node stores the last version of the document or output after the agent has processed all the user’s inputs and suggestions.

* **Label**: Save Session
* **Text to Save**:\
  `{{5.output}}`\
  The final output, possibly generated by the **LLM Brain** or other nodes, is saved here for future retrieval.
* **Unique Name for this Item**: `"data"`\
  The session name remains `"data"` to ensure all related information is stored and can be accessed later.

***

We’d love to hear from you! Reach out to **<documentation@integrail.ai>**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.integrail.ai/agent-studio/markdown/website-analysis-and-marketing-strategy-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
