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
Pythonlangsmith_openapi_clienttypesthread_traceThreadTrace
Class●Since v0.10

ThreadTrace

Copy
ThreadTrace()

Bases

BaseModel

Attributes

Inherited fromBaseModel

Attributes

Amodel_fields_set: set[str]Amodel_config: ConfigDictAmodel_construct: construct

Methods

Mto_dict
—
View source on GitHub

Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

Mto_json
—

Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation).

Mconstruct
Mmodel_dump
—

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump

Mmodel_dump_json
—

Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json

Classes

CConfig
attribute
completion_cost: Optional[float]
attribute
completion_cost_details: Optional[CompletionCostDetails]
attribute
completion_token_details: Optional[CompletionTokenDetails]
attribute
completion_tokens: Optional[int]
attribute
end_time: Optional[datetime]
attribute
error: Optional[str]
attribute
error_preview: Optional[str]
attribute
first_token_time: Optional[datetime]
attribute
inputs: Optional[object]
attribute
inputs_preview: Optional[str]
attribute
latency: Optional[float]
attribute
name: Optional[str]
attribute
op: Optional[float]
attribute
outputs: Optional[object]
attribute
outputs_preview: Optional[str]
attribute
prompt_cost: Optional[float]
attribute
prompt_cost_details: Optional[PromptCostDetails]
attribute
prompt_token_details: Optional[PromptTokenDetails]
attribute
prompt_tokens: Optional[int]
attribute
start_time: Optional[datetime]
attribute
thread_id: Optional[str]
attribute
total_cost: Optional[float]
attribute
total_tokens: Optional[int]
attribute
trace_id: Optional[str]

completion_cost is the estimated USD cost for the completion.

Omitted unless included in selects.

completion_cost_details is the USD cost breakdown for completion-side categories; per-category values are under raw. Omitted unless included in selects.

completion_token_details is the completion-side token breakdown by category; per-category counts are under raw. Omitted unless included in selects.

completion_tokens is the completion-side token count.

Omitted unless included in selects.

end_time is when the root run ended (RFC3339 date-time).

JSON null if the run is still in progress. Omitted unless included in selects.

error is the full root run error message when the run failed.

Omitted unless included in selects.

error_preview is a short error summary when the run failed.

Omitted unless included in selects.

first_token_time is when the first output token was produced (RFC3339 date-time), for streamed runs when that metadata exists. Omitted unless included in selects.

inputs is the full root run input payload.

Omitted unless included in selects.

inputs_preview is a truncated text preview of inputs.

Omitted unless included in selects.

latency is wall-clock duration from start to end in seconds.

Omitted unless included in selects.

name is a human-readable label for the root run (for example the model name, function name, or step name chosen when the run was traced). Omitted unless included in selects.

op is a numeric code identifying the root run's run_type (for example LLM vs.

tool vs. chain). Encoded as a number for compatibility with legacy clients; prefer the string run_type on RunResponse when available. Omitted unless included in selects.

outputs is the full root run output payload.

Omitted unless included in selects.

outputs_preview is a truncated text preview of outputs.

Omitted unless included in selects.

prompt_cost is the estimated USD cost for the prompt.

Omitted unless included in selects.

prompt_cost_details is the USD cost breakdown for prompt-side categories; per-category values are under raw. Omitted unless included in selects.

prompt_token_details is the prompt-side token breakdown by category; per-category counts are under nested raw. Omitted unless included in selects.

prompt_tokens is the prompt-side token count.

Omitted unless included in selects.

start_time is when the trace started (RFC3339 date-time).

Omitted unless included in selects.

thread_id is the conversation thread UUID that contains this trace.

Matches the thread_id path parameter of the request. Omitted unless included in selects.

total_cost is the estimated total USD cost for the root run.

Omitted unless included in selects.

total_tokens is the total token count (prompt plus completion).

Omitted unless included in selects.

trace_id is the UUID of this trace (the root run).

Returned when TRACE_ID is in selects, or when selects is omitted entirely (sole fallback field).