LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Client
  • AsyncClient
  • Run Helpers
  • Run Trees
  • Evaluation
  • Schemas
  • Utilities
  • Wrappers
  • Anonymizer
  • Testing
  • Expect API
  • Middleware
  • Pytest Plugin
  • Deployment SDK
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDK
Language
Theme
PythonlangsmithschemasRun
Class●Since v0.0

Run

Run schema when loading from the DB.

Copy
Run(
    self,
    _host_url: Optional[str] = None,
    **kwargs: Any = {},
)

Bases

RunBase

Used in Docs

  • How to define a code evaluator
  • How to evaluate a graph
  • How to evaluate an application's intermediate steps
  • How to fetch performance metrics for an experiment

Constructors

constructor
__init__
NameType
_host_urlOptional[str]

Attributes

attribute
session_id: Optional[UUID]

The project ID this run belongs to.

attribute
child_run_ids: Optional[list[UUID]]

Deprecated: The child run IDs of this run.

attribute
child_runs: Optional[list[Run]]

The child runs of this run, if instructed to load using the client These are not populated by default, as it is a heavier query to make.

attribute
feedback_stats: Optional[dict[str, Any]]

Feedback stats for this run.

attribute
app_path: Optional[str]

Relative URL path of this run within the app.

attribute
manifest_id: Optional[UUID]

Unique ID of the serialized object for this run.

attribute
status: Optional[str]

Status of the run (e.g., 'success').

attribute
prompt_tokens: Optional[int]

Number of tokens used for the prompt.

attribute
completion_tokens: Optional[int]

Number of tokens generated as output.

attribute
total_tokens: Optional[int]

Total tokens for prompt and completion.

attribute
prompt_token_details: Optional[dict[str, int]]

Breakdown of prompt (input) token counts.

Does not need to sum to full prompt token count.

attribute
completion_token_details: Optional[dict[str, int]]

Breakdown of completion (output) token counts.

Does not need to sum to full completion token count.

attribute
first_token_time: Optional[datetime]

Time the first token was processed.

attribute
total_cost: Optional[Decimal]

The total estimated LLM cost associated with the completion tokens.

attribute
prompt_cost: Optional[Decimal]

The estimated cost associated with the prompt (input) tokens.

attribute
completion_cost: Optional[Decimal]

The estimated cost associated with the completion tokens.

attribute
prompt_cost_details: Optional[dict[str, Decimal]]

Breakdown of prompt (input) token costs.

Does not need to sum to full prompt token cost.

attribute
completion_cost_details: Optional[dict[str, Decimal]]

Breakdown of completion (output) token costs.

Does not need to sum to full completion token cost.

attribute
parent_run_ids: Optional[list[UUID]]

List of parent run IDs.

attribute
trace_id: UUID

Unique ID assigned to every run within this nested trace.

attribute
dotted_order: str

Dotted order for the run.

This is a string composed of {time}{run-uuid}.* so that a trace can be sorted in the order it was executed.

attribute
in_dataset: Optional[bool]

Whether this run is in a dataset.

attribute
start_time
attribute
end_time
attribute
url: Optional[str]

URL of this run within the app.

attribute
input_tokens: int | None

Alias for prompt_tokens.

attribute
output_tokens: int | None

Alias for completion_tokens.

attribute
input_cost: Decimal | None

Alias for prompt_cost.

attribute
output_cost: Decimal | None

Alias for completion_cost.

attribute
input_token_details: dict[str, int] | None

Alias for prompt_token_details.

attribute
output_token_details: dict[str, int] | None

Alias for output_token_details.

attribute
input_cost_details: dict[str, Decimal] | None

Alias for prompt_cost_details.

attribute
output_cost_details: dict[str, Decimal] | None

Alias for completion_cost_details.

Inherited fromRunBase

Attributes

Aid: UUID
—

Unique identifier for the run.

Aname: str
—

Human-readable name for the run.

Arun_type: str
—

The type of run, such as tool, chain, llm, retriever,

Aextra: Optional[dict]
—

Additional metadata or settings related to the run.

Aerror: Optional[str]
—

Error message, if the run encountered any issues.

Aserialized: Optional[dict]
—

Serialized object that executed the run for potential reuse.

Aevents: Optional[list[dict]]
—

List of events associated with the run, like

Ainputs: dict
—

Inputs used for the run.

Aoutputs: Optional[dict]
—

Outputs generated by the run, if any.

Areference_example_id: Optional[UUID]
—

Reference to an example that this run may be based on.

Aparent_run_id: Optional[UUID]
—

Identifier for a parent run, if this run is a sub-run.

Atags: Optional[list[str]]
—

Tags for categorizing or annotating the run.

Aattachments: Union[Attachments, dict[str, AttachmentInfo]]
—

Attachments associated with the run.

Ametadata: dict[str, Any]
—

Retrieve the metadata (if any).

Arevision_id: Optional[UUID]
—

Retrieve the revision ID (if any).

Alatency: Optional[float]
—

Latency in seconds.

Amodel_config
View source on GitHub