microsoft/agents/agents-sdk-typescript-otel
Claude Code and agent skill by microsoft/agents
- vendor
Checking that the SKILL.md file is still in the repository.
Use when adding, configuring, validating, or troubleshooting OpenTelemetry observability for a Microsoft 365 Agents SDK application in JavaScript or TypeScript. Trigger when the user mentions OpenTelemetry, OTel, telemetry, traces, metrics, logs, OTLP, Aspire Dashboard, Application Insights, Azure Monitor, distributed tracing, custom tracers or meters, or observing @microsoft/agents-telemetry signals.
Install
npx vskill@latest install microsoft/agents/agents-sdk-typescript-otelSKILL.md
The same SKILL.md was published earlier as microsoft/agents/agents-sdk-typescript-otel.
OpenTelemetry for Agents SDK (JavaScript/TypeScript)
Goal
Configure traces, metrics, and logs for an Agents SDK application, including the SDK's built-in telemetry and a local Aspire Dashboard. Make the smallest complete change that fits the project's module system, build process, package manager, and existing observability architecture.
Non-negotiable rules
- Inspect the project before editing. Extend an existing OpenTelemetry SDK
registration instead of creating a second global provider.
- Start the OpenTelemetry SDK before importing the Agents SDK, HTTP, Express,
or the application entry point. Preload instrumentation with Node's --import or --require option.
- Use a stable application-specific
service.name. - Let OTLP exporters read standard environment variables. Never embed
collector credentials, API keys, or connection strings in source.
- Do not force all OpenTelemetry packages to the same version. The JavaScript
package family intentionally mixes stable API/SDK versions and 0.x exporter/instrumentation versions. Install a compatible set together and preserve the lockfile.
- Never add message text, prompts, responses, tokens, authorization headers,
cookies, secrets, attachment contents, user names, user IDs, conversation IDs, activity IDs, or arbitrary HTTP headers to custom telemetry by default.
- Keep custom metric attributes low-cardinality. Good dimensions include
route type, activity type, channel ID, operation, status, and error type.
- Do not configure always-on sampling as a production default. Honor
OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG.
- Explicitly flush telemetry during shutdown. Do not silently ignore exporter
or shutdown errors.
- Aspire Dashboard anonymous mode is local-development only. Bind it to
loopback and never deploy that configuration.
- Telemetry must record and rethrow application errors, not swallow them.
Workflow
Complete these steps in order.
1. Inspect the application
Find:
package.json, the lockfile, Node engine version, and package manager.- Whether the project uses ESM (
"type": "module") or CommonJS. - The TypeScript output directory and current start/build scripts.
- The application entry point and whether it uses
startServer(), Express, or
another host.
- Existing imports from
@opentelemetry/*,
@microsoft/agents-telemetry, or logging integrations.
- Existing
NodeSDK, tracer provider, meter provider, logger provider,
exporters, processors, instrumentations, and shutdown hooks.
- Existing OTEL settings in
.envtemplates, deployment manifests,
container definitions, and CI/CD configuration.
If observability already exists, add the missing Agents SDK-compatible global providers and keep the existing exporters and instrumentations unless the user requested a change.
2. Add a compatible package set
Use the repository's package manager. For npm:
Adapt the command for pnpm or yarn. Install the packages in one operation so the package manager can resolve compatible peers. Do not manually rewrite the resolved versions into one shared version number.
@microsoft/agents-telemetry is required as a direct dependency when application code imports SpanNames or MetricNames; do not rely on the Agents SDK's transitive copy.
Use OTLP/HTTP exporter packages instead of the gRPC exporters only when the collector requires http/protobuf.
3. Create the preload instrumentation module
Create src/instrumentation.ts or the equivalent path. Adapt the default service name and version:
Before using the signal-handler example, check the application's existing shutdown behavior. Prefer integrating otelSdk.shutdown() into the existing graceful shutdown path so the HTTP server, storage, and telemetry all close in the correct order. Do not register duplicate signal handlers.
If the installed semantic-conventions package does not expose ATTR_SERVICE_INSTANCE_ID, use the literal stable semantic key 'service.instance.id'.
The NodeSDK installs global trace, metric, context, propagation, and log providers. Agents SDK telemetry uses those global APIs automatically; no Agents-specific instrumentation registration is required.
4. Preload instrumentation before the application
For an ESM TypeScript project that compiles to dist:
For CommonJS, use --require:
Do not import instrumentation.ts from the bottom of the application entry point. By then, HTTP or framework modules may already be loaded and cannot be patched reliably.
If a test runner, worker, background process, or alternate start script executes the agent independently, preload instrumentation there too when that process should emit telemetry.
5. Configure OTLP
For the local Aspire Dashboard using OTLP/gRPC, add non-secret defaults to the uncommitted .env and document them in .env.example or env.TEMPLATE:
Standard environment variables to support:
| Variable | Purpose | |
|---|---|---|
OTEL_SERVICE_NAME | Stable application service name | |
OTEL_RESOURCE_ATTRIBUTES | Stable resource metadata | |
OTEL_EXPORTER_OTLP_ENDPOINT | Base OTLP collector endpoint | |
OTEL_EXPORTER_OTLP_PROTOCOL | Usually grpc or http/protobuf | |
OTEL_EXPORTER_OTLP_HEADERS | Collector authentication headers; keep secret | |
OTEL_TRACES_SAMPLER | Trace sampling strategy | |
OTEL_TRACES_SAMPLER_ARG | Sampling strategy argument | |
OTEL_METRIC_EXPORT_INTERVAL | Metric export interval in milliseconds |
Use deployment secrets for OTEL_EXPORTER_OTLP_HEADERS and Azure Monitor connection strings. Do not commit populated .env files.
6. Add custom business telemetry only when useful
The Agents SDK already emits adapter, application, turn, connector, storage, authentication, authorization, proactive, dialog, and Copilot Studio signals. Add custom telemetry only for application-specific operations.
Create one shared helper:
Instrument a route with bounded attributes:
Do not add conversation, activity, user, prompt, response, URL, or exception message values to custom metrics. Use the standard application logger or the OpenTelemetry Logs API for operational messages, but keep sensitive content out of both.
7. Set up the Aspire Dashboard
Copy assets/start-aspire-dashboard.ps1 from this skill into a local scripts directory and run:
Open http://localhost:18888. The script:
- Binds the UI and OTLP ports to
127.0.0.1. - Exposes OTLP/gRPC on
4317and OTLP/HTTP on4318. - Enables unsecured access only for local development.
- Pulls
mcr.microsoft.com/dotnet/aspire-dashboard:latest.
Do not start a second container if aspire-dashboard already exists. Reuse or stop the existing container:
8. Validate end to end
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 31 Oct 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingagent-plugins/agents-for-js/skills/agents-sdk-typescript-otel/SKILL.md
Popularity
- Repository stars
- 1,066
- Repository forks
- 340
- 7-day trend score
- 35
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/agents/agents-sdk-typescript-otel)