Install
replace keeps installation reproducible without depending on the Go proxy. The versioned .epode
directory prevents files removed by a later SDK release from surviving an upgrade without invoking
Go’s special vendor/ mode.
Configure once
r.WithContext, so never place the feedback middleware outside authentication.
Account and user references must come from verified auth; the anonymous reference must be a product-owned
first-party visitor ID. A session reference is safe only when server/product state already proves the journey.
Never read these values from names, emails, prompts, caller fields, or agent arguments.
Server-rendered HTML
Finite HTML bodies on included routes receive the embedded contract. Responses larger than the capture limit, streams detected throughFlush, and unsafe bodies pass through byte-for-byte.
The default capture limit is 1 MiB. Set MaxResponseBodyBytes to another positive value when needed.
Route patterns and caching
InInclude/Exclude patterns, * matches exactly one path segment and ** matches any depth
(/docs/* matches /docs/guide but not /docs/deep/nested/page; use /docs/** for the latter).
CacheMode controls how instrumentation interacts with HTTP caching. The default CacheSafe skips
responses that declare a shared cache policy (public, max-age, s-maxage, immutable). Use
CachePrivate only when replacing shared caching with private, no-store is intentional, or
CacheRequest to instrument only requests that opt in with the Agent-Feedback-Request: 1 header. Request
mode adds Vary: Agent-Feedback-Request to both variants so shared caches keep them separate.
Eligible ordinary 2xx GET and HEAD responses also advertise a same-path-and-query Link for one
authenticated Companion refetch; redirects and non-safe methods never advertise it.
Verify
Send one API and one HTML request, then confirm the response contract and the Setup telemetry status. CallShutdown during graceful server shutdown so queued telemetry can flush.