Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/skills-registry --skill langchain-test-agent명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | langchain-test-agent |
| description | > Use when this capability is needed. |
| Scenario | Use | Why |
|---|---|---|
| Tool logic / validation / errors | Pytest | Deterministic and fast |
| External I/O around a tool | Pytest + mocks | Avoid network and LLM cost |
| Tool selection / multi-step traces | LangSmith | The model decides the path |
| Structured output / RAG / prompt quality | LangSmith | Needs model-level evaluation |
| Latency / tokens / cost | LangSmith traces + experiment metrics | Execution metrics live in tracing |
.invoke() method or the underlying function.@pytest.mark.langsmith.response_format on create_agent.result["structured_response"].Why this separation matters:
from langchain_core.tools import tool
import pytest
@tool
def calculate_score(score: int) -> str:
"""Return PASS or FAIL based on score."""
if score < 0 or score > 100:
raise ValueError("Score must be between 0 and 100")
return "PASS" if score >= 60 else "FAIL"
def test_calculate_score_pass():
assert calculate_score.invoke({"score": 85}) == "PASS"
def test_calculate_score_invalid():
with pytest.raises(ValueError, match="0 and 100"):
calculate_score.invoke({"score": 150})
import pytest
from langchain.agents import create_agent
from langsmith import testing as t
from pydantic import BaseModel
class ContactInfo(BaseModel):
name: str
email: str
@pytest.mark.langsmith
def test_agent_structured_output():
query = "Extract: John Doe, john@example.com"
t.log_inputs({"query": query})
agent = create_agent(
model="gpt-4.1-mini",
tools=[],
response_format=ContactInfo,
system_prompt="Extract contact info."
)
result = agent.invoke({"messages": [{"role": "user", "content": query}]})
t.log_outputs({"structured_response": result["structured_response"]})
assert result["structured_response"].name == "John Doe"
assert result["structured_response"].email == "john@example.com"
from typing_extensions import Annotated, TypedDict
from langchain_openai import ChatOpenAI
from langsmith import evaluate
class FaithfulnessGrade(TypedDict):
explanation: Annotated[str, ..., "Explain the score"]
faithful: Annotated[bool, ..., "The answer is supported by the context"]
judge_llm = ChatOpenAI(model="gpt-4.1", temperature=0).with_structured_output(
FaithfulnessGrade,
method="json_schema",
strict=True,
)
def faithfulness_evaluator(inputs: dict, outputs: dict) -> bool:
prompt = f"Context: {inputs['context']}\nAnswer: {outputs['answer']}"
grade = judge_llm.invoke(
[
{"role": "system", "content": "Evaluate whether the answer is grounded only in the context."},
{"role": "user", "content": prompt},
]
)
return grade["faithful"]
evaluate(
rag_chain,
data="rag-dataset-name",
evaluators=[faithfulness_evaluator],
)
from langsmith import Client
client = Client()
experiment = client.evaluate(
rag_chain,
data="rag-dataset-name",
evaluators=[faithfulness_evaluator],
experiment_prefix="rag-fidelity",
)
print(f"Latency p50: {experiment.latency_p50}")
print(f"Total tokens: {experiment.total_tokens}")
print(f"Prompt tokens: {experiment.prompt_tokens}")
print(f"Completion tokens: {experiment.completion_tokens}")
uv add pytest pytest-mock langsmith
pytest tests/tools/ -v
LANGSMITH_API_KEY=your_key pytest tests/agents/ -v
Source: ColRuDev/job-candidate-matcher — distributed by TomeVault.