sdkagent

langsmith-sdk API reference

340 public APIs from langsmith-sdk (langchain-ai/langsmith-sdk) — 137 classes, 84 functions, 119 methods. Signatures extracted by static analysis of the actual source.

Repository: langchain-ai/langsmith-sdk

KindCount
Classes137
Functions84
Methods119

API list

funcpython.bench.create_run.benchmark_run_creation(*num_runs:int, *json_size:int, *samples:int, *benchmark_thread:bool) -> Dict
Benchmark run creation with specified parameters.
funcpython.bench.create_run.create_large_json(length:int) -> Dict
Create a large JSON object for benchmarking purposes.
funcpython.bench.create_run.create_run_data(run_id:str, json_size:int) -> Dict
Create a single run data object.
funcpython.bench.create_run.mock_session() -> Mock
Create a mock session object.
classpython.bench.dumps_json.DeeplyNested
An object.
funcpython.bench.json_serialization.serialize_sequential(data)
Serialize data sequentially.
funcpython.bench.tracing_client_bench.benchmark_run_creation(num_runs:int, json_size:int, samples:int=1) -> Dict
Benchmark run creation with specified parameters.
funcpython.bench.tracing_client_bench.create_large_json(length:int) -> Dict
Create a large JSON object for benchmarking purposes.
funcpython.bench.tracing_client_bench.create_run_data(run_id:str, json_size:int, start_time:Optional[datetime]=None) -> Dict
Create a single run data object.
funcpython.bench.tracing_client_via_pyo3.benchmark_run_creation(json_size, num_runs) -> None
Benchmark the creation of runs.
funcpython.bench.tracing_rust_client_bench.benchmark_run_creation(num_runs:int, json_size:int, samples:int=1) -> Dict
Benchmark run creation with specified parameters.
funcpython.bench.upload_example_with_large_file_attachment.create_large_file(size:int, dir:str) -> str
Create a large file for benchmarking purposes.
funcpython.bench.upload_examples_bench.benchmark_example_uploading(num_examples:int, json_size:int, samples:int=1) -> Dict
Benchmark run creation with specified parameters.
funcpython.bench.upload_examples_bench.create_example_data(dataset_id:str, json_size:int) -> Dict
Create a single example data object.
funcpython.bench.upload_examples_bench.create_large_json(length:int) -> Dict
Create a large JSON object for benchmarking purposes.
funcpython.langsmith._internal._aiter.accepts_context(callable:Callable[..., Any]) -> bool
Check if a callable accepts a context argument.
funcpython.langsmith._internal._aiter.async_zip(*async_iterables)
Async version of zip.
funcpython.langsmith._internal._aiter.tee_peer(iterator:AsyncIterator[T], buffer:deque[T], peers:list[deque[T]], lock:AbstractAsyncContextManager[Any]) -> AsyncGenerator[T, None]
Iterate over :py:func:`~.tee`.
classpython.langsmith._internal._background_thread.TracingQueueItem
An item in the tracing queue.
funcpython.langsmith._internal._context.get_current_run_tree() -> Optional['RunTree']
Get the current RunTree from the context.
funcpython.langsmith._internal._hub.build_commit_url(host:str, name:str, commit_hash:str, organization_id:str) -> str
Build the URL for a hub directory commit.
funcpython.langsmith._internal._otel_utils.get_otel_span_id_from_uuid(uuid_val:UUID) -> int
Get OpenTelemetry span ID as integer from UUID.
funcpython.langsmith._internal._otel_utils.get_otel_trace_id_from_uuid(uuid_val:UUID) -> int
Get OpenTelemetry trace ID as integer from UUID.
funcpython.langsmith._internal._patch.new_request(self, *args, **kwargs)
Handle parent request.
funcpython.langsmith._internal._patch.request(self, method, url, body=None, headers=None)
Make the request.
classpython.langsmith._internal._serde.ZoneInfo
Introduced in python 3.9.
funcpython.langsmith._internal._serde.dumps_json(obj:Any) -> bytes
Serialize an object to a JSON formatted string.
funcpython.langsmith._internal._uuid.is_uuid_v7(uuid_obj:uuid.UUID) -> bool
Check if a UUID is version 7.
funcpython.langsmith._internal._uuid.warn_if_not_uuid_v7(uuid_obj:uuid.UUID, id_type:str) -> None
Warn if a UUID is not version 7.
funcpython.langsmith._internal.voice.audio.pcm_to_wav(pcm:bytes, sample_rate:int, num_channels:int=1) -> bytes
Wrap raw PCM16 bytes in a WAV container.
funcpython.langsmith._internal.voice.helpers.dump_event(event:Any) -> dict[str, Any]
Best-effort conversion of an event object to a plain dict.
funcpython.langsmith._internal.voice.helpers.scrub(obj:Any) -> Any
Make an event payload safe and compact for a span.
classpython.langsmith._internal.voice.session.EventSession
Conversation-level tracing state.
methodpython.langsmith._internal.voice.session.EventSession.add_message(role:str, content:str) -> None
Append one transcript line to the conversation rollup.
funcpython.langsmith._internal.voice.set_thread_id(thread_id:Optional[str]) -> None
Set the LangSmith thread id for the current (async) context.
classpython.langsmith._openapi_client._base_client.BasePage
Defines the core interface for pagination.
funcpython.langsmith._openapi_client._files.deepcopy_with_paths(item:_T, paths:Sequence[Sequence[str]]) -> _T
Copy only the containers along the given paths.
funcpython.langsmith._openapi_client._models.set_pydantic_config(typ:Any, config:pydantic.ConfigDict) -> None
Add a pydantic config for the given type.
methodpython.langsmith._openapi_client._streaming.Stream.close() -> None
Close the response and release the connection.
funcpython.langsmith._openapi_client._utils._json.openapi_dumps(obj:Any) -> bytes
Serialize an object to UTF-8 encoded JSON bytes.
funcpython.langsmith._openapi_client._utils._typing.is_iterable_type(typ:type) -> bool
If the given type is `typing.Iterable[T]`
funcpython.langsmith._openapi_client._utils._utils.quote(string:str) -> str
Add single quotation marks around the given string.
funcpython.langsmith._openapi_client._utils._utils.removeprefix(string:str, prefix:str) -> str
Remove a prefix from a string.
funcpython.langsmith._openapi_client._utils._utils.removesuffix(string:str, suffix:str) -> str
Remove a suffix from a string.
classpython.langsmith._openapi_client.types.annotation_queue_schema.AnnotationQueueSchema
AnnotationQueue schema.
classpython.langsmith._openapi_client.types.annotation_queue_size_schema.AnnotationQueueSizeSchema
Size of an Annotation Queue
classpython.langsmith._openapi_client.types.annotation_queues.run_create_by_key_params.Body
Add run to AQ by SmithDB key.
classpython.langsmith._runtime_overrides.RuntimeOverrides
Overrides for LangSmith runtime behavior.
funcpython.langsmith._runtime_overrides.get_runtime_overrides() -> RuntimeOverrides
Get the current runtime overrides.
funcpython.langsmith._runtime_overrides.set_runtime_overrides(aio_to_thread:Optional[AioToThread]=None) -> None
Set LangSmith runtime overrides.
classpython.langsmith.anonymizer.ReplacerOptions
Configuration options for replacing sensitive data.
classpython.langsmith.anonymizer.StringNode
String node extracted from the data.
classpython.langsmith.anonymizer.StringNodeProcessor
Processes a list of string nodes for masking.
methodpython.langsmith.anonymizer.StringNodeProcessor.mask_nodes(nodes:list[StringNode]) -> list[StringNode]
Accept and return a list of string nodes to be masked.
classpython.langsmith.anonymizer.StringNodeRule
Declarative rule used for replacing sensitive data.
funcpython.langsmith.anonymizer.create_anonymizer(replacer:ReplacerType, *max_depth:Optional[int]=None) -> Callable[[Any], Any]
Create an anonymizer function.
classpython.langsmith.async_client.AsyncClient
Async Client for interacting with the LangSmith API.
methodpython.langsmith.async_client.AsyncClient.aclose()
Close the async client.
methodpython.langsmith.async_client.AsyncClient.agent_exists(identifier:str) -> bool
Check if an agent repo exists.
methodpython.langsmith.async_client.AsyncClient.api_key() -> Optional[str]
Return the API key used for authentication.
methodpython.langsmith.async_client.AsyncClient.create_dataset(dataset_name:str, **kwargs:Any) -> ls_schemas.Dataset
Create a dataset.
methodpython.langsmith.async_client.AsyncClient.create_example(inputs:dict[str, Any], outputs:Optional[dict[str, Any]]=None, dataset_id:Optional[ls_client.ID_TYPE]=None, dataset_name:Optional[str]=None, **kwargs:Any) -> ls_schemas.Example
Create an example.
methodpython.langsmith.async_client.AsyncClient.create_project(project_name:str, **kwargs:Any) -> ls_schemas.TracerSession
Create a project.
methodpython.langsmith.async_client.AsyncClient.create_prompt(prompt_identifier:str, *description:Optional[str]=None, *readme:Optional[str]=None, *tags:Optional[Sequence[str]]=None, *is_public:bool=False) -> ls_schemas.Prompt
Create a new prompt.
methodpython.langsmith.async_client.AsyncClient.create_run(name:str, inputs:dict[str, Any], run_type:str, *project_name:Optional[str]=None, *revision_id:Optional[ls_client.ID_TYPE]=None, **kwargs:Any) -> None
Create a run.
methodpython.langsmith.async_client.AsyncClient.delete_agent(identifier:str) -> None
Delete an agent and its owned child file repos.
methodpython.langsmith.async_client.AsyncClient.delete_dataset(dataset_id:ls_client.ID_TYPE) -> None
Delete a dataset.
methodpython.langsmith.async_client.AsyncClient.delete_feedback(feedback_id:ID_TYPE) -> None
Delete a feedback by ID.
methodpython.langsmith.async_client.AsyncClient.delete_feedback_config(feedback_key:str) -> None
Delete a feedback configuration.
methodpython.langsmith.async_client.AsyncClient.delete_project(*project_name:Optional[str]=None, *project_id:Optional[str]=None) -> None
Delete a project from LangSmith.
methodpython.langsmith.async_client.AsyncClient.delete_prompt(prompt_identifier:str) -> None
Delete a prompt.
methodpython.langsmith.async_client.AsyncClient.delete_skill(identifier:str) -> None
Delete a skill and its owned child file repos.
methodpython.langsmith.async_client.AsyncClient.evaluators() -> AsyncEvaluatorsResource
Access the evaluator resource.
methodpython.langsmith.async_client.AsyncClient.get_prompt(prompt_identifier:str) -> Optional[ls_schemas.Prompt]
Get a specific prompt by its identifier.
methodpython.langsmith.async_client.AsyncClient.headers() -> dict[str, str]
Return the custom headers used for API requests.
methodpython.langsmith.async_client.AsyncClient.info() -> ls_schemas.LangSmithInfo
Get information about the LangSmith server.
methodpython.langsmith.async_client.AsyncClient.like_prompt(prompt_identifier:str) -> dict[str, int]
Like a prompt.
methodpython.langsmith.async_client.AsyncClient.list_datasets(**kwargs:Any) -> AsyncIterator[ls_schemas.Dataset]
List datasets.
methodpython.langsmith.async_client.AsyncClient.list_examples(*dataset_id:Optional[ls_client.ID_TYPE]=None, *dataset_name:Optional[str]=None, **kwargs:Any) -> AsyncIterator[ls_schemas.Example]
List examples.
methodpython.langsmith.async_client.AsyncClient.public() -> AsyncPublicResource
Access the public shared-run resource.
methodpython.langsmith.async_client.AsyncClient.pull_agent(identifier:str, *version:Optional[str]=None) -> ls_schemas.AgentContext
Pull an agent from Hub.
methodpython.langsmith.async_client.AsyncClient.pull_skill(identifier:str, *version:Optional[str]=None) -> ls_schemas.SkillContext
Pull a skill from Hub.
methodpython.langsmith.async_client.AsyncClient.read_dataset(dataset_name:Optional[str]=None, dataset_id:Optional[ls_client.ID_TYPE]=None) -> ls_schemas.Dataset
Read a dataset.
methodpython.langsmith.async_client.AsyncClient.read_example(example_id:ls_client.ID_TYPE) -> ls_schemas.Example
Read an example.
methodpython.langsmith.async_client.AsyncClient.read_feedback(feedback_id:ls_client.ID_TYPE) -> ls_schemas.Feedback
Read feedback.
methodpython.langsmith.async_client.AsyncClient.read_project(project_name:Optional[str]=None, project_id:Optional[ls_client.ID_TYPE]=None) -> ls_schemas.TracerSession
Read a project.
methodpython.langsmith.async_client.AsyncClient.read_run(run_id:ls_client.ID_TYPE, *project_id:Optional[ls_client.ID_TYPE]=None) -> ls_schemas.Run
Read a run.
methodpython.langsmith.async_client.AsyncClient.run_is_shared(run_id:ls_client.ID_TYPE) -> bool
Get share state for a run asynchronously.
methodpython.langsmith.async_client.AsyncClient.runs() -> AsyncRunsResource
Access the runs resource.
methodpython.langsmith.async_client.AsyncClient.share_run(run_id:ls_client.ID_TYPE, *share_id:Optional[ls_client.ID_TYPE]=None) -> str
Get a share link for a run asynchronously.
methodpython.langsmith.async_client.AsyncClient.skill_exists(identifier:str) -> bool
Check if a skill repo exists.
methodpython.langsmith.async_client.AsyncClient.traces() -> AsyncTracesResource
Access the traces resource (query, list_runs).
methodpython.langsmith.async_client.AsyncClient.unlike_prompt(prompt_identifier:str) -> dict[str, int]
Unlike a prompt.
methodpython.langsmith.async_client.AsyncClient.update_run(run_id:ls_client.ID_TYPE, **kwargs:Any) -> None
Update a run.
methodpython.langsmith.async_client.AsyncClient.workspace_id() -> Optional[str]
Return the workspace ID used for API requests.
funcpython.langsmith.evaluation._arunner.async_chain_from_iterable(iterable:Iterable[AsyncIterable[T]]) -> AsyncIterator[T]
Chain multiple async iterables.
funcpython.langsmith.evaluation._name_generation.random_name() -> str
Generate a random name.
classpython.langsmith.evaluation._runner.ExperimentResults
Represents the results of an evaluate() call.
methodpython.langsmith.evaluation._runner.ExperimentResults.experiment_id() -> uuid.UUID
The ID of the experiment.
methodpython.langsmith.evaluation._runner.ExperimentResults.wait() -> None
Wait for the evaluation runner to complete.
classpython.langsmith.evaluation.evaluator.Category
A category for categorical feedback.
classpython.langsmith.evaluation.evaluator.EvaluationResult
Evaluation result.
classpython.langsmith.evaluation.evaluator.EvaluationResults
Batch evaluation results.
classpython.langsmith.evaluation.evaluator.FeedbackConfig
Configuration to define a type of feedback.
classpython.langsmith.evaluation.evaluator.RunEvaluator
Evaluator interface class.
methodpython.langsmith.evaluation.evaluator.RunEvaluator.evaluate_run(run:Run, example:Optional[Example]=None, evaluator_run_id:Optional[uuid.UUID]=None) -> Union[EvaluationResult, EvaluationResults]
Evaluate an example.
classpython.langsmith.evaluation.llm_evaluator.CategoricalScoreConfig
Configuration for a categorical score.
classpython.langsmith.evaluation.llm_evaluator.ContinuousScoreConfig
Configuration for a continuous score.
classpython.langsmith.evaluation.llm_evaluator.LLMEvaluator
A class for building LLM-as-a-judge evaluators.
methodpython.langsmith.evaluation.llm_evaluator.LLMEvaluator.aevaluate_run(run:Run, example:Optional[Example]=None) -> Union[EvaluationResult, EvaluationResults]
Asynchronously evaluate a run.
methodpython.langsmith.evaluation.llm_evaluator.LLMEvaluator.evaluate_run(run:Run, example:Optional[Example]=None) -> Union[EvaluationResult, EvaluationResults]
Evaluate a run.
methodpython.langsmith.evaluation.string_evaluator.StringEvaluator.evaluate_run(run:Run, example:Optional[Example]=None, evaluator_run_id:Optional[uuid.UUID]=None) -> EvaluationResult
Evaluate a single run.
funcpython.langsmith.integrations.claude_agent_sdk._config.get_tracing_config() -> dict[str, Any]
Get the current tracing configuration.
funcpython.langsmith.integrations.claude_agent_sdk._tools.clear_parent_run_tree(token:Any=None) -> None
Reset the parent run tree in the current context.
funcpython.langsmith.integrations.google_adk._messages.has_function_calls(llm_response:Any) -> bool
Check if LlmResponse contains function calls.
funcpython.langsmith.integrations.google_adk._usage.extract_model_name(llm_request:Any) -> Optional[str]
Extract the model name from an LlmRequest.
funcpython.langsmith.integrations.google_adk._usage.extract_usage_from_response(llm_response:Any) -> dict[str, Any]
Extract token usage from LlmResponse.
funcpython.langsmith.integrations.openai_realtime._connection.is_inbound(event_type:str) -> bool
Direction of an event relative to the model.
classpython.langsmith.integrations.otel.processor.BatchSpanProcessor
Mock batch span processor class.
classpython.langsmith.integrations.otel.processor.OTLPSpanExporter
Mock otlp span exporter class.
classpython.langsmith.integrations.otel.processor.trace
Mock trace class.
classpython.langsmith.prompt_cache.AsyncCache
Deprecated alias for AsyncPromptCache.
classpython.langsmith.prompt_cache.AsyncPromptCache
Thread-safe LRU cache with asyncio task refresh.
methodpython.langsmith.prompt_cache.AsyncPromptCache.aset(key:str, value:Any, refresh_func:Callable[[], Awaitable[Any]]) -> None
Set a value in the cache.
methodpython.langsmith.prompt_cache.AsyncPromptCache.shutdown() -> None
Stop background refresh task.
methodpython.langsmith.prompt_cache.AsyncPromptCache.start() -> None
Start async background refresh loop.
methodpython.langsmith.prompt_cache.AsyncPromptCache.stop() -> None
Stop async background refresh loop.
classpython.langsmith.prompt_cache.Cache
Deprecated alias for PromptCache.
classpython.langsmith.prompt_cache.CacheEntry
A single cache entry with metadata for TTL tracking.
methodpython.langsmith.prompt_cache.CacheEntry.is_stale(ttl_seconds:Optional[float]) -> bool
Check if entry is past its TTL (needs refresh).
classpython.langsmith.prompt_cache.CacheMetrics
Cache performance metrics.
methodpython.langsmith.prompt_cache.CacheMetrics.hit_rate() -> float
Cache hit rate (0.0 to 1.0).
methodpython.langsmith.prompt_cache.CacheMetrics.total_requests() -> int
Total cache requests (hits + misses).
classpython.langsmith.prompt_cache.PromptCache
Thread-safe LRU cache with background thread refresh.
methodpython.langsmith.prompt_cache.PromptCache.set(key:str, value:Any, refresh_func:Callable[[], Any]) -> None
Set a value in the cache.
methodpython.langsmith.prompt_cache.PromptCache.shutdown() -> None
Stop background refresh thread.
methodpython.langsmith.prompt_cache.PromptCache.stop() -> None
Stop background refresh thread.
funcpython.langsmith.run_helpers.async_wrapper(*langsmith_extra:Optional[LangSmithExtra]=None, *args:Any, **kwargs:Any) -> Any
Async version of wrapper function.
funcpython.langsmith.run_helpers.get_current_run_tree() -> Optional[run_trees.RunTree]
Get the current run tree.
funcpython.langsmith.run_helpers.get_tracing_context(context:Optional[contextvars.Context]=None) -> dict[str, Any]
Get the current tracing context.
funcpython.langsmith.run_helpers.is_async(func:Callable) -> bool
Inspect function or wrapped function to see if it is async.
funcpython.langsmith.run_helpers.is_traceable_function(func:Any) -> TypeGuard[SupportsLangsmithExtra[P, R]]
Check if a function is `@traceable` decorated.
funcpython.langsmith.run_helpers.set_run_metadata(**metadata:Any) -> None
Update metadata on the current run tree.
classpython.langsmith.run_helpers.trace
Manage a LangSmith run in context.
classpython.langsmith.run_trees.ApiKeyAuth
API key authentication for write replicas.
classpython.langsmith.run_trees.AuthHeaders
Custom authentication headers for write replicas.
classpython.langsmith.run_trees.RunTree
Run Schema with back-references for posting runs.
methodpython.langsmith.run_trees.RunTree.add_event(events:Union[ls_schemas.RunEvent, Sequence[ls_schemas.RunEvent], Sequence[dict], dict, str]) -> None
Add an event to the list of events.
methodpython.langsmith.run_trees.RunTree.add_inputs(inputs:dict[str, Any]) -> None
Upsert the given inputs into the run.
methodpython.langsmith.run_trees.RunTree.add_metadata(metadata:dict[str, Any]) -> None
Add metadata to the run.
methodpython.langsmith.run_trees.RunTree.add_outputs(outputs:dict[str, Any]) -> None
Upsert the given outputs into the run.
methodpython.langsmith.run_trees.RunTree.add_tags(tags:Union[Sequence[str], str]) -> None
Add tags to the run.
methodpython.langsmith.run_trees.RunTree.client() -> Client
Return the client.
methodpython.langsmith.run_trees.RunTree.ensure_dotted_order() -> RunTree
Ensure the dotted order of the run.
methodpython.langsmith.run_trees.RunTree.get_url() -> str
Return the URL of the run.
methodpython.langsmith.run_trees.RunTree.infer_defaults(values:dict[str, Any]) -> dict[str, Any]
Assign name to the run.
methodpython.langsmith.run_trees.RunTree.patch(*exclude_inputs:bool=False) -> None
Patch the run tree to the API in a background thread.
methodpython.langsmith.run_trees.RunTree.post(exclude_child_runs:bool=True) -> None
Post the run tree to the API asynchronously.
methodpython.langsmith.run_trees.RunTree.to_headers() -> dict[str, str]
Return the `RunTree` as a dictionary of headers.
methodpython.langsmith.run_trees.RunTree.trace_start_time() -> datetime
Return the start time of the trace (root run).
methodpython.langsmith.run_trees.RunTree.wait() -> None
Wait for all `_futures` to complete.
classpython.langsmith.run_trees.WriteReplica
Configuration for a write replica endpoint.
classpython.langsmith.sandbox._client.SandboxClient
Client for interacting with the Sandbox Server API.
methodpython.langsmith.sandbox._client.SandboxClient.close() -> None
Close the HTTP client.
methodpython.langsmith.sandbox._client.SandboxClient.delete_sandbox(name:str, *headers:RequestHeaders=None) -> None
Delete a Sandbox.
methodpython.langsmith.sandbox._client.SandboxClient.delete_snapshot(snapshot_id:str, *headers:RequestHeaders=None) -> None
Delete a snapshot.
methodpython.langsmith.sandbox._client.SandboxClient.get_sandbox(name:str, *headers:RequestHeaders=None) -> Sandbox
Get a Sandbox by name.
methodpython.langsmith.sandbox._client.SandboxClient.get_sandbox_status(name:str, *headers:RequestHeaders=None) -> ResourceStatus
Get the provisioning status of a sandbox.
methodpython.langsmith.sandbox._client.SandboxClient.get_snapshot(snapshot_id:str, *headers:RequestHeaders=None) -> Snapshot
Get a snapshot by ID.
methodpython.langsmith.sandbox._client.SandboxClient.list_sandboxes(*headers:RequestHeaders=None) -> list[Sandbox]
List all Sandboxes.
methodpython.langsmith.sandbox._client.SandboxClient.list_snapshots(*name_contains:Optional[str]=None, *limit:Optional[int]=None, *offset:Optional[int]=None, *headers:RequestHeaders=None) -> list[Snapshot]
List snapshots.
methodpython.langsmith.sandbox._client.SandboxClient.start_sandbox(name:str, *timeout:int=120, *headers:RequestHeaders=None) -> Sandbox
Start a stopped sandbox and wait until ready.
classpython.langsmith.sandbox._exceptions.CommandTimeoutError
Raised when a command exceeds its timeout.
classpython.langsmith.sandbox._exceptions.ResourceCreationError
Raised when resource provisioning fails.
classpython.langsmith.sandbox._exceptions.ResourceNotFoundError
Raised when a resource is not found.
classpython.langsmith.sandbox._exceptions.ResourceTimeoutError
Raised when an operation times out.
classpython.langsmith.sandbox._exceptions.SandboxClientError
Base exception for sandbox client errors.
classpython.langsmith.sandbox._exceptions.TunnelError
Base exception for TCP tunnel errors.
classpython.langsmith.sandbox._exceptions.TunnelPortNotAllowedError
The daemon rejected the port as not allowed.
classpython.langsmith.sandbox._exceptions.ValidationError
Raised when request validation fails.
funcpython.langsmith.sandbox._helpers.extract_quota_type(message:str) -> Optional[str]
Extract quota type from error message.
funcpython.langsmith.sandbox._helpers.handle_sandbox_creation_error(error:httpx.HTTPStatusError) -> None
Handle HTTP errors specific to sandbox creation.
funcpython.langsmith.sandbox._helpers.parse_error_response(error:httpx.HTTPStatusError) -> dict[str, Any]
Parse standardized error response.
funcpython.langsmith.sandbox._helpers.parse_validation_error(error:httpx.HTTPStatusError) -> list[dict]
Parse Pydantic validation error response.
funcpython.langsmith.sandbox._helpers.validate_service_params(port:int, expires_in_seconds:int) -> None
Validate parameters for service URL generation.
funcpython.langsmith.sandbox._helpers.validate_ttl(value:Optional[int], name:str) -> None
Validate a TTL value for sandbox create/update.
classpython.langsmith.sandbox._models.ExecutionResult
Result of executing a command in a sandbox.
methodpython.langsmith.sandbox._models.ExecutionResult.success() -> bool
Return True if the command exited with code 0.
methodpython.langsmith.sandbox._models.ResourceStatus.from_dict(data:dict[str, Any]) -> ResourceStatus
Create a ResourceStatus from API response dict.
classpython.langsmith.sandbox._models.Snapshot
Represents a sandbox snapshot.
methodpython.langsmith.sandbox._models.Snapshot.from_dict(data:dict[str, Any]) -> Snapshot
Create a Snapshot from API response dict.
classpython.langsmith.sandbox._mounts.GCSMountConfig
GCS configuration for a sandbox mount.
classpython.langsmith.sandbox._mounts.GCSMountConfigRequired
Required GCS configuration for a sandbox mount.
classpython.langsmith.sandbox._mounts.GCSMountSpec
GCS-backed sandbox mount specification.
classpython.langsmith.sandbox._mounts.GitMountConfig
Git configuration for a sandbox mount.
classpython.langsmith.sandbox._mounts.GitMountConfigRequired
Required Git configuration for a sandbox mount.
classpython.langsmith.sandbox._mounts.GitMountRefSpec
Git ref selected for a sandbox mount.
classpython.langsmith.sandbox._mounts.GitMountSpec
Git-backed sandbox mount specification.
classpython.langsmith.sandbox._mounts.S3MountConfig
S3 configuration for a sandbox mount.
classpython.langsmith.sandbox._mounts.S3MountConfigRequired
Required S3 configuration for a sandbox mount.
classpython.langsmith.sandbox._mounts.S3MountSpec
S3-backed sandbox mount specification.
classpython.langsmith.sandbox._mounts.SandboxMountAuthConfig
Provider auth blocks for sandbox mounts.
classpython.langsmith.sandbox._mounts.SandboxMountConfig
Public mount config sent to the sandbox API.
methodpython.langsmith.sandbox._sandbox.Sandbox.capture_snapshot(name:str, *timeout:int=60, *headers:RequestHeaders=None) -> Snapshot
Capture a snapshot from this sandbox.
methodpython.langsmith.sandbox._sandbox.Sandbox.delete(*headers:RequestHeaders=None) -> None
Delete this sandbox.
methodpython.langsmith.sandbox._sandbox.Sandbox.from_dict(data:dict[str, Any], client:SandboxClient, auto_delete:bool=True) -> Sandbox
Create a Sandbox from API response dict.
methodpython.langsmith.sandbox._sandbox.Sandbox.read(path:str, *timeout:int=60, *headers:RequestHeaders=None) -> bytes
Read a file from the sandbox.
methodpython.langsmith.sandbox._sandbox.Sandbox.start(*timeout:int=120, *headers:RequestHeaders=None) -> None
Start a stopped sandbox and wait until ready.
methodpython.langsmith.sandbox._sandbox.Sandbox.write(path:str, content:Union[str, bytes], *timeout:int=60, *headers:RequestHeaders=None) -> None
Write content to a file in the sandbox.
classpython.langsmith.sandbox._tunnel.AsyncTunnel
Async wrapper around :class:`Tunnel`.
classpython.langsmith.sandbox._tunnel.Tunnel
TCP tunnel to a port inside a sandbox.
methodpython.langsmith.sandbox._tunnel.Tunnel.close() -> None
Shut down the tunnel, closing all connections.
methodpython.langsmith.sandbox._tunnel.Tunnel.local_port() -> int
Local port the tunnel is listening on.
methodpython.langsmith.sandbox._yamux.YamuxSession.close() -> None
Close the session and all streams.
methodpython.langsmith.sandbox._yamux.YamuxSession.open_stream() -> YamuxStream
Open a new multiplexed stream.
classpython.langsmith.sandbox._yamux.YamuxStream
A single multiplexed stream within a yamux session.
methodpython.langsmith.sandbox._yamux.YamuxStream.close() -> None
Close the stream (sends FIN to the remote end).
methodpython.langsmith.sandbox._yamux.YamuxStream.read(n:int) -> bytes
Read up to *n* bytes, blocking until data is available.
methodpython.langsmith.sandbox._yamux.YamuxStream.write(data:bytes) -> int
Write *data*, blocking if the send window is exhausted.
classpython.langsmith.schemas.APIFeedbackSource
API feedback source.
classpython.langsmith.schemas.AgentContext
An agent pulled from hub.
classpython.langsmith.schemas.AgentEntry
A link to another agent repo.
classpython.langsmith.schemas.AnnotationQueue
Represents an annotation queue.
classpython.langsmith.schemas.AnnotationQueueWithDetails
Represents an annotation queue with details.
classpython.langsmith.schemas.AttachmentInfo
Info for an attachment.
classpython.langsmith.schemas.AttachmentsOperations
Operations to perform on attachments.
classpython.langsmith.schemas.BaseMessageLike
A protocol representing objects similar to BaseMessage.
methodpython.langsmith.schemas.BaseMessageLike.type() -> str
Type of the Message, used for serialization.
classpython.langsmith.schemas.BatchIngestConfig
Configuration for batch ingestion.
classpython.langsmith.schemas.BinaryIOLike
Protocol for binary IO-like objects.
methodpython.langsmith.schemas.BinaryIOLike.getvalue() -> bytes
Get value function.
methodpython.langsmith.schemas.BinaryIOLike.read(size:int=-1) -> bytes
Read function.
methodpython.langsmith.schemas.BinaryIOLike.seek(offset:int, whence:int=0) -> int
Seek function.
classpython.langsmith.schemas.ComparativeExperiment
Represents a comparative experiment.
methodpython.langsmith.schemas.ComparativeExperiment.metadata() -> dict[str, Any]
Retrieve the metadata (if any).
classpython.langsmith.schemas.DataType
Enum for dataset data types.
classpython.langsmith.schemas.Dataset
Dataset ORM model.
methodpython.langsmith.schemas.Dataset.url() -> Optional[str]
URL of this run within the app.
classpython.langsmith.schemas.DatasetBase
Dataset base model.
classpython.langsmith.schemas.DatasetShareSchema
Represents the schema for a dataset share.
classpython.langsmith.schemas.DatasetTransformation
Schema for dataset transformations.
classpython.langsmith.schemas.DatasetVersion
Class representing a dataset version.
classpython.langsmith.schemas.DirectoryCommitInfo
Commit details returned from a directory commit.
classpython.langsmith.schemas.DirectoryCommitResponse
Response body for ``POST /directories/commits``.
classpython.langsmith.schemas.Example
Example model.
methodpython.langsmith.schemas.Example.url() -> Optional[str]
URL of this run within the app.
classpython.langsmith.schemas.ExampleBase
Example base model.
classpython.langsmith.schemas.ExampleCreate
Example upload with attachments.
classpython.langsmith.schemas.ExampleUpdate
Example update with attachments.
classpython.langsmith.schemas.ExampleUpsertWithAttachments
Example create with attachments.
classpython.langsmith.schemas.ExampleWithRuns
Example with runs.
classpython.langsmith.schemas.ExperimentRunStats
Run statistics for an experiment.
classpython.langsmith.schemas.ExtractedUsageMetadata
Usage metadata dictionary extracted from a run.
classpython.langsmith.schemas.Feedback
Schema for getting feedback.
classpython.langsmith.schemas.FeedbackBase
Feedback schema.
classpython.langsmith.schemas.FeedbackCategory
Specific value and label pair for feedback.
classpython.langsmith.schemas.FeedbackCreate
Schema used for creating feedback.
classpython.langsmith.schemas.FeedbackFormula
Schema for getting feedback formulas.
classpython.langsmith.schemas.FeedbackFormulaCreate
Schema used for creating a feedback formula.
classpython.langsmith.schemas.FeedbackFormulaUpdate
Schema used for updating a feedback formula.
classpython.langsmith.schemas.FeedbackIngestToken
Represents the schema for a feedback ingest token.
classpython.langsmith.schemas.FeedbackSourceBase
Base class for feedback sources.
classpython.langsmith.schemas.FeedbackSourceType
Feedback source type.
classpython.langsmith.schemas.FileEntry
A file with inline content.
classpython.langsmith.schemas.InputCostDetails
Breakdown of input token costs.
classpython.langsmith.schemas.InputTokenDetails
Breakdown of input token counts.
classpython.langsmith.schemas.InsightsCluster
A single cluster of runs in an insights report.
classpython.langsmith.schemas.InsightsHighlightedTrace
A trace highlighted in an insights report summary.
classpython.langsmith.schemas.LangSmithInfo
Information about the LangSmith server.
classpython.langsmith.schemas.LangSmithSettings
Settings for the LangSmith tenant.
classpython.langsmith.schemas.ListPromptsResponse
A list of prompts with metadata.
classpython.langsmith.schemas.ModelFeedbackSource
Model feedback source.
classpython.langsmith.schemas.OutputCostDetails
Breakdown of output token costs.
classpython.langsmith.schemas.OutputTokenDetails
Breakdown of output token counts.
classpython.langsmith.schemas.Prompt
Represents a Prompt with metadata.
classpython.langsmith.schemas.PromptCommit
Represents a Prompt with a manifest.
classpython.langsmith.schemas.PromptSortField
Enum for sorting fields for prompts.
classpython.langsmith.schemas.Run
Run schema when loading from the DB.
methodpython.langsmith.schemas.Run.input_cost() -> Decimal | None
Alias for prompt_cost.
methodpython.langsmith.schemas.Run.input_cost_details() -> dict[str, Decimal] | None
Alias for prompt_cost_details.
methodpython.langsmith.schemas.Run.input_token_details() -> dict[str, int] | None
Alias for prompt_token_details.
methodpython.langsmith.schemas.Run.input_tokens() -> int | None
Alias for prompt_tokens.
methodpython.langsmith.schemas.Run.output_cost() -> Decimal | None
Alias for completion_cost.
methodpython.langsmith.schemas.Run.output_cost_details() -> dict[str, Decimal] | None
Alias for completion_cost_details.
methodpython.langsmith.schemas.Run.output_token_details() -> dict[str, int] | None
Alias for output_token_details.
methodpython.langsmith.schemas.Run.output_tokens() -> int | None
Alias for completion_tokens.
methodpython.langsmith.schemas.Run.url() -> Optional[str]
URL of this run within the app.
classpython.langsmith.schemas.RunBase
Base Run schema.
methodpython.langsmith.schemas.RunBase.latency() -> Optional[float]
Latency in seconds.
methodpython.langsmith.schemas.RunBase.metadata() -> dict[str, Any]
Retrieve the metadata (if any).
methodpython.langsmith.schemas.RunBase.revision_id() -> Optional[UUID]
Retrieve the revision ID (if any).
classpython.langsmith.schemas.RunEvent
Run event schema.
classpython.langsmith.schemas.RunLikeDict
Run-like dictionary, for type-hinting.
classpython.langsmith.schemas.RunTypeEnum
(Deprecated) Enum for run types.
classpython.langsmith.schemas.RunWithAnnotationQueueInfo
Run schema with annotation queue info.
classpython.langsmith.schemas.SkillContext
A skill pulled from hub.
classpython.langsmith.schemas.SkillEntry
A link to a skill repo.
classpython.langsmith.schemas.TimeDeltaInput
Timedelta input schema.
classpython.langsmith.schemas.TracerSession
TracerSession schema for the API.
methodpython.langsmith.schemas.TracerSession.metadata() -> dict[str, Any]
Retrieve the metadata (if any).
methodpython.langsmith.schemas.TracerSession.tags() -> list[str]
Retrieve the tags (if any).
methodpython.langsmith.schemas.TracerSession.url() -> Optional[str]
URL of this run within the app.
classpython.langsmith.schemas.TracerSessionResult
A project, hydrated with additional information.
classpython.langsmith.schemas.UsageMetadata
Usage metadata for a message, such as token counts.
classpython.langsmith.utils.FilterLangSmithRetry
Filter for retries from this lib.
methodpython.langsmith.utils.FilterLangSmithRetry.filter(record) -> bool
Filter retries from this library.
classpython.langsmith.utils.LangSmithAuthError
Couldn't authenticate with the LangSmith API.
classpython.langsmith.utils.LangSmithConflictError
The resource already exists.
classpython.langsmith.utils.LangSmithConnectionError
Couldn't connect to the LangSmith API.
classpython.langsmith.utils.LangSmithError
An error occurred while communicating with the LangSmith API.
classpython.langsmith.utils.LangSmithExceptionGroup
Port of ExceptionGroup for Py < 3.11.
classpython.langsmith.utils.LangSmithMissingAPIKeyWarning
Warning for missing API key.
classpython.langsmith.utils.LangSmithNotFoundError
Couldn't find the requested resource.
classpython.langsmith.utils.LangSmithRequestTimeout
Client took too long to send request body.
classpython.langsmith.utils.LangSmithRetry
Wrapper to filter logs with this name.
classpython.langsmith.utils.LangSmithWarning
Base class for warnings.
funcpython.langsmith.utils.convert_langchain_message(message:ls_schemas.BaseMessageLike) -> dict
Convert a LangChain message to an example.
funcpython.langsmith.utils.deepish_copy(val:T) -> T
Deep copy a value with a compromise for uncopyable objects.
funcpython.langsmith.utils.filter_logs(logger:logging.Logger, filters:Sequence[logging.Filter]) -> Generator[None, None, None]
Temporarily adds specified filters to a logger.
funcpython.langsmith.utils.get_api_key(api_key:Optional[str]) -> Optional[str]
Get the API key from the environment or the given value.
funcpython.langsmith.utils.get_cache_dir(cache:Optional[str]) -> Optional[str]
Get the testing cache directory.
funcpython.langsmith.utils.get_enum_value(enu:Union[enum.Enum, str]) -> str
Get the value of a string enum.
funcpython.langsmith.utils.get_invalid_prompt_identifier_msg(identifier:str) -> str
Get the error message for an invalid prompt identifier.
funcpython.langsmith.utils.get_llm_generation_from_outputs(outputs:Mapping[str, Any]) -> str
Get the LLM generation from the outputs.
funcpython.langsmith.utils.get_messages_from_inputs(inputs:Mapping[str, Any]) -> list[dict[str, Any]]
Extract messages from the given inputs dictionary.
funcpython.langsmith.utils.get_prompt_from_inputs(inputs:Mapping[str, Any]) -> str
Retrieve the prompt from the given inputs.
funcpython.langsmith.utils.get_tracer_project(return_default_value=True) -> Optional[str]
Get the project name for a LangSmith tracer.
funcpython.langsmith.utils.get_workspace_id(workspace_id:Optional[str]) -> Optional[str]
Get workspace ID.
funcpython.langsmith.utils.is_base_message_like(obj:object) -> bool
Check if the given object is similar to `BaseMessage`.
funcpython.langsmith.utils.is_env_var_truish(value:Optional[str]) -> bool
Check if the given environment variable is truish.
funcpython.langsmith.utils.is_truish(val:Any) -> bool
Check if the value is truish.
funcpython.langsmith.utils.log_once(level:int, message:str) -> None
Log a message at the specified level, but only once.
funcpython.langsmith.utils.raise_for_status_with_text(response:Union[requests.Response, httpx.Response]) -> None
Raise an error with the response text.
funcpython.langsmith.utils.tracing_is_enabled(ctx:Optional[dict]=None) -> Union[bool, Literal['local']]
Return True if tracing is enabled.
funcpython.langsmith.utils.with_cache(path:Union[str, pathlib.Path], ignore_hosts:Optional[Sequence[str]]=None, allow_hosts:Optional[Sequence[str]]=None) -> Generator[None, None, None]
Use a cache for requests.
funcpython.langsmith.utils.with_optional_cache(path:Optional[Union[str, pathlib.Path]], ignore_hosts:Optional[Sequence[str]]=None, allow_hosts:Optional[Sequence[str]]=None) -> Generator[None, None, None]
Use a cache for requests.
funcpython.langsmith.utils.wrapper(*args:Any, **kwargs:Any) -> Any
Validate exactly one arg in each group is not None.
funcpython.langsmith.utils.xor_args(*arg_groups:tuple[str, ...]) -> Callable
Validate specified keyword args are mutually exclusive.
funcpython.langsmith.uuid.uuid7() -> _uuid.UUID
Generate a random UUID v7.
funcpython.langsmith.uuid.uuid7_from_datetime(dt:_dt.datetime) -> _uuid.UUID
Generate a UUID v7 from a datetime.

About this data

These signatures were extracted from the public source of langchain-ai/langsmith-sdk using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries