HEXGATE_API_KEY is set and local mode is off, the SDK records three kinds
of event and ships them to the platform out of band, fire-and-forget:
Each event is one OpenTelemetry span, exported over OTLP/HTTP to
<HEXGATE_API_URL>/v1/traces with the API key as bearer. Nothing in the agent
waits on it: a full queue drops the oldest span, a network failure is logged and
the batch is dropped, and the decision the agent acts on is never affected. The
dashboard’s audit and usage pages read the resulting rows.
Local mode (set automatically by hexgate chat, or by
HEXGATE_LOCAL_MODE) keeps events on your machine instead.
Because the SDK is a standard OTLP exporter, HEXGATE_OTLP_ENDPOINT can point it
at a collector on a different host than the control plane; the default is the
API origin plus /v1/traces, which is what Hexgate Cloud and the reference
self-hosted stack both serve. See environment variables.
See Audit log (ClickHouse) for how events travel
through a self-hosted platform and internals/audit-pipeline
for the engineering spec, including the span attribute contract.