# Provide Signals personalization context to the travel AI agent
> Integrate Snowplow Signals with an AI chatbot to provide personalized travel recommendations based on user behavioral data.
> Source: https://docs.snowplow.io/tutorials/signals-personalize-travel/personalizing-agent/
> Documentation index: https://docs.snowplow.io/llms.txt

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/snowplow/documentation/blob/main/static/notebooks/signals-personalize-travel-demo.ipynb)

You'll now personalize a chatbot experience by integrating Signals with an AI agent that uses OpenAI as the backend. The chatbot fetches user attributes via a tool call, allowing it to provide contextual, personalized responses based on the user's browsing behavior.

The demo site includes all necessary tools and SDKs, so you'll only need an OpenAI API key to implement this feature.

## How it works

When a user asks the agent a question, the system fetches the attribute values for the user using the Signals API and uses these to modify the prompt sent to OpenAI. This allows personalized responses based on the user's preferences and behavior.

A toggle button on the chat widget allows you to enable or disable the tool call so you can see the difference in responses with and without Signals personalization.

## Data flow

```mermaid
sequenceDiagram
  Agent->>+OpenAI: Message
  Agent->>+Tool call: domain_sessionid
  Tool call->>+Typescript SDK: domain_sessionid
  Typescript SDK->>+Signals API: domain_sessionid, service_name
  Signals API->>+Typescript SDK: attributes
  Typescript SDK->>+Tool call: attributes
  Tool call->>+OpenAI: attributes
  OpenAI->>+Agent: personalized response
```

## Configure the agent

Add these variables to your `.env` file in the `snowplow-local` directory:

```text
AI_MODEL_PROVIDER=openai
AI_MODEL_NAME=gpt-4o-mini
OPENAI_API_KEY=your_openai_api_key
```

## Generate personalization data

You'll need some attribute data to personalize the agent responses. Browse different filters, destinations, and blog pages to generate additional attribute values.

Check your attribute values using the Snowplow Inspector **Attributes** tab. You should see values under the `travel_view` label.

## Test the agent

Start chatting with the agent by selecting the chat icon in the lower right portion of the screen.

First, test without personalization:

1. Turn the toggle switch off (gray means off, green means on)
2. Ask a question like "What are some good destinations for me in Southeast Asia?"
3. Note the generic response
4.

![SEA Travel Assistant chat widget with the Signals toggle switched off (gray), showing a generic response to \&quot;What are some good destinations for me in South East Asia?\&quot; listing Beach Lovers destinations including Bali, Indonesia](/assets/images/chat-nops-7668c9509e3c08326232cd9b2970e845.jpg)

Then test with personalization:

1. Turn the toggle switch on (green)
2. Ask the same question
3. Compare the response - it should now be tailored to your browsing behavior

![SEA Travel Assistant chat widget with the Signals toggle switched on (green), showing a personalized response to the same question that recommends Bangkok, Thailand first with a specific rationale about modern urban life and culinary tours based on browsing behavior](/assets/images/chat-ps1-144ee2bbe76757306a80409195e261ac.jpg)

![Chat widget with personalization continued](/assets/images/chat-ps2-a7995e7ad8284f4492092bc4218672ec.jpg)

The personalized responses should provide destination suggestions and justifications that align with the preferences you've demonstrated through your behavior on the site.
