demo-agent-analytics-server
Welcome toAgent Analytics Setup
A drop-in Next.js agent backend any project can call to generate Amplitude Agent Analytics events stitched to the active Session Replay. Pick how you want to wire it up.
Streaming
/api/chatSession Replay stitchingOpenAI · @amplitude/aiOption 1
Set up with HTML
Drop a single self-contained HTML file into any site. No build step, no framework — perfect for landing pages, marketing demos, or static hosts.
- Vanilla <script type="module">
- Amplitude Browser SDK from CDN
- Streams via fetch + ReadableStream
Open guide
Option 2
Set up with a JS app
Import the helper into your React / Next / Vue app. Wraps the streaming call, reads device_id and session_id from the Amplitude SDK, and yields message deltas.
- Works with React, Vue, Svelte, Solid
- TypeScript-friendly hook pattern
- AbortController for in-flight cancel
Open guide
Already have a setup? Endpoint lives at POST /api/chat — see either guide for the request schema.