Agent Skillslangwatch/langwatch › online-evaluations

online-evaluations

GitHub

配置 LangWatch 在线评估和护栏,用于生产流量监控、实时评分及同步拦截不安全请求。指导用户区分在线评估与批量测试,处理计划限制,并执行 CLI 命令创建监视器和评估器。

skills/_compiled/native/online-evaluations/SKILL.md langwatch/langwatch

Trigger Scenarios

需要监控生产环境 AI 输出质量 需要设置实时安全护栏拦截违规内容 配置 LangWatch 在线评估规则

Install

npx skills add langwatch/langwatch --skill online-evaluations -g -y
More Options

Non-standard path

npx skills add https://github.com/langwatch/langwatch/tree/main/skills/_compiled/native/online-evaluations -g -y

Use without installing

npx skills use langwatch/langwatch@online-evaluations

指定 Agent (Claude Code)

npx skills add langwatch/langwatch --skill online-evaluations -a claude-code -g -y

安装 repo 全部 skill

npx skills add langwatch/langwatch --all -g -y

预览 repo 内 skill

npx skills add langwatch/langwatch --list

SKILL.md

Frontmatter
{
    "name": "online-evaluations",
    "license": "MIT",
    "description": "Configure LangWatch online evaluations and guardrails for production traffic. Use when the user wants to score live traces or threads, monitor production quality, sample incoming traffic, or synchronously block unsafe requests and responses. Do not use for batch experiments.",
    "user-prompt": "Set up online evaluations for my agent",
    "compatibility": "Works with Claude Code and similar AI assistants. The `langwatch` CLI is the only interface for platform operations and documentation."
}

Set Up Online Evaluations and Guardrails

Online evaluations apply reusable evaluators to production traffic:

  • An online evaluation measures live traces or threads asynchronously.
  • A guardrail runs synchronously and can stop or replace unsafe traffic.

Hand Off Batch Testing Requests

If the user wants to test a dataset, compare prompts or models, benchmark, or create a CI quality gate, this is the wrong workflow.

  1. If the experiments skill is available, load it and follow it now.
  2. Otherwise, tell the user to install it with:
    npx skills@1.5.19 add langwatch/skills/experiments
    

Do not create a batch experiment from this skill.

Choose the Production Workflow

Use an online evaluation when the user wants continuous scoring, quality trends, sampling, or evaluation by trace or thread.

Use a guardrail when the result must affect the request or response immediately, such as jailbreak detection, PII blocking, or policy enforcement.

If the user's wording is broad, inspect the application and choose the safer non-blocking online evaluation unless they explicitly require synchronous enforcement.

Plan Limits

LangWatch's free plan has limits on prompts, scenarios, evaluators, experiments, and datasets. When you hit a limit, the API returns "Free plan limit of N reached..." with an upgrade link.

How to handle:

  • Work within the limits. If 3 resources of the relevant type are allowed, create 3 meaningful ones, not 10.
  • Make every creation count: each one should demonstrate clear value.
  • Show what works FIRST. If you hit a limit, summarize what was accomplished and note that upgrading the plan raises it. Point to the subscription settings on the platform, or to the license settings if the CLI is pointed at a self-hosted endpoint. Read the endpoint the CLI actually uses, which can come from .env, from the process environment, or from the saved CLI configuration.
  • Do NOT delete existing resources to make room or repurpose an existing resource to evade the limit.

Prerequisites

Read the relevant documentation before changing configuration or code:

langwatch docs evaluations/online-evaluation/overview
langwatch docs evaluations/online-evaluation/setup-monitors
langwatch docs evaluations/guardrails/overview
langwatch docs evaluations/evaluators/list

Inspect the Existing Setup

Use JSON output and inspect what already exists before creating duplicates:

langwatch monitor list --format json
langwatch evaluator list --format json

Read recent traces only when they are needed to determine mappings, level, sampling, or realistic evaluator inputs. Do not send production data to a different project.

Create an Online Evaluation

Discover the installed CLI contract first:

langwatch monitor create --help

Then create the monitor with a descriptive name, a valid evaluator type or saved evaluator, and the correct level:

  • Use trace for per-interaction quality.
  • Use thread for multi-message outcomes and configure an appropriate idle timeout in the platform when needed.
  • Start with a conservative sample rate for expensive evaluators on high-volume traffic.
  • Use ON_MESSAGE for asynchronous online evaluation.

