class langgraph_agent_toolkit.core.observability.langsmith.LangsmithObservability(remote_first=False)[source][source]

Bases: BaseObservabilityPlatform

Langsmith implementation of observability platform.

Initialize LangsmithObservability.

Parameters:

remote_first (bool) – If True, prioritize remote prompts over local ones.

__init__(remote_first=False)[source][source]

Initialize LangsmithObservability.

Parameters:

remote_first (bool) – If True, prioritize remote prompts over local ones.

property required_vars: List[str]
get_callback_handler(**kwargs)[source][source]

Get the callback handler - LangSmith uses automatic tracing.

Return type:

None

before_shutdown()[source][source]

Perform any necessary cleanup before shutdown.

Return type:

None

record_feedback(run_id, key, score, **kwargs)[source][source]

Record feedback for a run to LangSmith.

Parameters:
Return type:

None

push_prompt(name, prompt_template, metadata=None, force_create_new_version=True)[source][source]

Push a prompt to LangSmith.

Parameters:
  • name (str) – Name of the prompt

  • prompt_template (str | List[ChatMessageDict]) – The prompt template (string or list of message dicts)

  • metadata (Dict[str, Any] | None) – Optional metadata (can include ‘model’ to create a chain)

  • force_create_new_version (bool) – If True, always create a new version

Return type:

None

pull_prompt(name, template_format='f-string', **kwargs)[source][source]

Pull a prompt from LangSmith.

Parameters:
  • name (str) – Name of the prompt

  • template_format (Literal['f-string', 'mustache', 'jinja2']) – Format for the template

  • **kwargs – Additional parameters (e.g., version, label)

Returns:

ChatPromptTemplate

Return type:

ChatPromptTemplate | str | dict | None

delete_prompt(name)[source][source]

Delete a prompt from LangSmith.

Parameters:

name (str) – Name of the prompt to delete

Return type:

None

property remote_first: bool
static requires_env_vars(func)[source]

Validate environment variables before calling a method.

Parameters:

func (Callable[[...], T])

Return type:

Callable[[…], T]

trace_context(run_id, **kwargs)[source]

Create a trace context for the execution.

Override in subclasses for platform-specific implementation.

Parameters:
  • run_id (str) – The run ID to use as trace ID

  • **kwargs – Additional context parameters (user_id, input, etc.)

Yields:

None (or platform-specific context object)

validate_environment()[source]

Validate that required environment variables are set.

Return type:

bool