# Sophi — agent integration guide

Sophi is an agentic-commerce platform. This file orients AI coding agents (Cursor, Windsurf, Copilot, and any tool that reads `AGENTS.md`). For the full skill, fetch <https://docs.usesophi.com/skill.md>. Always work from the live docs — never rely on training-data memory, because the SDK evolves.

## Canonical packages — use exactly, never invent

- **`@usesophi/sophi-web-sdk`** — chat widget: `import { SophiWidget }` → `new SophiWidget()` → `await widget.init({ apiKey, container, ... })`.
- **`@usesophi/sophi-web-object`** — tracking: set `window.sophi_object.config = { apiKey, ... }`; after the bundle loads, `window.SophiTracker` exposes `push(partial)`, `setConsent(granted)`, `updateUser(userId)`, `getSession()`. Events come from watched keys (`page`, `product`, `basket`, `listing`, `transaction`, `user`) on `push(...)`.

🚫 **Do NOT exist** (common hallucinations): `@sophi/sdk`, `new SophiTracker(...)`, `.track('product_view', ...)` or any `.track()` method, a `store` / `storeId` option.

## Live docs

- Full bundle: <https://docs.usesophi.com/llms-full.txt>
- Page index: <https://docs.usesophi.com/llms.txt>
- Any page as Markdown: append `.md` (e.g. <https://docs.usesophi.com/docs/frontend-integration/sdk/installation.md>)

## Rules

- Before emitting any Sophi symbol (package, class, method, option, event name), confirm it appears verbatim in a page you fetched this session. Never guess.
- Use `YOUR_API_KEY` placeholders; apply the `storageConsent: false` consent pattern by default (the Web Object stays passive until `setConsent(true)`).
- Cite the source page URL next to any code you generate.
