Proposal: Reverse-Connected External Agent Runtime #16047
r05323028
started this conversation in
Feature Requests & Suggestions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
LibreChat can connect to external model and agent endpoints, but this assumes the LibreChat server can directly reach those endpoints.
That becomes difficult when the agent runs on a developer laptop or inside a private network.
For example:
The local machine can usually reach LibreChat, but LibreChat cannot necessarily reach the local machine because of NAT, CGNAT, firewall rules, or network topology.
Today, one workaround is to expose the local agent through an OpenAI-compatible API and configure it as a custom endpoint.
That works, but still requires solving the networking problem separately.
Proposal
Add support for a reverse-connected agent runtime.
A lightweight connector runs alongside the local agent and establishes an outbound WebSocket connection to LibreChat.
LibreChat would invoke the runtime through the already-established connection.
The server would never need to initiate a connection back to the user's machine.
Example Flow
The user starts a connector:
The connector registers available runtimes:
{ "type": "runtime.register", "runtime": { "name": "sean-macbook", "agents": [ { "id": "pi", "name": "Pi Coding Agent", "protocol": "openai-compatible" } ] } }LibreChat can then send an invocation through WebSocket:
{ "id": "req_123", "type": "agent.invoke", "agent": "pi", "payload": { "messages": [], "stream": true } }The connector calls the local runtime:
Streaming events travel back through the same WebSocket connection.
Adapter Model
I don't think LibreChat needs native support for every coding agent.
The connector could use adapters:
For an MVP, supporting only an OpenAI-compatible local endpoint may already be enough:
This would immediately support many existing tools without adding agent-specific logic to LibreChat core.
Why Not Just Use Tailscale / VPN / Public URLs?
Those are valid solutions, but they require users to configure networking separately.
A reverse-connected runtime would provide:
This is especially useful for coding agents that need access to local repositories, terminals, credentials, or MCP servers.
Security
The connector should not act as a generic reverse proxy.
Only explicitly registered runtimes should be callable.
For example:
LibreChat should not be able to request arbitrary URLs on the user's machine.
Possible protections:
Relationship to External Agents / A2A
I see this mainly as a transport option rather than a new agent abstraction.
When the server can reach the agent:
When the agent is private or local:
The higher-level agent model could remain the same.
Possible MVP
Connector
LibreChat Server
UI
Something simple like:
Use Cases
This could allow LibreChat to act as a frontend for:
without exposing those machines to inbound traffic.
Would a reverse-connected runtime like this fit with LibreChat's existing External Agent / A2A direction?
I think it could be especially useful for local coding agents, where the execution environment naturally lives on the developer's machine rather than next to the LibreChat server.
All reactions