kjuhwa/skills-hub/agent-tracing-spans

Claude Code and agent skill by kjuhwa/skills-hub

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Wrap multi-agent workflows in named traces and custom spans for debugging in the OpenAI Traces dashboard.

Install

npx vskill@latest install kjuhwa/skills-hub/agent-tracing-spans

SKILL.md

The same SKILL.md was published earlier as kjuhwa/skills-hub/agent-tracing-spans.

agent-tracing-spans

Use the trace() context manager to group multiple Runner.run() calls into a single workflow trace. Use custom_span() to add arbitrary spans. Built-in spans (agent, generation, tool, handoff) are created automatically.

When to apply

Debugging complex multi-agent workflows, performance profiling, or monitoring production agent runs. The OpenAI Traces dashboard at platform.openai.com/traces visualizes the tree.

Core snippet

python
import asyncio
import uuid
from agents import Agent, Runner, trace, custom_span, gen_trace_id
agent = Agent(name="Assistant", instructions="Be helpful.")
async def main():
conversation_id = str(uuid.uuid4().hex[:16])
# Multiple runs in one trace
with trace("My workflow", group_id=conversation_id):
result1 = await Runner.run(agent, "Step 1 input")
result2 = await Runner.run(agent, result1.to_input_list() + [{"role": "user", "content": "Step 2"}])
# Custom spans for non-agent work
with trace("Data pipeline"):
with custom_span("fetch_data"):
data = fetch_data() # your code
result = await Runner.run(agent, str(data))

Background worker flush

python
from agents import Runner, trace, flush_traces
# In Celery/FastAPI background tasks:
def run_agent_task(prompt: str):
try:
with trace("celery_task"):
result = Runner.run_sync(agent, prompt)
return result.final_output
finally:
flush_traces() # Ensure immediate export

Disable tracing

python
from agents import set_tracing_disabled
set_tracing_disabled(True) # Globally
# Per-run:
from agents import RunConfig
run_config = RunConfig(tracing_disabled=True)
result = await Runner.run(agent, "Hello", run_config=run_config)

Key notes

  • Tracing is enabled by default; disable with OPENAI_AGENTS_DISABLE_TRACING=1 env var
  • trace(workflow_name, group_id=...) groups multi-turn conversations
  • flush_traces() blocks until buffered traces are exported (use in background workers)
  • gen_trace_id() generates a valid trace_<32_alphanumeric> ID

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/kjuhwa/skills-hub/agent-tracing-spans/badge)](https://verified-skill.com/skills/kjuhwa/skills-hub/agent-tracing-spans)

Something wrong with this skill or its page? Tell us.