Skip to content

Implement telemetry#43

Open
Dawe000 wants to merge 6 commits intoagent0lab:mainfrom
Dawe000:implement-telemetry
Open

Implement telemetry#43
Dawe000 wants to merge 6 commits intoagent0lab:mainfrom
Dawe000:implement-telemetry

Conversation

@Dawe000
Copy link
Contributor

@Dawe000 Dawe000 commented Mar 4, 2026

Adds optional telemetry to the SDK: when apiKey (and optionally telemetryEndpoint) is set, read-only methods emit events to the ingest endpoint (fire-and-forget). No apiKey ⇒ no telemetry.

Changes

  • New: src/core/telemetry.tsTelemetryClient, categorizeError, default endpoint.
  • SDK: apiKey and telemetryEndpoint in config; events for searchAgents, getAgent, loadAgent, searchFeedback, getReputationSummary (and Agent lifecycle where applicable).
  • Tests: tests/telemetry-sdk.test.ts — tests with apiKey (including DB checks when Supabase env is set) and one test without apiKey.
  • Config: tests/config.ts and .env.example include AGENT0_API_KEY, AGENT0_TELEMETRY_ENDPOINT, SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY.
  • DevDep: @supabase/supabase-js for the DB assertion test only.

How to test

  1. Without Supabase (API key only): Set AGENT0_API_KEY in .env, run npm test -- telemetry-sdk. All tests except “telemetry events are written to the database” run; that one is skipped.
  2. With Supabase (full integration): In agent0-dashboard run supabase start, apply seed-telemetry-test-user.sql, run npx supabase functions serve. In agent0-ts set AGENT0_TELEMETRY_ENDPOINT, SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY in .env, then npm test -- telemetry-sdk. All tests run, including DB checks.

@Dawe000 Dawe000 marked this pull request as ready for review March 8, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant