Skip to content
Telemetry setup instructions for coding agents

skill.md observability wrapper examples

Give your coding agent the skill.md instructions. They include TypeScript and Python wrappers, rules for excluding sensitive data, SQL checks, and steps for building a dashboard.

Put the skill to work

Add events to one agent workflow

Start with a ready API key and agent prompt, run one representative workflow, and verify the resulting event before building a dashboard.

Connect agent telemetry

What the skill covers

Check the events your agent adds

Consistent event fields

The instructions ask the agent to name events, use snake_case fields, specify units, and include identifiers for SQL joins.

Keep private data out

Raw prompts, completions, credentials, authorization headers, and private payloads stay out of the analytics path by default.

Verify that events arrive

Run the workflow, check that its events arrive, and query the results before calling the setup finished.

Telemetry wrapper examples

Tell the agent which events to send

Pass the API key from trusted server-side configuration and verify a real event with SQL. Anonymous keys support this workflow; claim the workspace before creating dashboards. Keep the Python User-Agent header so requests reach the API.

typescript

TypeScript telemetry wrapper

javascript
type TelemetryEvent = Record<string, unknown>;

export async function emitTelemetry(
  apiKey: string,
  table: string,
  data: TelemetryEvent,
) {
  const response = await fetch("https://api.telemetry.sh/log", {
    method: "POST",
    headers: {
      Authorization: apiKey,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ table, data }),
  });

  if (!response.ok) {
    throw new Error(`Telemetry ingestion failed: ${response.status}`);
  }
}
python

Python telemetry wrapper

python
import json
from urllib.request import Request, urlopen

def emit_telemetry(api_key: str, table: str, data: dict) -> int:
    request = Request(
        "https://api.telemetry.sh/log",
        data=json.dumps({"table": table, "data": data}).encode(),
        headers={
            "Authorization": api_key,
            "Content-Type": "application/json",
            "User-Agent": "telemetry-agent/1.0",
        },
        method="POST",
    )
    with urlopen(request, timeout=5) as response:
        return response.status

Start here

Paste the setup instructions

Replace the placeholder with a server-side API key, then ask the agent to inspect the repository before choosing event boundaries.

agent prompt

AI agent observability prompt

text
Instrument this project with structured logs using /skill.md.

Use this Telemetry API key: YOUR_API_KEY

Anonymous keys support logging and synchronous SQL without signup. Claim the existing workspace at https://telemetry.sh/register with the same key before creating dashboards or alerts. If it is unclaimed, query the event to verify delivery and report which features need signup.

Please:
1. Find the most important user-facing flows, background jobs, and AI/tooling workflows.
2. Add structured logging with snake_case table and field names.
3. Capture the key signals for each workflow, including status, latency, identifiers, and error context when relevant.
4. Run one real user-facing or operational flow through the instrumented application and verify its event appears in Telemetry. Do not use telemetry_quickstart for this milestone.
5. Run a read-only query over that real event, then create a high-level dashboard with charts and tables that summarize the most important signals in this project.
6. Tell me what you instrumented, which real flow you verified, which tables you created, and which dashboard views I should review first.

Keep event payloads small and focused. Make dashboard labels and charts easy to scan.

Review boundary

Have your team review the event fields

The skill helps an agent choose where to add events. Your team decides what each event means, which fields it may contain, how long to keep it, and when to alert.

  • Review every new table and field before deployment.
  • Use approved identifiers. Keep private payloads out of events.
  • Verify success, failure, and terminal outcomes.

Continue the workflow

Add events, then check the results

Start free with a provisioned workspace, API key, agent prompt, and starter dashboard. Connect one real workflow, verify the event, and save the first useful query.