langgraph-dev-testing-agentic-systems

A testing guide for LangGraph, a framework for building workflows from connected agent steps, and other systems that use language models. It covers tests for data state, individual steps, mocked models, and complete workflows.

In plain words
What is it for?
It helps test state formats, individual workflow nodes, model-dependent integrations, complete workflows, and evaluation measures for agent responses.
Why use it?
Language-model output can vary, so ordinary fixed-value tests are not always enough; the guide explains how to test behavior at different costs and levels of realism.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/postindustria-tech/agentic-toolkit/langgraph-dev-testing-agentic-systems
Any agent
npx skills add postindustria-tech/agentic-toolkit --skill langgraph-dev-testing-agentic-systems
Clone the repo
git clone --depth 1 https://github.com/postindustria-tech/agentic-toolkit

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,181 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.02181
Opus 5 $0.00028 $0.01091
Sonnet 5 $0.00011 $0.00436
Haiku 4.5 $0.00006 $0.00218

Measured 2d ago against content hash 936318c1b443, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

langgraph-dev-testing-agentic-systems scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/langgraph-dev/skills/langgraph-dev-testing-agentic-systems/SKILL.md · 276 lines

How it starts

The opening of the file, as written. The whole thing — 276 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Agentic Systems

Testing LLM-based systems requires different approaches than traditional software: mock LLMs for determinism, use evaluation metrics instead of assertions.

Test Pyramid for Agentic Systems

E2E Tests (Real LLM, expensive, slow)
  ↓
Integration Tests (Mocked LLM, medium cost)
  ↓
Node Unit Tests (Fully mocked, fast)
  ↓
State/Schema Tests (No LLM, instant)

State Schema Tests (Instant)

from typing import TypedDict
from pydantic import BaseModel

# Option 1: TypedDict (lightweight, dict-like access)
class AgentStateDict(TypedDict):
    """Define state schema for the agent graph."""
    messages: list[str]
    intent: str
    confidence: float

# Option 2: Pydantic (recommended - validation, defaults, IDE support)
class AgentState(BaseModel):
    """Define state schema for the agent graph with validation."""
    messages: list[str]
    intent: str = ""
    confidence: float = 0.0

def test_state_structure_typeddict():
    """Verify TypedDict state accepts valid data."""
    state: AgentStateDict = {
        "messages": ["Hello"],
        "intent": "greeting",
        "confidence": 0.95
    }
    assert state["messages"] == ["Hello"]
    assert 0 <= state["confidence"] <= 1

def test_state_structure_pydantic():
    """Verify Pydantic state accepts valid data and validates."""
    state = AgentState(messages=["Hello"], intent="greeting", confidence=0.95)
    assert state.messages == ["Hello"]
    assert 0 <= state.confidence <= 1

    # Note: Pydantic BaseModel uses attribute access (state.messages)
    # LangGraph nodes receive Pydantic instances but graph output may be dict
    # For dict conversion: state.model_dump()

Node Unit Tests (Mocked LLM)

Node unit tests call the Python node function directly, bypassing graph compilation. This isolates node logic for fast, focused testing with mocked dependencies.

import pytest
from typing import TypedDict
from langchain_core.language_models import FakeListChatModel
from src.nodes import classify_node  # Import the node being tested

# Use TypedDict for type safety (same pattern as State Schema Tests)
class AgentStateDict(TypedDict):
    messages: list[str]
    intent: str
    confidence: float

@pytest.fixture
def mock_llm(monkeypatch):
    """Mock LLM using LangChain's FakeListChatModel.

    The fixture handles patching internally - test functions just use the fixture.
    """
    fake_llm = FakeListChatModel(responses=["greeting"])
    monkeypatch.setattr('src.nodes.llm', fake_llm)
    return fake_llm

def test_classify_node(mock_llm):
    """Test node function directly with mocked LLM (bypasses graph compilation)."""
    # Use TypedDict for type safety (defined above, matches State Schema Tests)
    state: AgentStateDict = {"messages": ["Test input"], "intent": "", "confidence": 0.0}
    result = classify_node(state)

    assert result["intent"] == "greeting"

Read the full file on GitHub · 276 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 276 lines · 55 tokens per session scan A 936318c1b443

Subscribe to this mod's changes

langgraph-dev-testing-agentic-systems is a skill published in the GitHub repository postindustria-tech/agentic-toolkit (2 stars, last pushed 1mo ago), licensed MIT. It adds 55 tokens to every session and 2,181 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

langgraph-testing-evaluation

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…

soba-labs/langchain-agent-skills · 99 tokens

testing-framework

Framework de test complet pour agents IA — tests unitaires, d'intégration, de bout en bout et adversariaux. Se déclenche avec "tester agent", "agent testing", "test agent IA", "agent CI/CD", "agent regression", "quality assurance agent", "agent test suite". Also triggers on "test my agent", "agent unit tests"…

khalilbenaz/claude-skills-collection · 84 tokens

a2a-testing

Test A2A implementations — unit tests, integration tests, mock agents, protocol conformance, and end-to-end multi-agent testing. Use when building test suites for A2A servers, clients, or multi-agent systems.

OrcaQubits/agentic-commerce-skills-plugins · 50 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/chembl-mcp-server · 46 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/reference-data-mcp-server · 46 tokens

api-testing

Testing patterns for MCP tool/resource handlers using createMockContext and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.

cyanheads/openchargemap-mcp-server · 46 tokens