-
Notifications
You must be signed in to change notification settings - Fork 74
Added support for LangSmith tracing across workflows and activities #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any concerns with tracing during replay here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see any duplicated traces in the UI when the replay was forced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.