Docs

Polanyi SDK, API, and event schema

Generate synthetic shopper journeys for any website from Python, and get back a recommendation-system event log you can load straight into pandas.

By Polanyi Labs · Updated

Quickstart

  1. Create an account and verify your email. New accounts get $10 in free credits.
  2. Create an API key in the dashboard. Keys start with pk_live_ and are shown once.
  3. Install the SDK and run a simulation:
pip install "polanyi>=0.4.2"

import os
os.environ["POLANYI_API_KEY"] = "pk_live_..."

from polanyi import Client

result = Client().simulate(site="https://your-store.com", n=3)

import pandas as pd
events = pd.read_json(result.events_jsonl, lines=True)
personas = pd.read_json(result.personas_json)

While it runs you see live progress for each shopper. If a Colab runtime resets, fetch a finished run again with Client().fetch("sim_...").

Client.simulate parameters

ParameterTypeDescription
sitestrWebsite URL or hostname to simulate, e.g. https://your-store.com. Shoppers never leave this domain.
nintNumber of synthetic shoppers (journeys) to run. Default 1, up to 50 per run.
concurrencyint | NoneShoppers run in parallel. Defaults to min(n, 5).
promptstr | NoneOptional extra instruction for the shoppers.
seedint | NoneSeed for reproducible persona casting.
output_dirstr | Path | NoneWhere to write files. Default output/<site>_<timestamp>/.
progressboolShow live progress while the run executes. Default True.
downloadbool | NoneIn Colab, download a zip of the results when done.

Output files

FileContents
personas.jsonEvery simulated shopper: demographics, interests, personality, and the journey goal each was given.
recsys_events.jsonlAll recommendation events from all shoppers, one JSON object per line. Also exported as Parquet.
summary.jsonRun summary: shoppers, sessions, event counts, and status.

Event schema

Every line of recsys_events.jsonl follows the browser_use_recsys_event schema (v1.0.0).

FieldTypeDescription
event_idstringUnique event ID.
session_idstringShopping session the event belongs to.
actor_idstring | nullSynthetic shopper ID (prefixed syn_). Never joined to real customer IDs.
persona_idstring | nullPersona from personas.json that drove this shopper.
is_syntheticbooleanAlways true for Polanyi events.
recorded_datedateDate the run was recorded.
event_timedatetime | nullWhen the event happened within the session.
sequence_indexintegerPosition of the event in its session. Use for sequential models.
event_typestringWhat happened. See event types below.
feedback_classenumimplicit, explicit, context, derived, or transaction_boundary.
signal_strengthenumnone, weak, medium, strong, very_strong, or ambiguous.
observedbooleantrue if seen directly in the browser; false for inferred signals.
training_useenumoffline_sandbox_only (default), production_eligible, or do_not_use.
item_idstring | nullProduct or item the event refers to, as identified on your site.
item_typestring | nullKind of item, e.g. product.
payloadobjectEvent-specific details, such as the search query or the filter applied.

Event types and default signal strength

Signal strength says how much an event should count as preference. Use it to set implicit-feedback weights in your training pipeline.

event_typefeedback_classdefault signal_strength
session_startedcontextnone
search_submittedimplicitmedium
filter_appliedimplicitmedium
item_impressionimplicitweak
item_viewedimplicitweak
item_clickedimplicitmedium
dwellimplicitweak
scrollimplicitweak
cart_addimplicitstrong
cart_removeimplicitambiguous
item_selectedimplicitvery_strong
saveexplicitstrong
shareexplicitstrong
ratingexplicitvery_strong
reviewexplicitvery_strong
checkout_startedimplicitvery_strong
checkout_boundary_stoptransaction_boundarynone
inference_signalderivedambiguous
session_summarycontextnone

REST API

The Python SDK wraps two endpoints. Authenticate with your key as a bearer token.

Method & pathPurpose
POST /v1/simulationsStart a run. Body: { "site": "https://…", "n": 3 }. Returns 202 and a sim_… id.
GET /v1/simulations/{id}Status, progress, and events for a run. Visible only to the key's owner.

How shoppers behave

  • Shoppers are cast from NVIDIA Nemotron-Personas-USA. Each gets a different goal.
  • Polanyi first diagnoses the live site, then runs each shopper in a real cloud browser.
  • Shoppers are hard-pinned to your domain and stop before entering identity or payment details.
  • External checkout hand-offs are recorded as checkout_boundary_stop.

Billing

Runs are billed per shopper journey from prepaid credits. Failed journeys are refunded automatically. Your balance and past runs are in the dashboard. For volume or enterprise pricing, talk to the founders.