Loading...
Loading...
LangSmith tracing and trace debugging for AgentSeek templates. Covers CLI installation, adding tracing to LangGraph apps, querying traces, and inspecting run IO. Use when debugging agent backends, investigating slow traces, or adding observability to a template.
npx skill4agent add ob-labs/agentseek langsmith-trace[!IMPORTANT] This skill is tuned for AgentSeek template backends (LangGraph + middleware stacks). For general LangSmith concepts, see the upstream langsmith-skills repo.
[!CAUTION] Never passas a CLI flag or expose API keys in shell commands / tool calls. The CLI reads--api-keyfrom the environment automatically. UsingLANGSMITH_API_KEYleaks secrets into shell history, process listings, and agent tool-call logs. Always rely on the environment variable set in your shell profile or--api-key <value>file..env
curl -sSL https://raw.githubusercontent.com/langchain-ai/langsmith-cli/main/scripts/install.sh | sh~/.local/bin/langsmithlangsmithecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc~/.zshrc.envexport LANGSMITH_API_KEY=<your-key-here> # starts with lsv2_pt_lsv2_pt_--api-keylangsmith project listcommand not found~/.local/bin[]export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY=<your-key-here> # must be set; do NOT pass via --api-key flag
export LANGSMITH_PROJECT=my-project # optional, defaults to "default"LANGCHAIN_CALLBACKS_BACKGROUND=false@traceabletraceable()from langsmith import traceable
from langsmith.wrappers import wrap_openai
from openai import OpenAI
client = wrap_openai(OpenAI())
@traceable
def my_pipeline(question: str) -> str:
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
)
return resp.choices[0].message.contentimport { traceable } from "langsmith/traceable";
import { wrapOpenAI } from "langsmith/wrappers";
import OpenAI from "openai";
const client = wrapOpenAI(new OpenAI());
const myPipeline = traceable(async (question: string) => {
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: question }],
});
return resp.choices[0].message.content || "";
}, { name: "my_pipeline" });langsmith project listlast_run_start_time"default"langsmith trace list --project default --limit 5
# Or with full hierarchy inline (combines steps 2+3):
langsmith trace list --project default --limit 5 --show-hierarchylangsmith trace get <trace-id> --project <name>langsmith run list --trace-ids <trace-id> --project <name> --include-iolangsmith run get <run-id> --include-io<agent_name> (root chain)
├── SkillsMiddleware.before_agent
├── PatchToolCallsMiddleware.before_agent
├── MemoryMiddleware.before_agent
├── model (chain) ← LLM turn
│ ├── TodoListMiddleware.awrap_model_call
│ ├── SkillsMiddleware.awrap_model_call
│ ├── FilesystemMiddleware.awrap_model_call
│ ├── SubAgentMiddleware.awrap_model_call
│ ├── SummarizationMiddleware.awrap_model_call
│ ├── AnthropicPromptCachingMiddleware.awrap_model_call
│ ├── MemoryMiddleware.awrap_model_call
│ └── ChatOpenAI (llm) ← actual LLM call (inputs/outputs here)
├── TodoListMiddleware.after_model
├── tools (chain) ← tool execution
│ ├── FilesystemMiddleware.awrap_tool_call
│ └── <tool_name> (tool) ← actual tool (inputs/outputs here)
├── model (chain) ← next LLM turn
│ └── ... (same middleware stack)
└── TodoListMiddleware.after_modelChatOpenAI<tool_name>generate_coverexecute--full--include-iolangsmith run get <id> --full--full--include-metadata --include-io --include-feedback--include-io# DO THIS
langsmith run get <run-id> --include-io
# NOT THIS (may return null IO despite docs saying it includes --include-io)
langsmith run get <run-id> --full--fulltrace exportrun listrun get--include-io--include-io--include-io.envLANGCHAIN_HIDE_INPUTS=true # hides inputs from traces
LANGCHAIN_HIDE_OUTPUTS=true # hides outputs from tracesfalse"default"LANGSMITH_PROJECTlangsmith project listlast_run_start_time--format prettyLANGSMITH_ENDPOINT