Repository navigation
馃泝 fix: Project Only Accepted Agents API Tool Calls - #16384
Conversation
|
Exact pushed head: This head switches the Agents API handler assembly from run-step reconstruction to the accepted-result projector published in Verification on this head: 111 focused tests passed across the five Agents API handler/service/tool-call suites; |
* fix: Project Agents API Tools From Accepted Results * test: Cover Non-Streaming Accepted Tool Projection --------- Co-authored-by: Lia <lia@librechat.ai>
Pull Request
Summary
The Agents API currently reconstructs OpenAI
tool_callsfrom run-step declarations and fragments. Those events describe tools the graph may already have executed, so internal and provider-owned calls can leak into the terminal client response as instructions to execute again. This also keeps the endpoint coupled to provider fragment indexes instead of the graph's accepted result.This PR switches the streaming and non-streaming Agents API handler assembly to the accepted-result projector published in
@librechat/agents@3.9.6. Content, reasoning, usage, and internal host-tool execution handlers remain unchanged. Graph- and provider-owned calls stay internal; only calls carrying an explicit trustedclientdisposition can enter OpenAItool_calls.Related to #13987
Related to #16206
Depends on LibreChat-AI/agents#560
How it works
The previous local run-step projector remains exported for compatibility and focused contract tests, but
createOpenAIHandlersno longer registers it. The endpoint now registers the SDK projector's graph-owned acceptance and claim handlers alongside LibreChat's existing content and usage handlers.Type of change
Testing
Tested environments/configuration:
@librechat/agents@3.9.6from the current lockfileAutomated tests:
cd packages/api && ../../node_modules/.bin/jest --runInBand --silent --coverage=false src/agents/openai/handlers.spec.ts src/agents/openai/service.spec.ts src/agents/openai/toolCalls.graph.spec.ts src/agents/openai/toolCalls.spec.ts src/agents/openai/toolCalls.contract.spec.tscd packages/api && ../../node_modules/.bin/tsc --noEmit--max-warnings=0, import sorting, and Prettiernpm run build:apiScreenshots / recordings
No user-facing UI change.
Risk / compatibility
The Agents API no longer emits graph-internal tool calls inferred from run steps. Caller-supplied OpenAI tools remain outside this PR because the service does not yet bind request tool schemas or authorize client execution. The legacy projector stays exported; only the endpoint handler assembly changes.
Checklist