Skip to content

feat: caller-owned trace_context_extra_baggage; stop defaulting source=agents (v0.11.19)#917

Open
RunnanJia wants to merge 1 commit into
mainfrom
feat/trace-context-extra-baggage
Open

feat: caller-owned trace_context_extra_baggage; stop defaulting source=agents (v0.11.19)#917
RunnanJia wants to merge 1 commit into
mainfrom
feat/trace-context-extra-baggage

Conversation

@RunnanJia

Copy link
Copy Markdown
Contributor

Why

The chat-model factory hardcoded extra_baggage=["source=agents"] when building LLM Gateway trace headers. That is incorrect for any caller that isn't agents — source (and executionType/jobKey) are product-owned attribution values and must be supplied by the caller, not defaulted in this shared package.

What

  • Removed the hardcoded source=agents.
  • Added a trace_context_extra_baggage: list[str] | None parameter to get_chat_model, threaded through the new path, the legacy path, and into the OpenAI/Vertex/Bedrock legacy transports down to the per-request httpx hook (_inject_trace_context_headers).
  • Version bump → 0.11.19.
  • Trace-context callback/forwarding tests added.

Callers (e.g. uipath-agents-python) now pass their own source/executionType/jobKey via this parameter.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 17, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes trace-context “extra baggage” (e.g., source, executionType, jobKey) caller-owned instead of hardcoding source=agents inside the shared chat-model factory, and threads the new option through both the new and legacy LLM client paths. It also bumps the package version to 0.11.19 and adds/updates tests to validate the forwarding behavior.

Changes:

  • Add trace_context_extra_baggage: list[str] | None to get_chat_model and propagate it into trace header injection.
  • Remove the hardcoded extra_baggage=["source=agents"] from trace-context header creation across callback + legacy transports.
  • Bump version to 0.11.19 and expand trace-context callback/forwarding test coverage.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
uv.lock Updates lock metadata and bumps uipath-langchain version to 0.11.19.
pyproject.toml Bumps project version to 0.11.19.
tests/chat/test_trace_context_callback.py Adds tests ensuring extra baggage defaults to None and is forwarded through legacy transports.
src/uipath_langchain/chat/chat_model_factory.py Introduces trace_context_extra_baggage parameter and wires it into the trace headers callback.
src/uipath_langchain/chat/_legacy/openai.py Threads extra baggage into per-request trace header injection via httpx transports.
src/uipath_langchain/chat/_legacy/vertex.py Threads extra baggage into Vertex URL rewrite transports and header injection.
src/uipath_langchain/chat/_legacy/bedrock.py Threads extra baggage into Bedrock request modification header injection.
src/uipath_langchain/chat/_legacy/chat_model_factory.py Propagates extra baggage through the legacy chat model factory constructors.

Comment on lines +188 to +192
cb_list.append(
_TraceContextHeadersCallback(
trace_context_extra_baggage=trace_context_extra_baggage
)
)
@RunnanJia RunnanJia force-pushed the feat/trace-context-extra-baggage branch 2 times, most recently from e357398 to 523733d Compare July 1, 2026 18:02
@RunnanJia RunnanJia force-pushed the feat/trace-context-extra-baggage branch from 523733d to b274f94 Compare July 1, 2026 18:14
@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

Comment thread pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "uipath-langchain"
version = "0.13.18"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after platform version is released icrease here also the platform version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants