#16498·LibreChat

feat: configure and render externally executed tool calls for custom endpoints

Author: jeannotdamoiseauxCreated Sep 29, 2026Updated Sep 29, 2026

Summary

LibreChat should support custom OpenAI-compatible endpoints that report a tool call while an external runtime owns its execution. This must preserve LibreChat's existing native tool-call user experience without attempting a duplicate local tool invocation.

This issue is the application-side companion to the agents-library issue, which handles stream normalization and execution ownership in the runtime.

Existing working behaviour to preserve

The intended user experience is already proven in a working implementation:

  • the existing native LibreChat tool card is shown;
  • the original tool name remains visible while running and after completion;
  • users can inspect the tool arguments using the standard expandable card;
  • a successful external call completes normally rather than being shown as Cancelled;
  • no Tool not found error is shown for a trusted externally owned call;
  • the final assistant answer remains visible;
  • no executor, vendor, workflow-engine, or provider label is shown in the UI.

This issue does not propose a new user-visible tool component or a provider-specific integration.

Proposed LibreChat responsibility

Add an endpoint-scoped opt-in configuration for custom OpenAI-compatible endpoints. When enabled, LibreChat should pass the validated policy to the agents runtime and persist optional execution ownership metadata alongside a tool call.

The custom-endpoint configuration should support:

yaml
endpoints:
  custom:
    - name: external-runtime
      apiKey: "${EXTERNAL_RUNTIME_API_KEY}"
      baseURL: "https://example.invalid/v1"
      externalToolExecution:
        enabled: true
        acceptedProviders:
          - remote-runtime

acceptedProviders is optional. When supplied, ownership metadata from another provider must not bypass ordinary local tool behaviour.

Calls from endpoints without externalToolExecution.enabled: true remain local by default.

UI and persistence requirements

  • Extend the shared tool-call model with optional execution ownership metadata.
  • Render externally owned calls through the existing native ToolCall card.
  • Preserve the current name, argument, running, completion, accessibility, and expansion behaviour.
  • Treat successful end of the enclosing stream as completion when no separate external completion event exists.
  • Do not display ownership metadata or a provider name to the user.
  • Do not alter existing local tools, MCP, Actions, Agents, code execution, or unknown-tool errors.

Acceptance criteria

  • The feature is disabled by default and enabled per custom endpoint.
  • Configuration is validated strictly and reaches the agents runtime.
  • The UI uses the existing native tool-card presentation for an external call.
  • An externally owned completed call is not shown as cancelled solely because LibreChat has no local tool output.
  • Tool arguments remain inspectable and do not expose transport-only metadata.
  • Local tool execution and unknown local-tool errors remain unchanged when no valid opt-in ownership metadata is present.
  • Endpoint policy, persistence, UI state, malformed metadata, provider allowlisting, and concurrent calls are covered by tests.
  • Documentation defines the provider-neutral OpenAI-compatible stream extension and endpoint configuration.

Related work

The linked agents-library issue provides the runtime capability. This issue owns LibreChat configuration, type persistence, presentation, documentation, and integration coverage. Coordinated draft pull requests will be linked to both issues.