Added support for LangSmith tracing across workflows and activities#188
Added support for LangSmith tracing across workflows and activities#188mfateev merged 13 commits intotemporalio:mainfrom
Conversation
…rkflow and multiple activities.
langchain/langchain_interceptor.py
Outdated
| # with trace(...): | ||
| # return await self.next.execute_workflow(input) | ||
| with temporalio.workflow.unsafe.sandbox_unrestricted(): | ||
| t = trace(name=f"execute_workflow:{name}", run_id=workflow.info().run_id) |
There was a problem hiding this comment.
Any concerns with tracing during replay here?
There was a problem hiding this comment.
I didn't see any duplicated traces in the UI when the replay was forced.
There was a problem hiding this comment.
I see we never really had tests for the langchain sample, so don't have to add as part of this, but we should probably make an issue to add them at some point. We've found cases where these integration-type examples become stale or stop working with new dependency versions and there are no tests to confirm that.
There was a problem hiding this comment.
I'm not sure how a local test would help, as they don't have an embeddable version of Langsmith.
There was a problem hiding this comment.
That is unfortunate. Ideally we'd test the same way they encourage users to test using the in-memory representations or mocks they suggest. But we do often not test integrations in this repo.
cretz
left a comment
There was a problem hiding this comment.
LGTM, @dandavison - do you want to add anything?
langchain/workflow.py
Outdated
| from temporalio import workflow | ||
|
|
||
| with workflow.unsafe.imports_passed_through(): | ||
| from dataclasses import dataclass |
There was a problem hiding this comment.
Standard library packages re already passed through
…188) * Added langchain tracing interceptor. Changed sample to use a child workflow and multiple activities.
What was changed
Added an interceptor that propagates LangSmith tracing headers as well as creates corresponding spans for Temporal workflows and activities.
Why?
Enable LangSmith visibility for workflows that use LangChain.