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
Pythonlangsmithrun_treesRunTree
Class●Since v0.0

RunTree

Run Schema with back-references for posting runs.

Copy
RunTree()

Bases

ls_schemas.RunBase

Used in Docs

  • Custom instrumentation
  • Log LLM calls
  • Log traces to a specific project

Attributes

attribute
name: str
attribute
id: UUID
attribute
run_type: str
attribute
start_time: datetime
attribute
parent_run: Optional[RunTree]
attribute
parent_dotted_order: Optional[str]
attribute
child_runs: list[RunTree]
attribute
session_name: str
attribute
session_id: Optional[UUID]
attribute
extra: dict
attribute
tags: Optional[list[str]]
attribute
events: list[dict]

List of events associated with the run, like start and end events.

attribute
ls_client: Optional[Any]
attribute
dotted_order: str
attribute
trace_id: UUID
attribute
dangerously_allow_filesystem: Optional[bool]
attribute
replicas: Optional[Sequence[WriteReplica]]
attribute
model_config
attribute
client: Client

Return the client.

attribute
trace_start_time: datetime

Return the start time of the trace (root run).

Methods

method
infer_defaults

Assign name to the run.

method
ensure_dotted_order

Ensure the dotted order of the run.

method
set

Set the inputs, outputs, tags, and metadata of the run.

If performed, this will override the default behavior of the end() method to ignore new outputs (that would otherwise be added) by the @traceable decorator.

If your LangChain or LangGraph versions are sufficiently up-to-date, this will also override the default behavior of LangChainTracer.

method
add_tags

Add tags to the run.

method
add_metadata

Add metadata to the run.

method
add_outputs

Upsert the given outputs into the run.

method
add_inputs

Upsert the given inputs into the run.

method
add_event

Add an event to the list of events.

method
end

Set the end time of the run and all child runs.

method
create_child

Add a child run to the run tree.

method
post

Post the run tree to the API asynchronously.

method
patch

Patch the run tree to the API in a background thread.

method
wait

Wait for all _futures to complete.

method
get_url

Return the URL of the run.

method
from_dotted_order

Create a new 'child' span from the provided dotted order.

method
from_runnable_config

Create a new 'child' span from the provided runnable config.

Requires langchain to be installed.

method
from_headers

Create a new 'parent' span from the provided headers.

Extracts parent span information from the headers and creates a new span.

Metadata and tags are extracted from the baggage header.

The dotted order and trace id are extracted from the trace header.

method
to_headers

Return the RunTree as a dictionary of headers.

Inherited fromRunBase

Attributes

Aend_time: Optional[datetime]
—

End time of the run, if applicable.

Aerror: Optional[str]
—

Error message, if the run encountered any issues.

Aserialized: Optional[dict]
—

Serialized object that executed the run for potential reuse.

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.

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.

View source on GitHub