langgraph-testing-evaluation

用于测试与评估 LangGraph/LangChain 代理:编写单元或集成测试、生成测试脚手架、模拟 LLM/工具行为、运行轨迹评估(匹配或以 LLM 作为评判)、运行 LangSmith 数据集评估,以及通过离线 A/B 风格分析比较两个代理版本。适用于 Python 与 JavaScript/TypeScript 的评估器设计、实验设置、回归门控与不稳定评估结果的调试。

仓库最近推送
GitHub Stars
106
Forks
16
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "langgraph-testing-evaluation":https://skillpi.com/zh/skills/deepskill-e766a3fe9745563e09168457de5260b935c3cc8199ac3ffc6571aedc7fd7059a。安装前核对上游来源和版本:https://github.com/soba-labs/langchain-agent-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

用于测试与评估 LangGraph/LangChain 代理:编写单元或集成测试、生成测试脚手架、模拟 LLM/工具行为、运行轨迹评估(匹配或以 LLM 作为评判)、运行 LangSmith 数据集评估,以及通过离线 A/B 风格分析比较两个代理版本。适用于 Python 与 JavaScript/TypeScript 的评估器设计、实验设置、回归门控与不稳定评估结果的调试。

0 下载

介绍来源: third_party · soba-labs · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
来源文档未说明。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: langgraph-testing-evaluation
description: "Use this skill when you need to test or evaluate LangGraph/LangChain agents: writing unit or integration tests, generating test scaffolds, mocking LLM/tool behavior, running trajectory evaluation (match or LLM-as-judge), running LangSmith dataset evaluations, and comparing two agent versions with A/B-style offline analysis. Use it for Python and JavaScript/TypeScript workflows, evaluator design, experiment setup, regression gates, and debugging flaky/incorrect evaluation results."

LangGraph Testing & Evaluation

Practical workflows for validating agent quality with:

  • Unit/integration tests
  • Trajectory evaluation
  • LangSmith dataset evaluations
  • A/B-style comparisons between versions

