-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(braintrust): dont decorate generate and clean up unused code #5636
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
fix(braintrust): dont decorate generate and clean up unused code #5636
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Greptile Overview
Summary
This PR addresses Braintrust tracing issues and removes unused orchestration code from the agent search system. The changes focus on two main areas: selective application of Braintrust `@traced` decorators and cleanup of deprecated agent orchestration nodes.The Braintrust tracing changes are carefully targeted - the PR removes the @traced
decorator from the stream
method in the LLM interface (which was causing issues with iterator tracing) while adding it to specific streaming functions where it works properly. In shared_graph_utils/llm.py
, the stream_llm_answer
function gains tracing, and in dr_a0_clarification.py
, a new wrapper function stream_and_process()
is created with tracing around LLM streaming operations.
The cleanup portion removes several orchestration nodes that are no longer used in the current agent search architecture: choose_tool.py
(354 lines of tool selection logic), call_tool.py
(tool execution orchestration), and prepare_tool_input.py
(tool input preparation). These files appear to be part of an older orchestration approach that has been superseded.
The PR also includes a minor dependency cleanup in process_message.py
where ToolCallException
is moved from an external import to a local class definition, reducing coupling between modules. Additionally, the entire query_validation.py
file is removed, which was already marked as deprecated with a "No longer used" comment.
These changes align with the codebase's principles of avoiding dead code while improving observability through selective tracing of critical LLM operations.
Important Files Changed
Changed Files
Filename | Score | Overview |
---|---|---|
backend/onyx/agents/agent_search/shared_graph_utils/llm.py | 5/5 | Added Braintrust tracing to stream_llm_answer function for observability |
backend/onyx/secondary_llm_flows/query_validation.py | 4/5 | Deleted deprecated query validation file that was marked as no longer used |
backend/onyx/llm/interfaces.py | 4/5 | Removed Braintrust tracing decorator from stream method to fix iterator issues |
backend/onyx/agents/agent_search/orchestration/nodes/choose_tool.py | 2/5 | Deleted entire tool selection orchestration node (354 lines of critical logic) |
backend/onyx/agents/agent_search/dr/nodes/dr_a0_clarification.py | 4/5 | Added Braintrust tracing wrapper around LLM streaming operations |
backend/onyx/chat/process_message.py | 5/5 | Replaced external ToolCallException import with local class definition |
backend/onyx/agents/agent_search/orchestration/nodes/prepare_tool_input.py | 2/5 | Deleted tool input preparation function used in agent orchestration |
backend/onyx/agents/agent_search/orchestration/nodes/call_tool.py | 3/5 | Deleted tool execution orchestration node and ToolCallException class |
Confidence score: 3/5
- This PR has significant risks due to deletion of critical orchestration nodes that may still be referenced elsewhere in the codebase
- Score reflects concerns about removing substantial agent functionality without clear evidence it's truly unused
- Pay close attention to the deleted orchestration nodes (choose_tool.py, call_tool.py, prepare_tool_input.py) as they contain core agent functionality
8 files reviewed, 1 comment
backend/onyx/agents/agent_search/dr/nodes/dr_a0_clarification.py
Outdated
Show resolved
Hide resolved
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.
No issues found across 8 files
3 Jobs Failed: Run Integration Tests v2 / integration-tests (tests/mcp, tests-mcp) failed on "Wait for service to be ready"
Run Integration Tests v2 / integration-tests (tests/projects, tests-projects) failed on "Wait for service to be ready"
Run Integration Tests v2 / required failed on "Run actions/github-script@v7"
Summary: 8 successful workflows, 1 failed workflow
Last updated: 2025-10-08 03:15:05 UTC |
Description
Decorating the braintrust generator causes an unreasonable number of logs to be sent to braintrust.
To still decorate llm streams, I traced some higher level functions. I deleted unused code I found when looking through calls to stream llm.
How Has This Been Tested?
Tested locally
Additional Options