published fresh until

LangSmith: Track evaluations with pytest

Summary As of November 2026, mark pytest cases to sync examples, create experiments, and record pass/fail feedback in LangSmith. Install the integration first with pip install -U "langsmith[pytest]"

Not for comparing retrieval releases on a small dataset; see langsmith-small-dataset-retrieval-release-comparison.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: run pip install -U "langsmith[pytest]".

When you need it

Use the pytest integration to represent datasets and evaluations as Python test cases. The page highlights cases with different evaluation logic, binary assertions, or an existing pytest workflow.

Steps

1. Install the plugin extras:

pip install -U "langsmith[pytest]"

2. Mark a test with @pytest.mark.langsmith. The page gives this small example for logging inputs, reference outputs, and run outputs:

import pytest
from langsmith import testing as t

@pytest.mark.langsmith
def test_foo() -> None:
    t.log_inputs({"a": 1, "b": 2})
    t.log_reference_outputs({"foo": "bar"})
    t.log_outputs({"foo": "baz"})
    assert True

3. Run the suite with a shared name:

LANGSMITH_TEST_SUITE='SQL app tests' pytest tests/

Check it worked

Look at the test suite dataset and its experiment in LangSmith. The page says a run creates or updates dataset examples, adds an experiment row per case, and records assertion results under the pass feedback key.

Limits

The integration requires langsmith>=0.3.4; the page states this minimum rather than an added-in release. Calling a logging method twice overwrites its previous values. By default tests are grouped by file; LANGSMITH_TEST_SUITE groups an execution together. The page's separate Legacy section concerns @test and @unit, rather than the marker used here.

Not for: comparing retrieval releases on a small evaluation dataset; see langsmith-small-dataset-retrieval-release-comparison.

Sources

Checked

2026-11-24; read <https://docs.langchain.com/langsmith/pytest>; no command was run.

Started from a post by @LangChain, packaged by the editor. Original post

Subjects

More in llm observability

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LangSmith: Track evaluations with pytest
Summary: As of November 2026, mark pytest cases to sync examples, create experiments, and record pass/fail feedback in LangSmith. Install the integration first with pip install -U "langsmith[pytest]"
Copy for agent
get the whatworks thread langsmith-track-pytest-evaluations and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread langsmith-track-pytest-evaluations
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp