Why this matters
A customer messages support: “Checkout is broken.” You have:
- 0 context on what they did
- 0 context on what they saw
- 0 errors that obviously match
So you start the dance: ask them what browser, what step, what they were buying. Three round-trips later you find out it was an autofill issue. Total: 2 hours, 4 messages, one frustrated customer.
Agentry collapses this into one prompt. The agent pulls the user’s analytics events (so you see the funnel they walked), errors tied to their distinct_id (so you see what crashed), and their session replay if enabled (so you see what they clicked). One investigation, no pingpong.
What you get
- A timeline of the customer’s session: pages visited, actions taken, errors encountered
- The specific error fingerprint they hit (with stack trace)
- A draft reply you can send them
- (Optional) The session replay URL if they recorded
Walk through it
Customer [email protected] says checkout is broken. What happened?
Let me pull everything tied to that distinct_id in the last 48 hours.
agentry_get_distinct_id_summary {
project_id: "default",
distinct_id: "[email protected]",
window_hours: 48
}
{
"user": { "distinct_id": "[email protected]", "first_seen": 1747180000, "last_seen": 1747356400 },
"events_by_type": {
"page_view": 14,
"checkout_started": 2,
"checkout_failed": 2,
"feature_flag_evaluated": 28
},
"recent_events": [
{ "event": "checkout_started", "ts": 1747356100, "properties": { "plan": "pro", "amount_cents": 4900 } },
{ "event": "checkout_failed", "ts": 1747356140,
"properties": { "step": "card_form", "reason": "stripe_card_declined" } }
],
"errors": [
{ "fingerprint": "f_8e21", "error_type": "TypeError",
"message": "Cannot read properties of null (reading 'address')",
"occurred_at": 1747356135, "session_id": "s_a31b" }
]
}
Found it. [email protected] hit a TypeError on the checkout card form 35 seconds into their session. The error message says we tried to read .address from a null value. Let me look at the stack.
agentry_get_case { case_id: "f_8e21" }
The error fires in BillingForm.tsx:118 — we call user.address.line1 before checking if user.address exists. paddy hasn’t filled their billing address yet (this is their first paid plan), so user.address is null.
The
stripe_card_declinedevent after is a red herring — Stripe rejected because we never got past the address validation.
Suggested reply:
“Hi paddy — looks like our checkout form has a bug when a customer hasn’t filled in a billing address before. We’re fixing it now. In the meantime, if you go to your profile and add a billing address there first, then come back to checkout, it should work. Sorry for the friction.”
Want me to draft the fix as a PR?
The output
🔍 [email protected] investigation (48h window)
Timeline:
17:08 → page_view /pricing
17:09 → page_view /pricing#pro
17:12 → checkout_started { plan: "pro", amount: $49 }
17:13 ❌ TypeError in BillingForm.tsx:118 (null.address)
17:13 → checkout_failed { step: "card_form" }
Root cause:
Code at BillingForm.tsx:118 reads user.address.line1 without
a null check. New users without a saved address hit this.
Reply draft:
[copy/paste reply above]
Files affected: 1 (BillingForm.tsx)
Other users hitting this: 14 in the past 7 days (silent — none reported it)
Setting it up
Agentry has no SDK. The agent generates a ~25-line fetch helper at install time — everything below is plain HTTP you can paste directly into your app.
Two ingredients:
1. Include distinct_id on every analytics event. Without it, Agentry can’t tie events to a person. There’s no separate identify() call — the identifier just rides along in the event body.
await fetch(`https://api.agentry.sh/v1/analytics/${PROJECT_ID}/`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.AGENTRY_DSN}`,
"Content-Type": "application/json",
"User-Agent": "myapp/1.0", // REQUIRED — Cloudflare 403s default UAs
},
body: JSON.stringify({
event: "checkout_started",
distinct_id: user.email,
properties: { plan: "pro", amount_cents: 4900 },
}),
});
2. Tag errors with the same identifier. When you send error events, include user.id or user.email so it matches the analytics distinct_id:
// In your error handler
await fetch(`https://api.agentry.sh/v1/logs/${PROJECT_ID}/`, {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.AGENTRY_DSN}`,
"Content-Type": "application/json",
"User-Agent": "myapp/1.0",
},
body: JSON.stringify({
message: err.message,
stack: err.stack,
user: { id: currentUser.email }, // matches the distinct_id above
environment: process.env.NODE_ENV,
}),
});
Optionally enable session replay so the agent can also link to the recording:
agentry_configure_session_replay { strategy: "errors_only" }
Variations
- “Find every customer who hit error
f_8e21and draft me a one-line apology to each.” - “List the top 10 customers by error count this week — they’re probably about to churn.”
- “This customer was on pro plan but their checkout is for free. Why does the system think they’re free?”
- “Walk this customer’s whole signup-to-first-action journey and tell me where it got slow.”