Use this file for high-level flow. Load references/* for detailed implementation.

Start Here

Choose the smallest approach that answers your question:

Goal Primary method Load first
Validate node logic quickly Unit tests with mocks references/unit-testing-patterns.md
Validate multi-step agent behavior Trajectory evaluation references/trajectory-evaluation.md
Track quality over datasets over time LangSmith evaluation references/langsmith-evaluation.md
Compare old vs new agent versions A/B comparison references/ab-testing.md

Recommended order:

  1. Unit tests
  2. Integration/trajectory checks
  3. Dataset evaluation in LangSmith
  4. A/B comparison before deployment

Quick Commands

Run from repo root.

Generate test scaffolding

# Python (preferred)
uv run skills/langgraph-testing-evaluation/scripts/generate_test_cases.py my_agent:graph --output tests/ --framework pytest

# JavaScript/TypeScript
node skills/langgraph-testing-evaluation/scripts/generate_test_cases.js ./my-agent.ts:graph --output tests/ --framework vitest

Run trajectory evaluation

# Python: LLM-as-judge
uv run skills/langgraph-testing-evaluation/scripts/run_trajectory_eval.py my_agent:run_agent my_dataset --method llm-judge --model openai:o3-mini

# Python: trajectory match
uv run skills/langgraph-testing-evaluation/scripts/run_trajectory_eval.py my_agent:run_agent dataset.json --method match --trajectory-match-mode strict --reference-trajectory reference.json

# JavaScript/TypeScript
node skills/langgraph-testing-evaluation/scripts/run_trajectory_eval.js ./agent.ts:runAgent my_dataset --method llm-judge --model openai:o3-mini --max-concurrency 4

Run LangSmith dataset evaluation

# Python
uv run skills/langgraph-testing-evaluation/scripts/evaluate_with_langsmith.py my_agent:run_agent my_dataset --evaluators accuracy,latency --max-concurrency 4

# Python (do not upload experiment results)
uv run skills/langgraph-testing-evaluation/scripts/evaluate_with_langsmith.py my_agent:run_agent my_dataset --evaluators accuracy --no-upload

# JavaScript/TypeScript
node skills/langgraph-testing-evaluation/scripts/evaluate_with_langsmith.js ./agent.ts:runAgent my_dataset --evaluators accuracy,latency --max-concurrency 4

Compare two agent versions

# Python
uv run skills/langgraph-testing-evaluation/scripts/compare_agents.py my_agent:v1 my_agent:v2 dataset.json --output comparison_report.json

# JavaScript/TypeScript
node skills/langgraph-testing-evaluation/scripts/compare_agents.js ./v1.ts:run ./v2.ts:run dataset.json --output comparison_report.json

# JavaScript/TypeScript (force local dataset file only)
node skills/langgraph-testing-evaluation/scripts/compare_agents.js ./v1.ts:run ./v2.ts:run dataset.json --no-langsmith

Create mock response configs

# Python
uv run skills/langgraph-testing-evaluation/scripts/mock_llm_responses.py create --type sequence --output mock_config.json

# JavaScript/TypeScript
node skills/langgraph-testing-evaluation/scripts/mock_llm_responses.js create --type sequence --output mock_config.json

Core Workflow

  1. Define test scope.
  • Unit: deterministic logic in one node/function.
  • Integration: node interactions and routing.
  • End-to-end: complete response quality on realistic inputs.
  1. Start from deterministic checks.
  • Mock LLM/tool IO for speed and repeatability.
  • Keep real-model tests as a smaller, explicit suite.
  1. Build/curate dataset examples.
  • Use stable inputs and expected outputs.
  • Keep schema simple: inputs and outputs objects (optional metadata).
  • Compatibility note: scripts also accept singular keys (input, output) for legacy datasets.
  1. Run evaluation with explicit gates.
  • Use evaluator keys that map to deployment decisions.
  • Set thresholds in CI for regression prevention.
  1. Compare versions before rollout.
  • Run same dataset on both versions.
  • Check both quality and latency.
  1. Diagnose failures from traces/experiments.
  • Inspect low-scoring examples.
  • Split failures by pattern (routing, tool usage, hallucination, latency spikes).

Current References (Load On Demand)

references/unit-testing-patterns.md

Load when:

  • You need node-level and routing test patterns.
  • You need pytest/vitest/Jest integration patterns.
  • You need robust mocking and flaky-test reduction.

references/trajectory-evaluation.md

Load when:

  • You need trajectory match evaluation (strict, unordered, subset, superset).
  • You need LLM-as-judge trajectory scoring.
  • You need LangSmith experiment comparison for trajectory results.

references/langsmith-evaluation.md

Load when:

  • You need dataset creation/management in LangSmith.
  • You need evaluator signatures and experiment runs in Python/TS.
  • You need CI-friendly workflows with quality thresholds.

references/ab-testing.md

Load when:

  • You need offline A/B comparison methodology.
  • You need significance testing and interpretation.
  • You need production traffic split strategy and guardrails.

Assets

assets/templates/test_template.py

  • Runnable Python pytest template aligned with current LangGraph testing patterns.
  • Includes:
    • Compiled-graph invocation with thread_id
    • Single-node testing via compiled_graph.nodes[...]
    • Integration-test placeholder

assets/datasets/sample_dataset.json

  • Deterministic seed dataset for LangSmith ingestion.
  • Uses examples: [{ inputs, outputs, metadata }] format.

assets/examples/README.md

  • Documentation-only index for current asset usage.
  • Notes where runnable assets live today.

Script Interface Summary

scripts/generate_test_cases.py / .js

Use for fast test scaffolding.

Inputs:

  • Graph module path
    • Python: my_module:graph or my_module.graph
    • JS/TS: ./file.ts:graph

Outputs:

  • Framework-specific starter tests in target directory.

scripts/run_trajectory_eval.py / .js

Use for trajectory scoring with either:

  • --method match
  • --method llm-judge

Supports:

  • Local dataset files (.json)
  • LangSmith dataset names
  • Optional reference trajectory file with --reference-trajectory
  • Match modes: strict, unordered, subset, superset

Local-only mode:

  • --no-langsmith in both Python and JavaScript scripts (requires local JSON dataset file)

scripts/evaluate_with_langsmith.py / .js

Use for dataset-based evaluation runs and experiment tracking.

Supports:

  • Existing dataset by name
  • Dataset creation from JSON examples file
  • Multiple evaluators (--evaluators accuracy,latency,...)
  • Concurrency control (--max-concurrency)

Python-only:

  • --no-upload to run without uploading experiment results

scripts/compare_agents.py / .js

Use for offline version comparisons:

  • Shared dataset input
  • Success/latency summaries
  • JSON report output for CI artifacts
  • Local JSON datasets or LangSmith datasets (JS supports --no-langsmith to disable remote loading)

scripts/mock_llm_responses.py / .js

Use for deterministic test doubles:

  • single
  • sequence
  • conditional

Decision Rules

If behavior is deterministic and local:

  • Use unit tests first.

If behavior depends on tool sequence/routing:

  • Add trajectory evaluation.

If behavior depends on realistic distribution quality:

  • Run LangSmith dataset evaluation.

If approving a replacement model/prompt/graph:

  • Run A/B comparison and check both quality and latency.

Common Failure Patterns

Flaky tests

  • Cause: real-model nondeterminism in unit scope.
  • Fix: mock LLM/tool calls for unit tests; reserve real-model tests for separate integration marks.

High trajectory variance

  • Cause: overly strict matching for workflows with equivalent paths.
  • Fix: switch match mode (unordered, subset, or superset) where appropriate.

Regressions hidden by averages

  • Cause: only aggregate score monitored.
  • Fix: inspect per-example failures and segment by category metadata.

Latency regressions with same quality

  • Cause: no explicit latency gate.
  • Fix: include latency evaluator and CI threshold.

Minimal Best Practices

  1. Keep fast deterministic tests as the largest share.
  2. Version datasets and keep them stable.
  3. Track both correctness and latency.
  4. Add explicit go/no-go thresholds in CI.
  5. Compare candidate vs baseline before production rollout.
  6. Investigate failures with trace-level evidence, not only aggregate scores.

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 提供完整的 LangGraph/LangChain 代理测试评估工作流
  • 覆盖单元测试、轨迹评估、LangSmith 数据集评估、A/B 比较等核心场景
  • 支持 Python 和 JavaScript/TypeScript 双栈开发
触发精准95/100

亮点

  • 触发词精准完整,明确针对 LangGraph/LangChain 代理测试评估
  • 覆盖多种使用变体,边界清晰不重叠
结构规范85/100

待提升项

  • 文档过长 原报告严重程度:轻微

    SKILL.md 文件超过500行,影响可读性

    改进建议:考虑将部分内容移至 references 目录,保持主文件简洁

  • 缺少显式 When to Use 章节 原报告严重程度:轻微

    虽然有 description 字段,但缺少显式的 When to Use 章节标题

    改进建议:添加显式的 When to Use 章节以增强结构清晰度

亮点

  • Phase/步骤清晰,提供明确的选择路径和执行流程
  • 包含完整的端到端示例和具体命令
执行可靠90/100

亮点

  • 工具来源明确,提供具体脚本路径和完整参数说明
  • 覆盖主要异常场景并提供解决方案
  • 包含决策规则和最佳实践指导
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。