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
PythonlangsmithclientClientcreate_run
Method●Since v0.0

create_run

Copy
create_run(
  self,
  name: str,
  inputs: dict[str, Any],
  run_type
View source on GitHub
:
RUN_TYPE_T
,
*
,
project_name
:
Optional
[
str
]
=
None
,
revision_id
:
Optional
[
str
]
=
None
,
dangerously_allow_filesystem
:
bool
=
False
,
api_key
:
Optional
[
str
]
=
None
,
api_url
:
Optional
[
str
]
=
None
,
**
kwargs
:
Any
=
{
}
)
->
None

Parameters

NameTypeDescription
name*str

The name of the run.

inputs*Dict[str, Any]

The input values for the run.

run_type*str

The type of the run, such as tool, chain, llm, retriever, embedding, prompt, or parser.

project_nameOptional[str]
Default:None
revision_idOptional[Union[UUID, str]]
Default:None
api_keyOptional[str]
Default:None
api_urlOptional[str]
Default:None
service_key*Optional[str]
tenant_id*Optional[str]
authorization*Optional[str]
cookie*Optional[str]
**kwargsAny
Default:{}

Persist a run to the LangSmith API.

Example:

from langsmith import Client
import datetime
from uuid import uuid4

client = Client()

run_id = uuid4()
client.create_run(
    id=run_id,
    project_name=project_name,
    name="test_run",
    run_type="llm",
    inputs={"prompt": "hello world"},
    outputs={"generation": "hi there"},
    start_time=datetime.datetime.now(datetime.timezone.utc),
    end_time=datetime.datetime.now(datetime.timezone.utc),
    hide_inputs=True,
    hide_outputs=True,
)

The project name of the run.

The revision ID of the run.

The API key to use for this specific run.

The API URL to use for this specific run.

The service JWT key for service-to-service auth.

The tenant ID for multi-tenant requests.

The Authorization header value.

The Cookie header value.

Additional keyword arguments.