Confident Tracing Skill
Teach your agent to instrument Python and TypeScript AI apps with confident-trace integrations and custom spans.
Overview
The confident-tracing Agent Skill teaches your coding agent how to instrument an AI application with the Python or TypeScript confident-trace SDK so every model call, retrieval, tool call, and agent step appears span by span in Confident AI.
Its scope is deliberately narrow: producing well-formed traces. The skill detects the language, framework, model provider, agent SDK, gateway, bundler, and existing OpenTelemetry setup; prefers a supported integration; falls back to custom @span, span(), or withSpan() instrumentation where needed; and adds useful trace context. Attaching metrics and running evals belongs to the deepeval skill.
When It Triggers
The skill activates on prompts like:
Instrument this app with Confident Trace.
Add automatic tracing to my LangGraph agent.
Add @span around the custom retriever in this Python RAG pipeline.
Make my TypeScript agent's OpenAI calls appear in Confident AI.Installation
Works with Cursor, Claude Code, Codex, Windsurf, OpenCode, and any other Skills-compatible assistant:
npx skills add confident-ai/confident-trace --skill "confident-tracing"The Confident Trace plugin bundles both confident-tracing and confident-otel:
/plugin marketplace add confident-ai/confident-trace
/plugin install confident-trace@confident-trace-plugins
/reload-pluginsCopy the skill folder into your agent's skills directory:
git clone https://github.com/confident-ai/confident-trace
cp -r confident-trace/skills/confident-tracing .claude/skills/Prerequisites
- Python 3.10+ or Node.js 22+
confident-traceinstalled in the application- A project-scoped
CONFIDENT_API_KEYfor export to Confident AI
What Changes in Your Codebase
Ask for tracing
The agent detects the language and AI stack, reads the current
confident-traceintegration documentation, and chooses automatic instrumentation whenever a supported integration exists.Prompt Instrument this agent with confident-trace and send its traces to Confident AI.Initialize the SDK
In Python, the agent installs
confident-traceand callsinit()once before provider or framework calls:import confident_trace as ct ct.init()In TypeScript, automatic instrumentation requires both
init()in the entry file and the Node registration preload:import { init } from "confident-trace"; const tracing = init();node --import confident-trace/register dist/index.jsAdd custom spans where integrations cannot
The agent adds custom spans only around application-owned boundaries or unsupported components. It uses one of the five supported span types:
agent,llm,retriever,tool, orcustom.Python example
import confident_trace as ct @ct.span(type="retriever") def retrieve(query: str) -> list[str]: documents = search(query) ct.update_span(input=query, retrieval_context=documents) return documentsTypeScript example
import { span, updateSpan } from "confident-trace"; const retrieve = span( { name: "retrieve", type: "retriever" }, async (query: string) => { const documents = await search(query); updateSpan({ input: query, retrievalContext: documents }); return documents; }, );Add trace and conversation context
The agent uses
update_trace()orupdateTrace()for trace input, output, tags, metadata, user ID, thread ID, turn ID, and environment. It usesturn()when each conversation turn must start a separate trace while remaining associated with the same thread.with ct.turn(thread_id="chat-42", turn_id="2", input=user_input): answer = run_agent(user_input) ct.update_trace(output=answer)Verify traces
The agent finishes active work and streams before flushing or shutting down, then verifies the trace hierarchy in Confident AI:
export CONFIDENT_API_KEY="confident_us_proj_..." python main.py
FAQs
Which integrations does the skill support?
The skill covers the integrations implemented by the current
confident-trace SDK. Python includes OpenAI, Anthropic, Google GenAI,
Bedrock, LangChain, LangGraph, OpenAI Agents, CrewAI, LlamaIndex, Agno,
smolagents, Google ADK, Microsoft Agent Framework, Pydantic AI, Strands,
AgentCore, Claude Agent SDK, and supported LLM gateways. TypeScript includes
OpenAI, Anthropic, Google GenAI, Vercel AI SDK, LangChain, LangGraph, Mastra,
OpenAI Agents, and supported gateways. The skill reads the repository's
current integration docs before writing setup code.
Will it trace my whole backend?
No. It instruments AI components only: agent loops, model calls, retrieval, tool calls, and application boundaries that organize them.
Does it work in both Python and TypeScript?
Yes. Python uses @span and span context managers. TypeScript uses
span() and withSpan() and requires the
confident-trace/register preload for automatic instrumentation.
Does it attach metrics or run evals?
No. Its job ends at producing well-formed traces. Use the
deepeval skill for evaluation
suites, datasets, metrics, and test runs.
Next Steps
LLM Tracing Quickstart
See the underlying Confident Trace setup the skill automates.
Confident OpenTelemetry Skill
Export raw OpenTelemetry when you do not want the Confident Trace SDK.
Last updated on