Claude Agent SDK

Automatically instrument Claude Agent SDK for monitoring in Astro AI
View as Markdown

Instrument a Claude Agent SDK agent so its query() calls, sub-agent steps, tool calls, and model invocations appear in the Astro AI dashboard. @astropods/adapter-claude-agent-sdk is a drop-in replacement for @anthropic-ai/claude-agent-sdk that re-exports the entire SDK surface with query() instrumented for OpenTelemetry.

The current version supports @anthropic-ai/claude-agent-sdk ^0.3.142.

Before you start

  • A deployable Astro AI agent project built with the Claude Agent SDK.
  • Astro AI sets OTEL_EXPORTER_OTLP_ENDPOINT only on deployed containers, so traces appear once the agent runs on the platform — not during local development.

Set up

1

Install the adapter

Add @astropods/adapter-claude-agent-sdk and remove any direct dependency on @anthropic-ai/claude-agent-sdk.

1{
2 "dependencies": {
3 "@astropods/adapter-claude-agent-sdk": "^0.5.0"
4 }
5}
$bun install
2

Update imports

Point existing imports at the adapter:

1import { query, tool, AbortError, type SDKMessage } from "@astropods/adapter-claude-agent-sdk";

The full Claude Agent SDK surface is available, with small patches applied to auto-instrument your agent for monitoring in Astro AI.

3

Verify

Deploy the agent, send it a message, then open the agent’s detail page in the Astro AI dashboard. Traces appear within ~30 seconds.

Troubleshooting

If nothing shows up:

  • Confirm OTEL_EXPORTER_OTLP_ENDPOINT is present in the deployed container.
  • Confirm every import of @anthropic-ai/claude-agent-sdk in your codebase has been switched to @astropods/adapter-claude-agent-sdk.
  • Check the agent container logs for OpenTelemetry export errors.