Take the evaluator type from the catalog, never from memory:

langwatch evaluator types --format json

If a create still fails with a validation_error whose reason names the field and an expected list, correct that exact field from the list and retry once. That failure is yours to fix. Do not ask the user to pick a type slug.

Do not guess evaluator parameters. Read the evaluator docs and the installed CLI help. If an LLM evaluator is used, verify that the target project has a model provider configured.

After creation, verify the saved resource:

langwatch monitor list --format json
langwatch monitor get <monitor-id> --format json

The task is complete only when the created monitor appears with the intended evaluator, execution mode, level, sample rate, and enabled state.

Add a Guardrail

For platform-managed guardrails, create or edit the monitor with AS_GUARDRAIL after reading langwatch monitor create --help or langwatch monitor update --help.

For an in-code guardrail, follow the language-specific documentation. A Python integration has this general shape:

import langwatch

@langwatch.trace()
def my_agent(user_input):
    result = langwatch.evaluation.evaluate(
        "azure/jailbreak",
        name="Jailbreak detection",
        as_guardrail=True,
        data={"input": user_input},
    )
    if not result.passed:
        return "I cannot help with that request."

    return generate_response(user_input)

Treat the snippet as a shape, not a substitute for the installed docs. Preserve the application's existing error handling and decide explicitly what happens if the guardrail service is unavailable.

Verify Real Behavior

For an online evaluation:

  1. Send or reuse a representative traced interaction in the target project.
  2. Confirm the monitor is enabled.
  3. Confirm a real evaluation result appears in Online Evaluations analytics.

For a guardrail:

  1. Run one allowed input and one input that should be blocked.
  2. Verify the allowed path still works.
  3. Verify the blocked path does not reach the protected operation.
  4. Verify both outcomes are traced without exposing sensitive content.

Common Mistakes

  • Do not create a batch experiment from this skill.
  • Do not describe a synchronous guardrail as asynchronous monitoring.
  • Do not enable an expensive evaluator on all traffic without considering sampling and cost.
  • Do not create duplicate monitors without inspecting the project first.
  • Do not claim success after saving configuration. Verify a real monitor or guardrail behavior.

Version History

  • 6f9d4a4 Current 2026-08-28 21:10
  • 12615f1 2026-08-20 10:01

Same Skill Collection

.claude/skills/browser-pair/SKILL.md
.claude/skills/browser-test/SKILL.md
.claude/skills/code-review/SKILL.md
.claude/skills/feature-map/SKILL.md
.claude/skills/haven-setup/SKILL.md
.claude/skills/langwatch-kanban/SKILL.md
plugins/langwatch/skills/langwatch/SKILL.md
services/langy-agent/skills/github/SKILL.md
skills/_compiled/native/agent-best-practices/SKILL.md
skills/_compiled/native/agent-performance/SKILL.md
skills/_compiled/native/connect-agent/SKILL.md
skills/_compiled/native/context-sweet-spot/SKILL.md
skills/_compiled/native/datasets/SKILL.md
skills/_compiled/native/debug-instrumentation/SKILL.md
skills/_compiled/native/debug-with-langwatch/SKILL.md
skills/_compiled/native/drive-the-ui/SKILL.md
skills/_compiled/native/eval-triage/SKILL.md
skills/_compiled/native/evaluate-multimodal/SKILL.md
skills/_compiled/native/evaluations/SKILL.md
skills/_compiled/native/experiments/SKILL.md
skills/_compiled/native/generate-rag-dataset/SKILL.md
skills/_compiled/native/github/SKILL.md
skills/_compiled/native/level-up/SKILL.md
skills/_compiled/native/lwql-charts/SKILL.md
skills/_compiled/native/prompt-optimization/SKILL.md
skills/_compiled/native/prompts/SKILL.md
skills/_compiled/native/provider-cost-comparison/SKILL.md
skills/_compiled/native/scenarios/SKILL.md
skills/_compiled/native/setup-lw/SKILL.md
skills/_compiled/native/test-cli-usability/SKILL.md
skills/_compiled/native/test-compliance/SKILL.md
skills/_compiled/native/tracing/SKILL.md

Metadata

Files
0
Version
6f9d4a4
Hash
2b084ae2
Indexed
2026-08-20 10:01

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-02 06:42
浙ICP备14020137号-1 $bản đồ khách truy cập$