diagnose and fetch: Analyze session failures
strands-evals diagnose runs the detectors pipeline on a serialized Session, and strands-evals fetch produces that Session JSON from a remote trace provider. Together they diagnose a production session in one pipe.
diagnose: Detect failures and analyze root causes
Section titled “diagnose: Detect failures and analyze root causes”diagnose operates on a serialized Session (the same Session object trace-based evaluators consume). Three modes:
# Full pipeline: detect failures and analyze root causesstrands-evals diagnose session.json --confidence medium
# Detection onlystrands-evals diagnose session.json --detect-only --confidence high
# Root cause analysis onlystrands-evals diagnose session.json --rca-only
# Read from stdin, write JSON to a filecat session.json | strands-evals diagnose - --output diagnosis.json--confidenceis the minimum confidence threshold for failure detection (low|medium|high, defaultlow).--model MODEL_IDoverrides the judge model used for detection and RCA.--detect-onlyand--rca-onlyare mutually exclusive; omit both for the full pipeline.- A one-line summary is always written to stderr (
diagnosis: N failure(s), M root cause(s)), so the command is scriptable even when the rich output goes to a TTY.
See Detectors for the underlying API.
fetch: Pull a Session from a provider
Section titled “fetch: Pull a Session from a provider”fetch wraps a TraceProvider and writes a Session JSON for a single session id, ready to pipe into strands-evals diagnose -. Each provider is its own sub-subcommand; credentials come from environment variables rather than flags.
# CloudWatch: either --log-group or --agent-name (not both)strands-evals fetch cloudwatch \ --session-id abc123 \ --agent-name customer-service \ --region us-east-1 \ -o session.json
# Langfuse (requires the langfuse extra)strands-evals fetch langfuse --session-id abc123 -o session.json
# OpenSearch (requires the opensearch extra)strands-evals fetch opensearch \ --session-id abc123 \ --host https://localhost:9200 \ --username admin --password "$OS_PASSWORD" \ -o session.json
# Fetch and diagnose in one pipestrands-evals fetch cloudwatch --session-id abc123 --agent-name customer-service \ | strands-evals diagnose - --confidence mediumcloudwatchis always available (boto3 is a runtime dependency). Supply exactly one of--log-groupor--agent-name;--agent-namediscovers the log group viadescribe_log_groups.--lookback-daysdefaults to30.langfuserequirespip install strands-agents-evals[langfuse]and readsLANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEYfrom the environment.opensearchrequirespip install strands-agents-evals[opensearch]. Pass--usernameand--passwordtogether for basic auth, or--no-verify-certsfor local endpoints.
Output is always JSON. Without -o, the Session JSON goes to stdout.
Next steps
Section titled “Next steps”- Detectors: the API behind
strands-evals diagnoseand theSessionshapefetchproduces. - Evaluating remote traces: the providers behind
fetchand how to score remote traces with evaluators. run: run diagnosis automatically on failing cases during an experiment.