Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 20 additions & 59 deletions static/notebooks/signals-agentic-accelerator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@
"\n",
"Generate these in the [IAM console](https://console.aws.amazon.com/iam/) under **Users > your user > Security credentials > Create access key**.\n",
"\n",
"**Signals Sandbox credentials:**\n",
"**Signals credentials:**\n",
"* `SIGNALS_API_URL` - the URL for your Signals instance\n",
"* `SIGNALS_ACCESS_TOKEN` - the access token from the [Sandbox dashboard](https://try-signals.snowplow.io/dashboard)\n",
"* `SIGNALS_COLLECTOR_URL` - your collector URL\n",
"\n",
"**Signals CDI credentials** (if using CDI instead of Sandbox):\n",
"* `SIGNALS_API_URL` - the URL for your Signals instance\n",
"* `SIGNALS_API_KEY` - the API key generated in console\n",
"* `SIGNALS_API_KEY_ID` - the API key ID generated in console\n",
"* `SIGNALS_ORG_ID` - your organization ID from console\n",
"* `SIGNALS_API_KEY` - the API key generated in Console\n",
"* `SIGNALS_API_KEY_ID` - the API key ID generated in Console\n",
"* `SIGNALS_ORG_ID` - your organization ID from Console\n",
"* `SIGNALS_COLLECTOR_URL` - your collector URL\n",
"\n",
"### Running locally\n",
Expand All @@ -79,7 +74,7 @@
"outputs": [],
"source": [
"import os\n",
"from snowplow_signals import Criteria, Criterion, Signals, Attribute, AtomicProperty, Event, EntityProperty, EventProperty, domain_sessionid, SignalsSandbox\n",
"from snowplow_signals import Criteria, Criterion, Signals, Attribute, AtomicProperty, Event, EntityProperty, EventProperty, domain_sessionid\n",
"\n",
"# AWS configuration\n",
"AWS_REGION = 'us-west-2'\n",
Expand All @@ -92,58 +87,31 @@
" os.environ['AWS_SECRET_ACCESS_KEY'] = userdata.get('AWS_SECRET_ACCESS_KEY')\n",
"\n",
" API_URL = userdata.get('SIGNALS_API_URL')\n",
" API_KEY = userdata.get('SIGNALS_API_KEY')\n",
" API_KEY_ID = userdata.get('SIGNALS_API_KEY_ID')\n",
" ORG_ID = userdata.get('SIGNALS_ORG_ID')\n",
" COLLECTOR_URL = userdata.get('SIGNALS_COLLECTOR_URL')\n",
"\n",
" # Try Sandbox first, fall back to CDI\n",
" try:\n",
" ACCESS_TOKEN = userdata.get('SIGNALS_ACCESS_TOKEN')\n",
" except Exception:\n",
" ACCESS_TOKEN = None\n",
"\n",
" try:\n",
" API_KEY = userdata.get('SIGNALS_API_KEY')\n",
" API_KEY_ID = userdata.get('SIGNALS_API_KEY_ID')\n",
" ORG_ID = userdata.get('SIGNALS_ORG_ID')\n",
" except Exception:\n",
" API_KEY = None\n",
" API_KEY_ID = None\n",
" ORG_ID = None\n",
"\n",
" print('Loaded credentials from Colab secrets')\n",
"\n",
"except (ImportError, ModuleNotFoundError):\n",
" # Not running in Colab - set variables directly below\n",
" print('Not running in Colab - set credentials below')\n",
"\n",
" # Snowplow Signals CDI\n",
" API_URL = 'example.signals.snowplowanalytics.com'\n",
" API_KEY = ''\n",
" API_KEY_ID = ''\n",
" ORG_ID = ''\n",
"\n",
" # or Signals Sandbox\n",
" API_URL = 'you.signals.snowplowanalytics.com'\n",
" ACCESS_TOKEN = ''\n",
"\n",
" COLLECTOR_URL = 'https://your-collector.svc.snplow.net'\n",
"\n",
"# Connect to Signals\n",
"sandbox = ACCESS_TOKEN is not None and ACCESS_TOKEN != ''\n",
"\n",
"if not sandbox:\n",
" print('Using Snowplow Signals CDI')\n",
" sp_signals = Signals(\n",
" api_url=API_URL,\n",
" api_key=API_KEY,\n",
" api_key_id=API_KEY_ID,\n",
" org_id=ORG_ID\n",
" )\n",
"else:\n",
" print('Using Signals Sandbox')\n",
" sp_signals = SignalsSandbox(\n",
" api_url=API_URL,\n",
" sandbox_token=ACCESS_TOKEN\n",
" )"
"sp_signals = Signals(\n",
" api_url=API_URL,\n",
" api_key=API_KEY,\n",
" api_key_id=API_KEY_ID,\n",
" org_id=ORG_ID\n",
")"
]
},
{
Expand All @@ -166,7 +134,6 @@
"import json\n",
"from strands.tools import tool\n",
"from duckduckgo_search import DDGS\n",
"from snowplow_signals import SignalsSandbox\n",
"\n",
"@tool\n",
"def get_destination_info(destination: str) -> str:\n",
Expand Down Expand Up @@ -283,18 +250,12 @@
" Returns attributes such as page view counts, segment affinities, and preferences.\n",
" \"\"\"\n",
" try:\n",
" if sandbox:\n",
" signals_client = SignalsSandbox(\n",
" api_url=API_URL,\n",
" sandbox_token=ACCESS_TOKEN,\n",
" )\n",
" else:\n",
" signals_client = Signals(\n",
" api_url=API_URL,\n",
" api_key=API_KEY,\n",
" api_key_id=API_KEY_ID,\n",
" org_id=ORG_ID,\n",
" )\n",
" signals_client = Signals(\n",
" api_url=API_URL,\n",
" api_key=API_KEY,\n",
" api_key_id=API_KEY_ID,\n",
" org_id=ORG_ID,\n",
" )\n",
" response = signals_client.get_service_attributes(\n",
" name=\"travel_service\",\n",
" attribute_key=\"domain_sessionid\",\n",
Expand Down
45 changes: 13 additions & 32 deletions static/notebooks/signals-personalize-travel-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,19 @@
"outputs": [],
"source": [
"# install dependencies, this requires Python 3.11 or higher\n",
"!pip3 install snowplow-signals==0.4.0"
"!pip3 install snowplow-signals"
]
},
{
"cell_type": "markdown",
"id": "c1a23967",
"metadata": {},
"source": [
"For Snowplow Signals (CDI) you will need\n",
"To connect to Snowplow Signals you will need\n",
"* API_URL - The URL for your Signals instance\n",
"* API_KEY - the API key generated in console\n",
"* API_KEY_ID - the API key ID generated in console\n",
"* ORG_ID - your organization ID from console (found in the settings page)\n",
"\n",
"Otherwise for Signals Sandbox you will need\n",
"* API_URL - The URL for your Signals instance\n",
"* ACCESS_TOKEN - The access token (on the dashboard page)"
"* API_KEY - the API key generated in Console\n",
"* API_KEY_ID - the API key ID generated in Console\n",
"* ORG_ID - your organization ID from Console (found in the settings page)"
]
},
{
Expand All @@ -34,35 +30,20 @@
"metadata": {},
"outputs": [],
"source": [
"from snowplow_signals import Criteria, Criterion, Signals, Attribute, AtomicProperty, Event, EntityProperty, EventProperty, domain_sessionid, SignalsSandbox\n",
"from snowplow_signals import Criteria, Criterion, Signals, Attribute, AtomicProperty, Event, EntityProperty, EventProperty, domain_sessionid\n",
"\n",
"# if you are using Signals CDI set the following variables\n",
"# set your Signals connection credentials\n",
"API_URL = 'example.signals.snowplowanalytics.com'\n",
"API_KEY = ''\n",
"API_KEY_ID = ''\n",
"ORG_ID = ''\n",
"\n",
"# or if you are using Signals Sandbox set the following variables instead\n",
"API_URL = 'you.signals.snowplowanalytics.com'\n",
"ACCESS_TOKEN = ''\n",
"\n",
"\n",
"sandbox = ACCESS_TOKEN is not None and ACCESS_TOKEN != ''\n",
"\n",
"if not sandbox:\n",
" print('Using Snowplow Signals')\n",
" sp_signals = Signals(\n",
" api_url=API_URL,\n",
" api_key=API_KEY,\n",
" api_key_id=API_KEY_ID,\n",
" org_id=ORG_ID\n",
" )\n",
"else:\n",
" print('Using Signals Sandbox')\n",
" sp_signals = SignalsSandbox(\n",
" api_url=API_URL,\n",
" sandbox_token=ACCESS_TOKEN\n",
" )"
"sp_signals = Signals(\n",
" api_url=API_URL,\n",
" api_key=API_KEY,\n",
" api_key_id=API_KEY_ID,\n",
" org_id=ORG_ID\n",
")"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions tutorial-requirements/example-accelerator/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Include 1-3 paragraphs about the goal of the accelerator
* Why would they want to do this?
* Roughly how long will it take to follow the accelerator?

State if a Snowplow account is required, or if they can use Sandbox, Micro, or Local.
State if a Snowplow account is required, or if they can use Micro or Local.

## Architecture

Expand Down Expand Up @@ -48,7 +48,7 @@ If your demo app includes Snowplow tracking or other Snowplow components, add th
## Prerequisites

Add a bullet point list of requirements:
* Is it for customers only, or can they use Sandbox, Micro, or Local?
* Is it for customers only, or can they use Micro or Local?
* Any specific technical knowledge required? Aim to make the accelerator as accessible as possible for new users.
* Do they need an account for a third-party product?
* Is there a minimum release version required for any of the components?
Expand Down
4 changes: 2 additions & 2 deletions tutorial-requirements/example-tutorial/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Include 1-3 paragraphs about the goal of the tutorial:
* Where will they be carrying out the steps? E.g. Snowplow Console, a notebook, their own command line
* Roughly how long will it take to follow the tutorial?

State if a Snowplow account is required, or if they can use Sandbox, Micro, or Local.
State if a Snowplow account is required, or if they can use Micro or Local.

Include a diagram or screenshot if it helps explain the purpose of the tutorial.

## Prerequisites

Add a bullet point list of requirements:
* Is it for customers only, or can they use Sandbox, Micro, or Local?
* Is it for customers only, or can they use Micro or Local?
* Any specific technical knowledge required? Aim to make the tutorial as accessible as possible for new users.
* Any other third-party tools required?
* Is there a minimum release version required for any of the components?
Expand Down
7 changes: 6 additions & 1 deletion tutorials/signals-agentic-accelerator/configure-signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ These attributes form a behavioral profile that the agent's `get_signals` tool f

## Set up your credentials

You need your Signals connection credentials. If you haven't set these up yet, see [connecting to Signals](/docs/signals/connection/). These are the same values you configured in the notebook's credentials cell:
You need your Signals connection credentials. If you haven't set these up yet, see [connecting to Signals](/docs/signals/connection/).

If you're running the notebook in Google Colab, store the values as Colab secrets named `SIGNALS_API_URL`, `SIGNALS_API_KEY`, `SIGNALS_API_KEY_ID`, `SIGNALS_ORG_ID`, and `SIGNALS_COLLECTOR_URL`. The notebook's credentials cell loads them automatically.

If you're running the notebook locally, set the values directly in the credentials cell:

```python
API_URL = 'example.signals.snowplowanalytics.com'
API_KEY = ''
API_KEY_ID = ''
ORG_ID = ''
COLLECTOR_URL = 'https://your-collector.svc.snplow.net'
```

## Define attributes
Expand Down
Loading