Skip to main content
Signals implementation
Customer-facing AI agents

Build an AI agent with real-time user context using Signals and Vercel AI SDK

Build a Next.js AI agent that uses Snowplow Signals to deliver contextually aware responses based on live user behavior.

Progress0%

Configure Snowplow Signals

The next step is to define the user attributes you want to compute. You'll do this within Snowplow Console.

Create a Basic Web attribute group

Use one of Signals' built-in attribute group templates to define attributes. Use the domain_sessionid as attribute key to compute session-level attributes.

  1. In Console, navigate to Signals > Attribute Groups
  2. Click Create attribute group and choose Basic Web
  3. Set the Attribute Key to domain_sessionid

The Basic Web template includes these attributes:

AttributeDescription
page_views_countTotal number of page views in the session
unique_pages_viewedNumber of distinct pages visited
first_event_timestampWhen the session started
last_event_timestampWhen the most recent event was recorded

Test your attribute group by clicking Run Preview before saving, to verify it's computing correctly based on recent events in your pipeline. This runs a query against your event data in your data warehouse and shows the computed attributes for recent sessions.

Click Create attribute group when you're happy with the attribute group.

Publish the attribute group

Attribute groups need to be published before Signals will start computing:

  1. Open your attribute group and click Publish
  2. Confirm the publish to deploy the computation logic to the pipeline

Once published, Signals will start computing attributes for each user session as events arrive.

Create a service

A service provides a pull-based API endpoint that exposes your computed attributes for a specific attribute (lookup) key.

Services allow you to combine multiple attribute groups if needed, but for this tutorial, use just the one you created in the last step.

Use this exact service name. It's the same as the SNOWPLOW_SIGNALS_SERVICE_NAME environment variable you configured in the Next.js application.

  1. Navigate to Signals > Services
  2. Click Create service
  3. Configure:
    • Name: web-agent-context
    • Attribute groups: Select the attribute group you just published
  4. Click Create service

The page will show you retrieval instructions for Node.js. You'll need these to set up your API client in the next step.

On this page

Want to see a custom demo?

Our technical experts are here to help.