Langfuse trace
Start and finalize a Langfuse trace tagged with app_id, agent_role, session_id. Wraps every LLM call, tool call, and session-level event. Required on every reasoning step per the non-negotiable full-reasoning-logs rule.From its SKILL.md
npx -y skills add rczamor/rz-agent-team --skill langfuse-traceAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.0 KB, as published. Nobody here has run it
langfuse-trace
Purpose
Emit observability so every LLM call and tool call is traceable back to app, role, and session. Enforces the three required labels — app_id, agent_role, session_id — on every trace. This is rule #1 in TEAM.md.
When to invoke
--action startat session top; returns atrace_idreused for child spans.--action spanaround each LLM call (prompt, response, tokens, model, cost) and non-trivial tool call.--action eventfor handoffs, memory writes, BLOCKER posts.--action finalizeat session end with status + summary.
Every agent, every session.
Required env vars
LANGFUSE_HOST— internalhttp://langfuse-web:3000or externalhttps://langfuse-<suffix>.srv1535988.hstgr.cloud.LANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEY— API keys from/docker/langfuse/.envon VPS.SESSION_APP_ID— app tag (required label).AGENT_ROLE— one of the 11 roster roles (required label).SESSION_ID— Conductor-assigned session UUID (required label).
Input
Flags to scripts/langfuse_trace.sh:
--action <start|span|event|finalize>(required).--name <string>(required) — e.g."session.conductor.dispatch","llm.plan-review".--trace-id <id>(required for span/event/finalize; returned by start).--parent-id <id>(optional) — nest under another span.--input <json>/--output <json>(optional) — payloads for LLM/tool spans.--metadata <json>(optional) — model, tokens, cost, latency_ms, tool_name.--status <success|error>(finalize only).
Output
JSON on stdout: { "trace_id": "...", "span_id": "...", "url": "https://langfuse.../trace/..." }. Non-zero exit on API failure.
Example invocation
TRACE=$(bash scripts/langfuse_trace.sh --action start --name "session.backend-eng.sia-CAR-198")
TRACE_ID=$(echo "$TRACE" | jq -r .trace_id)
bash scripts/langfuse_trace.sh --action span --trace-id "$TRACE_ID" \
--name "llm.generate-migration" \
--input '{"prompt":"..."}' --output '{"response":"..."}' \
--metadata '{"model":"claude-opus-4-7","input_tokens":2100,"output_tokens":540,"cost_usd":0.042}'
bash scripts/langfuse_trace.sh --action finalize --trace-id "$TRACE_ID" --status success
Implementation notes
- Attach
tags: [app_id, agent_role, session_id]on the root trace; propagate to children. - Use Langfuse SDK if available, else
curlagainst/api/public/ingestion. - Batch spans and flush every 5s or on
finalize. - Retry 5xx with backoff 1s/2s/4s; fail loud after 3 attempts.
- Prefer internal
langfuse-web:3000from inside Docker; external URL only from outside the VPS. - Redact
authorizationheaders in stderr logs. - Always include
cost_usdwhen known — drives DevOps cost reports.