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
  • RemoteGraph
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewClientAsyncClientRun HelpersRun TreesEvaluationSchemasUtilitiesWrappersAnonymizerTestingExpect APIMiddlewarePytest PluginDeployment SDKRemoteGraph
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

Methods

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.

View source on GitHub
A
inputs
: inputs
Aoutputs: Optional[dict[str, Any]]
Areference_example_id: Optional[ls_client.ID_TYPE]
—

Optional ID of a reference example.

Aparent_run_id: Optional[UUID]
—

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

Aattachments: attachments
Ametadata: Optional[dict[str, Any]]
—

Optional metadata for the run.

Arevision_id: Optional[UUID]
—

Retrieve the revision ID (if any).

Alatency: Optional[float]
—

Latency in seconds.

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]
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
attribute
trace_start_time: datetime
method
infer_defaults
method
ensure_dotted_order
method
set
method
add_tags
method
add_metadata
method
add_outputs
method
add_inputs
method
add_event
method
end
method
create_child
method
post
method
patch
method
wait
method
get_url
method
from_dotted_order
method
from_runnable_config
method
from_headers
method
to_headers

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

Return the client.

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

Assign name to the run.

Ensure the dotted order of the run.

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.

Add tags to the run.

Add metadata to the run.

Upsert the given outputs into the run.

Upsert the given inputs into the run.

Add an event to the list of events.

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

Add a child run to the run tree.

Post the run tree to the API asynchronously.

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

Wait for all _futures to complete.

Return the URL of the run.

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

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

Requires langchain to be installed.

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.

Return the RunTree as a dictionary of headers.