镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

fix(langchain): don't record tool call output if not include_prompt / should_send_default_pii - #4836

Merged
shellmayr merged 1 commit into
masterfrom
shellmayr/fix/langchain-tool-calls-outputs
Sep 24, 2025
Merged

shellmayr merged 1 commit into
masterfrom
shellmayr/fix/langchain-tool-calls-outputs

Conversation

@shellmayr

@shellmayr shellmayr commented Sep 22, 2025 •

Copy link
Copy Markdown
Member
  • This PR makes sure we don't record tool calls as outputs in gen_ai.chat spans in langchain when users deselect the option to include prompts / send pii

Closes TET-1181

@linear

linear Bot commented Sep 22, 2025

Copy link
Copy Markdown

@codecov

codecov Bot commented Sep 22, 2025 •

Copy link
Copy Markdown

✅ All tests passed in 2567.23s

@shellmayr
shellmayr marked this pull request as ready for review September 22, 2025 13:11
@shellmayr
shellmayr requested a review from a team as a code owner September 22, 2025 13:11
Comment thread sentry_sdk/integrations/langchain.py
@linear

linear Bot commented Sep 22, 2025

Copy link
Copy Markdown

@alexander-alderman-webb

Copy link
Copy Markdown
Collaborator

My one concern is that I have not heard tool arguments referred to as "prompts". Would users be confused if setting include_prompts=False also hides data from the tool calls?

We could consider more granular setting, especially since I am unsure how intuitive it is for tool call input and outputs to fall under the "prompt" umbrella.

But if that's more niche than we want to cater for, this looks good to go.

@shellmayr

Copy link
Copy Markdown
Member Author

My one concern is that I have not heard tool arguments referred to as "prompts". Would users be confused if setting include_prompts=False also hides data from the tool calls?

@alexander-alderman-webb My thought on this is that a tool call may include raw user input, and that raw user input is a prompt, no? And in terms of behaviour, if a user specifies that they do not want to record that type of user input in general, we should stick to it throughout the SDK. Just to be clear: we still record 1. that tool calls happen and 2. which tool is being called - just not the user input associated with it.

@alexander-alderman-webb alexander-alderman-webb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. Thanks for answering my questions!

Not sure if someone with more experience on the AI integrations should also approve.

@antonpirker antonpirker left a comment

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.

Yes, looks good. The name include_prompts is not the best, you are right @alexander-alderman-webb but this is the name we have in other integrations. The functionality of it evolved over time. We probably should think of changing it but as this is a library we need to be careful with this to not break users code.

@shellmayr
shellmayr merged commit e52c3b1 into master Sep 24, 2025
121 of 123 checks passed
@shellmayr
shellmayr deleted the shellmayr/fix/langchain-tool-calls-outputs branch September 24, 2025 07:37
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