LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Traceable
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerTraceableJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithclientClientlistRuns
Method●Since v0.0

listRuns

List runs from the LangSmith server.

Copy
listRuns(props: ListRunsParams): AsyncIterable<Run>

Parameters

NameTypeDescription
props*ListRunsParams

Example 1

Copy
// List all runs in a project
const projectRuns = client.listRuns({ projectName: "<your_project>" });

Example 2

Copy
// List LLM and Chat runs in the last 24 hours
const todaysLLMRuns = client.listRuns({
  projectName: "<your_project>",
  start_time: new Date(Date.now() - 24 * 60 * 60 * 1000),
  run_type: "llm",
});

Example 3

Copy
// List traces in a project
const rootRuns = client.listRuns({
  projectName: "<your_project>",
  execution_order: 1,
});

Example 4

Copy
// List runs without errors
const correctRuns = client.listRuns({
  projectName: "<your_project>",
  error: false,
});

Example 5

Copy
// List runs by run ID
const runIds = [
  "a36092d2-4ad5-4fb4-9c0d-0dba9a2ed836",
  "9398e6be-964f-4aa4-8ae9-ad78cd4b7074",
];
const selectedRuns = client.listRuns({ run_ids: runIds });

Example 6

Copy
// List all "chain" type runs that took more than 10 seconds and had `total_tokens` greater than 5000
const chainRuns = client.listRuns({
  projectName: "<your_project>",
  filter: 'and(eq(run_type, "chain"), gt(latency, 10), gt(total_tokens, 5000))',
});

Example 7

Copy
// List all runs called "extractor" whose root of the trace was assigned feedback "user_score" score of 1
const goodExtractorRuns = client.listRuns({
  projectName: "<your_project>",
  filter: 'eq(name, "extractor")',
  traceFilter: 'and(eq(feedback_key, "user_score"), eq(feedback_score, 1))',
});

Example 8

Copy
// List all runs that started after a specific timestamp and either have "error" not equal to null or a "Correctness" feedback score equal to 0
const complexRuns = client.listRuns({
  projectName: "<your_project>",
  filter: 'and(gt(start_time, "2023-07-15T12:34:56Z"), or(neq(error, null), and(eq(feedback_key, "Correctness"), eq(feedback_score, 0.0))))',
});

Example 9

Copy
// List all runs where `tags` include "experimental" or "beta" and `latency` is greater than 2 seconds
const taggedRuns = client.listRuns({
  projectName: "<your_project>",
  filter: 'and(or(has(tags, "experimental"), has(tags, "beta")), gt(latency, 2))',
});
View source on GitHub