Traces Commands

Traces commands are available for Langfuse provider. They allow you to list, inspect, and search through your LLM traces.

shepherd traces list

List traces from Langfuse.

shepherd traces list [OPTIONS]

Options:

Option

Short

Description

--output

-o

Output format: table or json

--limit

-n

Max traces to display (default: 50)

--page

-p

Page number

--name

Filter by trace name

--user-id

-u

Filter by user ID

--session-id

-s

Filter by session ID

--tag

-t

Filter by tag (can specify multiple)

--from

Filter traces after timestamp

--to

Filter traces before timestamp

--ids

Print only trace IDs

Examples:

shepherd traces list
shepherd traces list -n 20
shepherd traces list --name "chat-completion"
shepherd traces list --user-id alice --tag production
shepherd traces list -o json
shepherd traces list --ids

shepherd traces get

Get details for a specific trace.

shepherd traces get <trace-id> [OPTIONS]

Options:

Option

Short

Description

--output

-o

Output format: table or json

Examples:

shepherd traces get abc123
shepherd traces get abc123 -o json

Explicit Langfuse Commands

Use these to bypass provider routing:

shepherd langfuse traces list
shepherd langfuse traces get abc123
shepherd langfuse traces search --tag production

Scripting

# Process traces in a loop
for tid in $(shepherd traces list --ids -n 10); do
    shepherd traces get "$tid" -o json > "trace_${tid}.json"
done

# Pipe to jq
shepherd traces list -o json | jq '.traces[].name'

# Get latest trace
LATEST=$(shepherd traces list --ids -n 1)
shepherd traces get "$LATEST"

# Find expensive traces
shepherd traces search --min-cost 0.10 --ids

# Export production traces
shepherd traces search --tag production -o json > production_traces.json

# Analyze slow traces
for tid in $(shepherd traces search --min-latency 10.0 --ids); do
    echo "Analyzing trace: $tid"
    shepherd traces get "$tid" -o json | jq '.latency, .totalCost'
done