mit einem Klick
instrument-agent
// Set up Raindrop AI traces for an agent and verify they flow into Workshop.
// Set up Raindrop AI traces for an agent and verify they flow into Workshop.
| name | instrument-agent |
| description | Set up Raindrop AI traces for an agent and verify they flow into Workshop. |
| when_to_use | Use when the user says "set up traces", "add tracing", "instrument my agent", "wire Raindrop", "Workshop is empty", or "make traces show up in Workshop." Guides unknown repos by discovering runtime and telemetry setup, using current Raindrop docs/package types, making the smallest safe change, and proving one useful Workshop run. |
You are helping instrument an AI agent so its next meaningful run appears in Raindrop Workshop. Workshop is the local viewer; it does not run the agent. The user's agent app runs the workflow, the Raindrop SDK captures model/tool boundaries and context, and Workshop renders that telemetry as a debuggable run.
Use supported Raindrop SDK/integration paths. Do not hand-wire Workshop ingestion endpoints or invent SDK APIs. If the repo's telemetry setup is too custom to instrument safely, stop with a clear handoff to the Raindrop docs or team.
Raindrop SDK and integration APIs move quickly. Before writing code, fetch docs in parallel: the docs index, the likely stack-specific page, and installed package README/types when available.
https://raindrop.ai/docs/llms.txthttps://raindrop.ai/docs/introductionhttps://raindrop.ai/docs/integrations/overviewhttps://raindrop.ai/docs/sdk/typescript, /sdk/python, /sdk/rust, /sdk/go, /sdk/http-api, /sdk/browserhttps://raindrop.ai/docs/integrations/<name> such as vercel-ai-sdk, claude-agent-sdk, langchain, openai-agents, pydantic-ai, google-adk, bedrock, azure-openai, vertex-aiUse this skill for the workflow and Workshop-specific judgment. Use the docs and installed package README/types for exact install commands, imports, options, and signatures.
One useful Workshop run should show:
Most integrations use one of three shapes:
begin when one invocation starts, run the model/tool loop, then finish with output or error. Use this for Python, Rust, TypeScript core SDK, and custom loops.Do a quick read-only pass:
python --version, package version, and the actual raindrop.analytics surface before assuming current docs apply.opentelemetry, NodeSDK, TracerProvider, Sentry.init, Datadog, Honeycomb, Traceloop, LangSmith, RAINDROP_*.curl -fsS http://localhost:5899/health.Timebox this phase. If discovery is not converging quickly, report what you know and ask the smallest concrete question.
Ask only when the next edit would otherwise be a guess. Keep it concrete:
apps/api/src/chat.ts and workers/agent.ts. Which should appear in Workshop first?"src/sentry.ts and src/otel.ts. Which telemetry initializer runs in this agent process?"Goal: prove the local trace path works with the smallest top-level instrumentation. A successful Phase 1 may show only a basic interaction summary in Workshop; it does not need complete LLM/tool span coverage.
Make the smallest change:
RAINDROP_LOCAL_DEBUGGER=http://localhost:5899/v1/.begin before the invocation and finish after final output/error.Phase 1 troubleshooting:
begin/finish, confirm both run in the invoked path and flush/close happens before short-lived processes exit.Goal: turn the Phase 1 run into a useful debugging trace.
After Phase 1 works:
properties: tenant/org/workspace, request/job/session/conversation IDs, route/source/surface. Do not invent placeholders.Phase 2 troubleshooting:
Always consult docs first, then use the notes below to decide.
Docs: https://raindrop.ai/docs/sdk/typescript
Hard version gate: require the latest available raindrop-ai package for TypeScript/JavaScript core SDK instrumentation, and never lower than 0.0.90. If the repo has an older installed package, update first or stop and report the version mismatch.
Use for custom TypeScript/Node agents and direct provider SDK calls. The core shape is:
const raindrop = new Raindrop({
writeKey: process.env.RAINDROP_WRITE_KEY,
endpoint: process.env.RAINDROP_ENDPOINT ?? process.env.RAINDROP_LOCAL_DEBUGGER,
});
const interaction = raindrop.begin({
eventId,
event: "agent_name",
userId,
input,
convoId,
properties,
});
try {
const output = await runAgentLoop();
interaction.finish({ output, model });
} catch (err) {
interaction.finish({ output: `Error: ${err instanceof Error ? err.message : String(err)}` });
throw err;
} finally {
await raindrop.flush();
}
In Phase 2, use the current docs/package types for manual span/tool helpers and only wrap real execution boundaries.
Docs: https://raindrop.ai/docs/integrations/vercel-ai-sdk
Use @raindrop-ai/ai-sdk. This integration is designed to avoid manual OpenTelemetry setup. The docs cover:
raindrop.wrap(ai, ...),eventMetadata(...),Gotchas to keep inline:
eventMetadata(...) is call metadata, not a side effect.Docs: https://raindrop.ai/docs/integrations/claude-agent-sdk
Use @raindrop-ai/claude-agent-sdk. The docs cover wrapping the Claude Agent SDK, passing eventMetadata() to tracked query() calls, auto tool tracing, subagent hierarchy, flush/shutdown, and debugging.
Gotcha: calls without eventMetadata() may run normally but not be tracked by Raindrop, depending on the installed package behavior.
Docs: https://raindrop.ai/docs/sdk/python
Use raindrop-ai. For Phase 1, prefer raindrop.begin(...) before the custom loop and interaction.finish(...) after final output/error. This proves Workshop connectivity without needing perfect tool spans.
For Python custom loops:
raindrop-ai versions first, then update raindrop-ai to the latest available version before editing instrumentation.track_ai as a Workshop Phase 1 path. If the installed package only exposes track_ai, stop and report that this package version cannot produce a visible Workshop run with the current local ingestion behavior.begin/finish.Docs: https://raindrop.ai/docs/sdk/rust
Use the Rust raindrop-ai crate and the installed crate docs/API. The docs describe Client::begin, Interaction::finish, Client::flush/close, track_ai, manual spans, and tool spans.
Keep guidance short:
begin/finish, then flush or close.Docs index: https://raindrop.ai/docs/llms.txt
For LangChain, OpenAI Agents SDK, Pydantic AI, Google ADK, Bedrock, Azure OpenAI, Vertex AI, CrewAI, Strands, and similar frameworks, prefer the matching integration docs over inventing generic wrappers.
If no supported integration fits, stop gracefully:
I could not find a safe Raindrop SDK/integration path for this setup. Please consult the Raindrop docs or reach out to the Raindrop team with the agent entry point and telemetry setup files.
This is the main case where the skill should add value beyond docs.
If the app already owns telemetry:
NodeSDK, tracer provider, or equivalent global provider.instrumentModules; use only what installed docs/types require.If you cannot identify the telemetry owner, ask for that file or stop with a handoff to docs/team.
Use the strongest available check:
Confirm the run is useful:
If a run exists but content is not useful, verification failed. Keep diagnosing or stop with exact evidence.
Verified:
Wired. I ran the agent once and confirmed a useful Workshop run at http://localhost:5899.
Needs user run:
Wired. Workshop is running at http://localhost:5899. Run
<command>now; the next run should appear in Workshop. If it stays empty, we can debug further!
Blocked:
I stopped before guessing.
<specific ambiguity/failure>. The next step is<specific user choice or docs/team handoff if nothing truly works (try your hardest before doing this. For Team handoff, report diagnostics, code skeleton without revealing too much about user's proprietary code)>.